class
Attribute
(Return to index)
A representation of an Object attribute.
Contains a pointer to the polymorphic attribute value (derived from
AttributeBase, and a pointer to the polymorphic attribute
parser (derived from AttributeHandler).
Type: |
Instantiable |
Include file: |
./AbstractObjects/Attribute.hh |
Synopsis (including inherited members):
Documentation:
- Public members:
-
Attribute
()
;
- Default constructor.
Leaves both pointers NULL.
An object constructed by the default constructor must be initialized
using assignment before it can be used.
Failing to do so may cause a program crash.
-
Attribute
(const Attribute&)
;
- Copy constructor.
Both value and parser are shared with rhs.
-
Attribute
(AttributeHandler*,AttributeBase*)
;
- Constructor defining a parser and an optional value.
The default value is ``undefined''.
-
void doomGet
(const DoomReader&,int)
;
- Read attribute from the DOOM data base.
Use the contained parser to read the attribute.
-
void doomPut
(DoomWriter&,int)const
;
- Write attribute to the DOOM data base.
Use the contained parser to write the attribute.
-
AttributeBase& getBase
()const
;
- Return reference to polymorphic value.
-
AttributeHandler& getHandler
()const
;
- Return a reference to the parser.
-
const string& getHelp
()const
;
- Return the help string.
This string is stored in the parser object.
-
string getImage
()const
;
- Return printable representation.
This string duplicates the input expression defining the attribute.
-
const string& getName
()const
;
- Return the attribute name.
This string is stored in the parser object.
-
const string& getType
()const
;
- Return the attribute type.
This string ("real", "logical", etc.) is stored in the parser object.
-
bool isDeferred
()const
;
- Return deferred flag.
If this flag is set, any expression is re-evaluated each time the
value is fetched. Normally attribute evaluation is not deferred,
i. e. any expression is evaluated only the first time the value is
fetched after a new definition has been read.
See Expressions::ADeferred and Expressions::SDeferred
for information.
-
bool isExpression
()const
;
- Test for expression.
Return true, if the attribute is defined as an expression.
-
bool isReadOnly
()const
;
- Test for read only.
Return true, if the attribute cannot be redefined by the user.
-
operator bool
()const
;
- Test for valid pointer.
Returns true, when the value is defined (non-null pointer).
-
void parse
(Statement&,bool)
;
- Parse attribute.
Use the contained parser to parse a new value for the attribute.
-
void parseComponent
(Statement&,bool,int)
;
- Parse array component.
Use the contained parser to parse a new value for an existing
vector component. If the attribute is a scalar value, or if the
component does not exist, this method throws MadException.
-
void print
(std::ostream&,int&)const
;
- Print attribute.
Print the attribute name, followed by an equals sign and its value.
-
void set
(AttributeBase*)
;
- Define new value.
Assign a new value. The value must be compatible with the parser
type, otherwise a MadException is thrown.
-
void setDefault
()
;
- Assign default value.
Set the attribute value to the default value stored in the parser.
If no default value exists, set it to ``undefined''.
-
void setDeferred
(bool)
;
- Set read-only flag.
If this flag is set, the attribute cannot be redefined by the user.
See Expressions::ADeferred and Expressions::SDeferred
for information.
-
void setReadOnly
(bool)
;
- Set read-only flag.
Set or reset the attribute's read-only flag.
Documentation generated by fci on Mon Feb 7 12:29:45 2000