const classcamAxonPlugin::Etc

sys::Obj
  camAxonPlugin::Etc

@Js

Etc provides folio related utility methods.

compareDis

Source

static Int compareDis(Str a, Str b)

Given two display strings, return 1, 0, or -1 if a is less than, equal to, or greater than b. The comparison is case insensitive and takes into account trailing digits so that a dis str such as "Foo-10" is greater than "Foo-2".

dictFindAll

Source

static Dict dictFindAll(Dict d, |Obj?,Str->Obj? f)

Apply the given map function to each name/value pair to construct a new Dict.

dictMap

Source

static Dict dictMap(Dict d, |Obj?,Str->Obj? f)

Apply the given map function to each name/value pair to construct a new Dict.

dictMerge

Source

static Dict dictMerge(Dict a, Obj? b)

Add/set all the name/value pairs in a with those defined in b. If b defines a remove value then that name/value is removed from a. The b parameter may be any value accepted by makeDict

dictNames

Source

static Str[] dictNames(Dict d)

Get a read/write list of the dict's name keys.

dictRemove

Source

static Dict dictRemove(Dict d, Str name)

Set a name/val pair in an existing dict.

dictSet

Source

static Dict dictSet(Dict d, Str name, Obj? val)

Set a name/val pair in an existing dict.

dictToDis

Source

static Str? dictToDis(Dict dict, Str? def := "")

Given a dic, attempt to find the best display string:

  1. disMacro tag returns macro using dict as scope
  2. dis tag
  3. name tag
  4. tag tag
  5. id tag
  6. default
dictToMap

Source

static Str:Obj? dictToMap(Dict d)

Convert a Dict to a read/write map. This method is expensive, when possible you should instead use Dict.each.

dictVals

Source

static Obj?[] dictVals(Dict d)

Get all the non-null values mapped by a dictionary.

dictsNames

Source

static Str[] dictsNames(Dict[] dicts)

Given a list of dictionaries, find all the common names used. Return the names in standard sorted order.

emptyDict

Source

static Dict emptyDict()

Get the emtpy Dict instance.

isDictVal

Source

static Bool isDictVal(Obj? val)

Return if the given value is one of the scalar values supported by dictions and grids.

isTagName

Source

static Bool isTagName(Str n)

Return if the given string is a legal tag name:

  • first char must be ASCII lower case letter: a - z
  • rest of chars must be ASCII letter or digit: a - z, A - Z, 0 - 9, or _
macro

Source

static Str macro(Str pattern, Dict scope)

Process macro pattern with given scope of variable name/value pairs. The pattern is a Unicode string with embedded expressions:

  • $tag: resolve tag name from scope
  • ${tag}: resolve tag name from scope
  • $<pod::key>: localization key

If a tag resolves to Ref, then we use Ref.dis for string.

makeDict

Source

static Dict makeDict(Obj? val)

Make a Dict instance where val is one of the following:

  • Dict: return val
  • null: return emptyDict
  • Str[]: dictionary of key/Marker value pairs
  • Str:Obj?: wrap map as Dict
makeDictGrid

Source

static Grid makeDictGrid(Obj? meta, Dict row)

Construct a grid for a Dict row. The meta parameter can be any makeDict value.

makeDicts

Source

static Dict[] makeDicts(Obj?[] maps)

Make a list of Dict instances using makeDict.

makeDictsGrid

Source

static Grid makeDictsGrid(Obj? meta, Dict[] rows)

Construct a grid for a list of Dict rows. The meta parameter can be any makeDict value.

makeEmptyGrid

Source

static Grid makeEmptyGrid(Obj? meta := null)

Construct an empty grid with just the given grid level meta-data. The meta parameter can be any makeDict value.

makeErrGrid

Source

static Grid makeErrGrid(Err e, Obj? meta := null)

Construct a grid for an error response.

makeListGrid

Source

static Grid makeListGrid(Obj? meta, Str colName, Obj? colMeta, Obj?[] rows)

Construct a grid with one column for a list. The meta and colMeta parameters can be any makeDict value.

makeListsGrid

Source

static Grid makeListsGrid(Obj? meta, Str[] colNames, Obj?[]? colMetas, Obj?[][] rows)

Construct a grid for a list of rows, where each row is a list of cells. The meta and colMetas parameters can be any makeDict value.

makeMapGrid

Source

static Grid makeMapGrid(Obj? meta, Str:Obj? row)

Convenience for makeDictGrid

makeMapsGrid

Source

static Grid makeMapsGrid(Obj? meta, Str:Obj?[] rows)

Convenience for makeDictsGrid

relDis

Source

static Str relDis(Str parent, Str child)

Get a relative display name. If the child display name starts with the parent, then we can strip that as the common suffix.

tagToLocale

Source

static Str tagToLocale(Str name)

Get the localized string for the given tag name for the current locale. See docSkySpark::Localization#tags.

toGrid

Source

static Grid toGrid(Obj? val)

Given an arbitrary object, translate it to a Grid suitable for serizliation with Zinc:

  • if grid just return it
  • if row in grid of size, return row.grid
  • if scalar return 1x1 grid
  • if dict return grid where dict is only
  • if list of dict return grid where each dict is row
  • if list of non-dicts, return one col grid with rows for each item
  • if non-zinc type return grid with cols val, type
toTagName

Source

static Str toTagName(Str n)

Take an arbitrary string ane convert into a safe tag name.