wxArt2D
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members

This is the base class for all kinds of property id's for a2dObject. More...

#include <id.h>

Inheritance diagram for a2dPropertyId:
Inheritance graph
[legend]

Public Types

enum  Flags {
  flag_none = 0x00000000, flag_temporary = 0x00000001, flag_transfer = 0x00000002, flag_onlymember = 0x00000004,
  flag_onlymemberhint = 0x00000008, flag_listfirst = 0x00000010, flag_multiple = 0x00000020, flag_clonedeep = 0x00000040,
  flag_listonly = 0x00000080, flag_norender = 0x00000100, flag_userDefined = 0x00000200, flag_isEditable = 0x00000400,
  flag_notify = 0x00000800
}
 Flags for property ids. More...
 
enum  SetFlags { set_none = 0x00000000, set_onlymember = 0x00000010, set_remove_non_member = 0x00000020, set_remove_property = 0x00000040 }
 Flags used for manipulating the way a property is set to a2dObject. More...
 

Public Member Functions

 a2dPropertyId (const wxString &name, Flags flags)
 Default constructor.
 
virtual ~a2dPropertyId ()
 destructor
 
virtual wxString GetName () const
 Get the ids print and serialization name.
 
void SetName (const wxString &name)
 Set the ids print and serialization name.
 
virtual const a2dPropertyIdGetMainID () const
 Get the main (pre-dot) part of a hierarchical id.
 
virtual const a2dPropertyIdGetSubID () const
 Get the sub (post-dot) part of a hierarchical id.
 
virtual bool operator== (const a2dPropertyId &other) const
 Check if this id is equal to another id.
 
virtual a2dNamedPropertyCreatePropertyFromString (const wxString &value) const
 Create a new property object from a value string.
 
virtual a2dNamedPropertyGetPropertyAsNamedProperty (const a2dObject *obj) const
 
virtual void SetNamedPropertyToObject (a2dObject *obj, a2dNamedProperty *nprop, SetFlags setflags=set_none) const
 Set the property in obj to value (not cloning value)
 
bool IsCloneDeep () const
 Test if this id identifies a property that needs to be cloned deep.
 
bool IsTemporary () const
 Test if this id identifies a temporary property.
 
bool IsTransfer () const
 true if this property is transfered via e.g. a command processor
 
bool IsOnlyMember () const
 true if this property is only set as member
 
bool IsOnlyMemberHint () const
 true if this property has the only set as member hint set
 
bool IsListFirst () const
 true if this property searches the list first, then members
 
bool IsListOnly () const
 true if this property searches the list only
 
bool IsUserDefined () const
 true if this property is user defined
 
bool IsEditable () const
 true if this property is editable ( can be tested in a property editor ).
 
bool CheckFlags (Flags flags) const
 check a flag mask (all given flags must be set)
 
bool CheckCollect (const a2dPropertyId *id, Flags flags) const
 check a property id and flags to see if the property shall be collected
 
void RemovePropertyFromObject (a2dObject *obj) const
 Dynamic properties with this id will be removed from the object. More...
 

Protected Member Functions

 a2dPropertyId ()
 this constructor is only for property ids referencing other property ids
 
void DoAddPropertyToObject (a2dObject *obj, a2dNamedProperty *prop) const
 this is called by derived classes to add a list property in an object More...
 
bool DoIgnoreIfNotMember (a2dObject *obj) const
 this is called by derived to check if a property should be added as non-member More...
 

Static Protected Member Functions

static void DoSetPropertyId (a2dNamedProperty *prop, a2dPropertyId *id)
 this is called by derived classes to change an id in a property More...
 

Protected Attributes

wxString m_name
 
Flags m_flags
 

Friends

class a2dSmrtPtrBase
 
Flags operator| (Flags a, Flags b)
 
Flags operator& (Flags a, Flags b)
 
SetFlags operator| (SetFlags a, SetFlags b)
 

Detailed Description

This is the base class for all kinds of property id's for a2dObject.

Some facts about a2dPropertyId and its derivatives

The a2dPropertyId has a major role in setting a property to an object If a property or member is set to an object, a2dPropertyId does:

The first task can obviously only be performed by the property id and not by the target object, because the target object does not have type specific functions.

The second task could be performed by the target object directly in many cases, but there are a lot of exceptions, where a propertyId can do it easier:

A property or member is set to an object via the following functions

Definition at line 154 of file id.h.

Member Enumeration Documentation

Flags for property ids.

Enumerator
flag_none 

no special flags set

flag_temporary 

the property is temporary and never saved

flag_transfer 

transfer this property via a command processor

This is most usefull for general properties like styles in a drawing applications. You should set flag_onlymemberhint as well.

flag_onlymember 

set this property only as member, never as property list item

flag_onlymemberhint 

this is a hint for DoIgnoreIfNotMember in derived classes

flag_listfirst 

Search the list before searching members.

This is an optimization flag for properties that are most frequently found in the list (e.g. stroke, fill, ... )

flag_multiple 

Allow adding a specific property with ID more than once to a list.

If this Id refers to a member, it is still added only once

flag_clonedeep 

When cloning, and this flag is set, the property is cloned deep, else not.

In cases like editing, temporary properties are added to a document, which are removed later on. Those properties are not rendered, and only store a pointer to some other a2dObject. In such cases a clone should not be made of the a2dObject pointed to. In cases like fill and stroke properties, it is often required.

flag_listonly 

Search the list only for this dynamic property.

This is an optimization flag for properties that are only found in the list

flag_norender 

when set this type of property has no influence on rendering

flag_userDefined 

A property id defined by user.

flag_isEditable 

A property id for a property which is editable.

flag_notify 

If a property with this id has changed its parent/holder will be notified.

Definition at line 158 of file id.h.

Flags used for manipulating the way a property is set to a2dObject.

Enumerator
set_none 

no special flags set

set_onlymember 

set the property also to all childs

This is NOT evaluated by the property code. This serves a s a hint to a2dObject derived classesset the property only as a member, never as a list item

set_remove_non_member 

if the property is found as member, set it, otherwise remove it from the list

set_remove_property 

remove the property, don't set it as member

Definition at line 219 of file id.h.

Member Function Documentation

void a2dPropertyId::DoAddPropertyToObject ( a2dObject obj,
a2dNamedProperty prop 
) const
inlineprotected

this is called by derived classes to add a list property in an object

This functions exists because the derived classes are not friend of a2dObject. This function gives access to a2dObject::AddProperty.

bool a2dPropertyId::DoIgnoreIfNotMember ( a2dObject obj) const
inlineprotected

this is called by derived to check if a property should be added as non-member

This functions exists because the derived classes are not friend of a2dObject. This function gives access to a2dObject::DoIgnoreIfNotMember.

Definition at line 21 of file id.inl.

void a2dPropertyId::DoSetPropertyId ( a2dNamedProperty prop,
a2dPropertyId id 
)
inlinestaticprotected

this is called by derived classes to change an id in a property

This functions exists because the derived classes are not friend of a2dNamedProperty. This function gives access to a2dNamedProperty.

Definition at line 26 of file id.inl.

void a2dPropertyId::RemovePropertyFromObject ( a2dObject obj) const

Dynamic properties with this id will be removed from the object.

Parameters
objthe object to remove the properties from
setflagsmust at least be set_remove_property ( default ), can be extended to be more specific.

Definition at line 87 of file id.cpp.


The documentation for this class was generated from the following files:
a2dPropertyId Class Reference -- Sun Oct 12 2014 17:04:46 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation