An attribute is either null (i.e. not defined---it hasn't been set yet), or symbolic (a name that has to be looked up using an IpeStyleSheet), or an absolute value.
A null value is used in higher levels of the hierarchy to defer the setting of the attribute to a lower level. For example, if the pen width is set in an IpeGroup object, all its members have this uniform pen width. To allow the members to have individual pen width, the IpeGroup must have a null pen width.
To make the representation more compact, Ipe objects store attribute values as an index into an IpeRepository. IpeAttribute encapsulates this index. Its meaning is as follows:
An attribute is absolute (IsAbsolute() returns true) if it is neither null nor symbolic.
Furthermore, the attribute stores the type of attribute, such as scalar (a double value), color, dash style, etc.
Note the difference between the null color, which means that the color has not yet been defined (it is left to lower-level objects), and the "void" color, which means that the object should not be filled.
When rendering an object, a null color is interpreted as the void color. This allows leaf objects not to specify the void color.
Note that it is impossible for style sheets to redefine the meaning of "black" and "white". If a user needs a symbolic name that is black or white in some styles, she can always define another symbolic name, e.g. "Black" and "White".
Note also the difference between null and "solid" (the special dash style of a solid line). It is impossible for style sheets to redefine the meaning of "solid".
When rendering an object, a null dash style is interpreted as solid.
enum IpeAttribute::TKind |
The different kinds of attributes.
IpeAttribute::IpeAttribute | ( | ) | [inline, explicit] |
Default constructor creates null object.
IpeAttribute::IpeAttribute | ( | TKind | kind, | |
bool | symbolic, | |||
int | index | |||
) | [explicit] |
Create an attribute of given kind.
Create an absolute numeric attribute.
int IpeAttribute::IsSymbolic | ( | ) | const [inline] |
Is it symbolic?
IpeAttribute::operator bool | ( | ) | const [inline] |
In bool expressions, attribute is false iff it is null.
bool IpeAttribute::IsNull | ( | ) | const [inline] |
Is it null?
bool IpeAttribute::IsAbsolute | ( | ) | const [inline] |
Is it absolute (including the special values void
, solid
, black
, or white
)?
int IpeAttribute::IsValue | ( | ) | const [inline] |
Is it an (absolute) value (either numeric or in IpeRepository)?
int IpeAttribute::IsNumeric | ( | ) | const [inline] |
Is it a numeric value?
bool IpeAttribute::IsVoid | ( | ) | const [inline] |
Is it void?
bool IpeAttribute::IsNullOrVoid | ( | ) | const [inline] |
Is it null or void (null is interpreted as void when drawing)?
bool IpeAttribute::IsSolid | ( | ) | const [inline] |
Is it solid?
bool IpeAttribute::IsNullOrSolid | ( | ) | const [inline] |
Is it null or solid (null is interpreted as solid when drawing)?
bool IpeAttribute::IsBlack | ( | ) | const [inline] |
Is it black?
bool IpeAttribute::IsWhite | ( | ) | const [inline] |
Is it white?
int IpeAttribute::Index | ( | ) | const [inline] |
Return index into IpeRepository.
IpeFixed IpeAttribute::Number | ( | ) | const [inline] |
Return value of absolute numeric argument.
IpeKind IpeAttribute::Kind | ( | ) | const |
Return kind of attribute.
bool IpeAttribute::operator== | ( | const IpeAttribute & | rhs | ) | const [inline] |
Are two values equal (only compares index!).
bool IpeAttribute::operator!= | ( | const IpeAttribute & | rhs | ) | const [inline] |
Are two values different (only compares index!).
static IpeAttribute IpeAttribute::Void | ( | ) | [inline, static] |
Create void color or pen.
static IpeAttribute IpeAttribute::Solid | ( | ) | [inline, static] |
Create solid dash style.
static IpeAttribute IpeAttribute::Black | ( | ) | [inline, static] |
Create black color.
static IpeAttribute IpeAttribute::White | ( | ) | [inline, static] |
Create white color.