nitc :: CmdOptions
nitc :: CmdOptions :: _allowed_visibility
Map String visiblity name to MVisibility objectnitc :: CmdOptions :: allowed_visibility
Map String visiblity name to MVisibility objectnitc :: CmdOptions :: allowed_visibility=
Map String visiblity name to MVisibility objectnitc :: CmdOptions :: defaultinit
nitc :: CmdOptions :: opt_mentity
Get option as a MEntitynitc :: CmdOptions :: opt_string
Get option value forkey
as String
nitc :: CmdOptions :: opt_visibility
Get option as a MVisibilitynitc $ CmdOptions :: SELF
Type of this instance, automatically specialized in every classnitc :: CmdOptions :: _allowed_visibility
Map String visiblity name to MVisibility objectcore :: HashCollection :: _array
core :: HashCollection :: _capacity
core :: HashCollection :: _first_item
core :: HashCollection :: _last_accessed_key
The last key accessed (used for cache)core :: HashCollection :: _last_accessed_node
The last node accessed (used for cache)core :: HashCollection :: _last_item
core :: HashCollection :: _the_length
serialization :: Serializable :: accept_inspect_serializer_core
serialization :: Serializable :: accept_json_serializer
Refinable service to customize the serialization of this class to JSONserialization :: Serializable :: accept_msgpack_attribute_counter
Hook to customize the behavior of theAttributeCounter
serialization :: Serializable :: accept_msgpack_serializer
Hook to customize the serialization of this class to MessagePackserialization :: Serializable :: add_to_bundle
Called by[]=
to dynamically choose the appropriate method according
nitc :: CmdOptions :: allowed_visibility
Map String visiblity name to MVisibility objectnitc :: CmdOptions :: allowed_visibility=
Map String visiblity name to MVisibility objectcore :: HashCollection :: array
core :: HashCollection :: array=
core :: HashCollection :: capacity
core :: HashCollection :: capacity=
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
serialization :: Serializable :: core_serialize_to
Actual serialization ofself
to serializer
core :: Map :: defaultinit
core :: HashMap :: defaultinit
nitc :: CmdOptions :: defaultinit
core :: HashCollection :: defaultinit
core :: MapRead :: defaultinit
core :: Object :: defaultinit
core :: MapRead :: filter_keys
Return all elements ofkeys
that have a value.
core :: HashCollection :: first_item
core :: HashCollection :: first_item=
serialization :: Serializable :: from_deserializer
Create an instance of this class from thedeserializer
core :: MapRead :: get_or_default
Get the item atkey
or return default
if not in map
core :: MapRead :: get_or_null
Get the item atkey
or null if key
is not in the map.
core :: HashCollection :: gt_collide
Count and update length of collisions fornode_at_idx
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: MapRead :: keys_sorted_by_values
Return an array of all keys sorted with their values usingcomparator
.
core :: HashCollection :: last_accessed_key
The last key accessed (used for cache)core :: HashCollection :: last_accessed_key=
The last key accessed (used for cache)core :: HashCollection :: last_accessed_node
The last node accessed (used for cache)core :: HashCollection :: last_accessed_node=
The last node accessed (used for cache)core :: HashCollection :: last_item
core :: HashCollection :: last_item=
core :: MapRead :: lookup_all_values
Search all the values inpe.greaters
.
core :: MapRead :: lookup_values
Combine the values inpe.greaters
from the most smaller elements that have a value.
serialization :: Serializable :: msgpack_extra_array_items
Hook to request a larger than usual metadata arraycore :: Object :: native_class_name
The class name of the object in CString format.core :: HashCollection :: node_at_idx
Return the node associated with the key (but with the index already known)nitc :: CmdOptions :: opt_mentity
Get option as a MEntitynitc :: CmdOptions :: opt_string
Get option value forkey
as String
nitc :: CmdOptions :: opt_visibility
Get option as a MVisibilitycore :: Object :: output_class_name
Display class name on stdout (debug only).core :: MapRead :: provide_default_value
Called by the underling implementation of[]
to provide a default value when a key
has no value
core :: HashCollection :: remove_node
Remove the node assosiated with the keyserialization :: Serializable :: serialize_msgpack
Serializeself
to MessagePack bytes
serialization :: Serializable :: serialize_to
Serializeself
to serializer
serialization :: Serializable :: serialize_to_json
Serializeself
to JSON
serialization :: Serializable :: serialize_to_or_delay
Accept references or force direct serialization (usingserialize_to
)
core :: HashCollection :: st_collide
Count and update length of collisions forstore
core :: HashCollection :: the_length
core :: HashCollection :: the_length=
core :: MapRead :: to_map_comparator
A comparator that compares things with their values in self.serialization :: Serializable :: to_pretty_json
Serializeself
to plain pretty JSON
core :: MapRead :: values_sorted_by_key
Return an array of all values sorted with their keys usingcomparator
.
Serializer::serialize
# Commands options
class CmdOptions
super HashMap[String, String]
# Map String visiblity name to MVisibility object
var allowed_visibility: HashMap[String, MVisibility] is lazy do
var res = new HashMap[String, MVisibility]
res["public"] = public_visibility
res["protected"] = protected_visibility
res["private"] = private_visibility
return res
end
# Get option value for `key` as String
#
# Return `null` if no option with that `key` or if value is empty.
fun opt_string(key: String): nullable String do
if not has_key(key) then return null
var value = self[key]
if value.is_empty then return null
return value
end
# Get option value for `key` as Int
#
# Return `null` if no option with that `key` or if value is not an Int.
fun opt_int(key: String): nullable Int do
if not has_key(key) then return null
var value = self[key]
if not value.is_int then return null
return value.to_i
end
# Get option value as bool
#
# Return `true` if the value with that `key` is empty or equals `"true"`.
# Return `false` if the value with that `key` equals `"false"`.
# Return `null` in any other case.
fun opt_bool(key: String): nullable Bool do
if not has_key(key) then return null
var value = self[key]
if value.is_empty or value == "true" then return true
if value == "false" then return false
return null
end
# Get option as a MVisibility
#
# Return `null` if no option with that `key` or if the value is not in
# `allowed_visibility`.
fun opt_visibility(key: String): nullable MVisibility do
var value = opt_string(key)
if value == null then return null
if not allowed_visibility.keys.has(key) then return null
return allowed_visibility[value]
end
# Get option as a MEntity
#
# Lookup first by `MEntity::full_name` then by `MEntity::name`.
# Return `null` if the mentity name does not exist or return a conflict.
private fun opt_mentity(model: Model, key: String): nullable MEntity do
var value = opt_string(key)
if value == null or value.is_empty then return null
var mentity = model.mentity_by_full_name(value)
if mentity != null then return mentity
var mentities = model.mentities_by_name(value)
if mentities.is_empty or mentities.length > 1 then return null
return mentities.first
end
end
src/doc/commands/commands_parser.nit:399,1--471,3