Appendix: Message Class/Field Properties¶
This appendix lists the properties that can be used to customize C++ code generated from message descriptions.
- @abstract
- (type: bool, use: field, class)If true: For a class, it indicates that it is an abstract class in the C++ sense (one which cannot be instantiated). For a field, it requests that the accessor methods for the field be made pure virtual and no data member be generated; it also makes the class that contains the field abstract (unless the class has @customize whereas it is assumed that the custom code implements the pure virtual member functions).
- @allowReplace
- (type: bool, use: field)Specifies whether the setter method of an owned pointer field is allowed to delete the previously set object.
- @appender
- (type: string, use: field)Name of the appender method. (This method appends an element to a dynamic array.) When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @argType
- (type: string, use: field, class)Field setter argument C++ base type. This type may be decorated with ’const’ and ’*’/’&’ to produce the actual argument type. When specified on a class, it determines the default for fields of that type.
- @baseType
- (type: string, use: enum)Specifies the underlying data type for the enum.
- @beforeChange
- (type: string, use: class)Method to be called before mutator code (in setters, non-const getters, operator=, etc.).
- @byValue
- (type: bool, use: field, class)If true: Causes the value to be passed by value (instead of by reference) in setters/getters. When specified on a class, it determines the default for fields of that type.
- @castFunction
- (type: bool, use: class)If false: Do not specialize the fromAnyPtr<T>(any_ptr) function for this class. Useful for preventing compile errors if the function already exists, e.g. in hand-written form, or generated for another type (think aliased typedefs).
- @class
- (type: bool, use: enum)Specifies whether this enum is to be declared as ’enum class’.
- @clone
- (type: string, use: field, class)For owned pointer fields: Code to duplicate (one array element of) the field value. When specified on a class, it determines the default for fields of that type.
- @cppType
- (type: string, use: field, class)C++ datatype. Provides a common default for @datamemberType, @argType and @returnType. When specified on a class, it determines the default for fields of that type.
- @custom
- (type: bool, use: field)If true: Do not generate any data or code for the field, only add it to the descriptor. Indicates that the field’s implementation will be added to the class via targeted cplusplus blocks.
- @customImpl
- (type: bool, use: field)If true: Do not generate implementations for the field’s accessor methods, to allow custom implementations to be supplied by the user via cplusplus blocks or in separate .cc files.
- @customize
- (type: bool, use: class)If true: Customize the class via inheritance. Generates base class <name>_Base.
- @datamemberType
- (type: string, use: field, class)Data member C++ base data type. This type is decorated with ’*’ if the field is a pointer. When specified on a class, it determines the default for fields of that type.
- @defaultValue
- (type: string, use: class)Default value for fields of this type.
- @descriptor
- (type: string, use: class)A ’true’/’false’ value specifies whether to generate descriptor class; special value ’readonly’ requests generating a read-only descriptor (but specifying @editable/@replaceable/@resizable on individual fields overrides that).
- @displayMode
- (type: string, use: class)Display mode override for objects of this class in Qtenv inspectors: ’children’ or ’details’
- @editable
- (type: bool, use: field, class)Affects descriptor class only. If true: Value of the field (or value of fields that are instances of this type) can be set via the class descriptor’s setFieldValueFromString() and setFieldValue() methods.
- @enum
- (type: string, use: field)For integer fields: Values are from the given enum.
- @eraser
- (type: string, use: field)Name of the eraser method. (This method erases an element from a dynamic array. Indices above the specified one are shifted down.) When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @eventlog
- (type: string, use: field)When @eventlog(skip) is given, eventlog recording will skip this field when serializing objects
- @existingClass
- (type: bool, use: class)If true: This is a type is already defined in C++, i.e. it does not need to be generated.
- @fieldNameSuffix
- (type: string, use: class)Suffix to append to the names of data members.
- @fromString
- (type: string, use: field, class)Affects descriptor class only. Method name, code fragment or funcall template to convert string to field value. When specified on a class, it determines the default for fields of that type.
- @fromValue
- (type: string, use: field, class)Affects descriptor class only. Method name, code fragment or funcall template to convert cValue to field value. When specified on a class, it determines the default for fields of that type.
- @getter
- (type: string, use: field)Name of the (const) getter method. When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @getterConversion
- (type: string, use: field, class)Method name, code fragment or funcall template to convert field data type to the return type in getters. When specified on a class, it determines the default for fields of that type.
- @getterForUpdate
- (type: string, use: field)Name of the non-const getter method. When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @group
- (type: string, use: field)Used for grouping of fields in Qtenv inspectors
- @hint
- (type: string, use: field)Short description of the field, displayed in Qtenv inspectors as tooltip
- @icon
- (type: string, use: class)Icon for objects of this class in Qtenv inspectors
- @implements
- (type: stringlist, use: class)Names of additional base classes.
- @inserter
- (type: string, use: field)Name of the inserter method. (This method inserts an element into a dynamic array.) When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @label
- (type: string, use: field)When specified, this string will be displayed as field name in Qtenv inspectors
- @nopack
- (type: bool, use: field)If true: Ignore this field in parsimPack/parsimUnpack methods.
- @omitGetVerb
- (type: bool, use: class)If true: Drop the ’get’ verb from the names of getter methods.
- @opaque
- (type: bool, use: field, class)Affects descriptor class only. If true: Treat the field as atomic (non-compound) type, i.e. having no descriptor class. When specified on a class, it determines the default for fields of that type.
- @overrideGetter
- (type: bool, use: field)If true: Add the ’override’ keyword to the declaration of the getter method.
- @overrideSetter
- (type: bool, use: field)If true: Add the ’override’ keyword to the declaration of the setter method.
- @owned
- (type: bool, use: field)For pointers and pointer arrays: Whether allocated memory is owned by the object (needs to be duplicated in dup(), and deleted in destructor). If field type is also a cOwnedObject, take()/drop() calls are also generated.
- @packetData
- (type: string, use: class, field)Denotes packet data in frameworks such as INET; used in Qtenv inspectors
- @polymorphic
- (type: bool, use: class)Specifies whether this type is polymorphic, i.e. has any virtual member function.
- @primitive
- (type: bool, use: field, class)Shortcut for @opaque @byValue @editable @subclassable(false) @supportsPtr(false).
- @property
- (type: any, use: file)Property for declaring properties.
- @readonly
- (type: bool, use: field)Affects descriptor class only. Equivalent to @editable(false) @replaceable(false) @resizable(false).
- @remover
- (type: string, use: field)Name of the remover method. (This method is generated for owned pointer fields. It releases the ownership of the stored object, sets the field to nullptr, then returns the object.) When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @replaceable
- (type: bool, use: field)Affects descriptor class only. If true: Field is a pointer whose value can be set via the class descriptor’s setFieldStructValuePointer() and setFieldValue() methods.
- @resizable
- (type: bool, use: field)Affects descriptor class only. If true: Field is a variable-size array whose size can be set via the class descriptor’s setFieldArraySize() method.
- @returnType
- (type: string, use: field, class)Field getter C++ base return type. This type may be decorated with ’const’ and ’*’/’&’ to produce the actual return type. When specified on a class, it determines the default for fields of that type.
- @setter
- (type: string, use: field)Name of the setter method. When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @sizeGetter
- (type: string, use: field)Name of the method that returns the array size. When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @sizeSetter
- (type: string, use: field)Name of the method that sets size of dynamic array. When generating a descriptor for an existing class (see @existingClass), a code fragment or funcall template for the equivalent functionality is also accepted.
- @sizeType
- (type: string, use: field)C++ type to use for array sizes and indices.
- @str
- (type: string, use: class)Expression to be returned from the generated str() method.
- @subclassable
- (type: bool, use: class)Specifies whether this type can be subclassed (e.g. C++ primitive types and final classes cannot).
- @supportsPtr
- (type: bool, use: field, class)Specifies whether this type supports creating a pointer (or pointer array) from it.
- @toString
- (type: string, use: field, class)Affects descriptor class only. Method name, code fragment or funcall template to convert field value to string. When specified on a class, it determines the default for fields of that type.
- @toValue
- (type: string, use: field, class)Affects descriptor class only. Method name, code fragment or funcall template to convert field value to cValue. When specified on a class, it determines the default for fields of that type.