const classcamAxonPlugin::Etc

sys::Obj
  camAxonPlugin::Etc

@Js

Etc provides folio related utility methods.

compareDis

Source

const 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

const 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

const 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

const 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

const static Str[] dictNames(Dict d)

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

dictRemove

Source

const static Dict dictRemove(Dict d, Str name)

Set a name/val pair in an existing dict.

dictSet

Source

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

Set a name/val pair in an existing dict.

dictToDis

Source

const 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

const 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

const static Obj?[] dictVals(Dict d)

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

dictsNames

Source

const 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

const static Dict emptyDict()

Get the emtpy Dict instance.

isDictVal

Source

const static Bool isDictVal(Obj? val)

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

isTagName

Source

const 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

const 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

const 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

const static Grid makeDictGrid(Obj? meta, Dict row)

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

makeDicts

Source

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

Make a list of Dict instances using makeDict.

makeDictsGrid

Source

const 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

const 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

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

Construct a grid for an error response.

makeListGrid

Source

const 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

const 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

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

Convenience for makeDictGrid

makeMapsGrid

Source

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

Convenience for makeDictsGrid

relDis

Source

const 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

const static Str tagToLocale(Str name)

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

toGrid

Source

const 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

const static Str toTagName(Str n)

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