21 #ifndef OTAWA_PROP_PROPLIST_H
22 #define OTAWA_PROP_PROPLIST_H
24 #include <elm/utility.h>
25 #include <elm/PreIterator.h>
26 #include <elm/util/VarArg.h>
28 namespace elm {
template <
class T>
class Initializer; }
33 class AbstractIdentifier;
38 extern const AbstractIdentifier
END;
56 template <
class T>
inline const T&
get(void)
const;
57 template <
class T>
inline void set(
const T& value);
101 {
return item()->
id() == id; }
103 {
return item()->
id() != id; }
105 {
return item()->
id() == &id; }
107 {
return item()->
id() != &id; }
143 #endif // OTAWA_PROP_PROPLIST_H
~PropList(void)
Definition: PropList.h:69
PropList(void)
Build an empty property list.
Definition: PropList.h:68
void setProp(Property *prop)
Set the property in the property list removing any double.
Definition: prop_PropList.cpp:379
void next(void)
Go to the next property.
Definition: PropList.h:119
This class is used for accessing all properties of property list with a given identifier.
Definition: PropList.h:111
virtual void print(elm::io::Output &out) const
Print the given property, that is, the identifier and its value if any.
Definition: prop_PropList.cpp:289
static const PropList EMPTY
This is an empty proplist for convenience.
Definition: PropList.h:66
const AbstractIdentifier * id(void) const
Get the identifier code of the property.
Definition: PropList.h:54
PropList(const PropList &props)
Initialize a property list from a sequence of (identifier, value) pairs passed as variable arguments...
Definition: PropList.h:67
bool ended(void) const
Test if there is still a property to examine.
Definition: PropList.h:117
Property * next(void) const
Get the next property.
Definition: PropList.h:55
bool operator==(const AbstractIdentifier &id) const
Equality overload for testing if a property is equals to an identifier.
Definition: PropList.h:104
Iter iter
Definition: PropList.h:121
static const AbstractIdentifier * getID(elm::CString name)
Allocate a new identifier matching the given name.
Definition: prop_PropList.cpp:245
Getter(const PropList &list, const AbstractIdentifier &id)
Build an iterator on properties matching the given name.
Definition: PropList.h:115
bool hasProp(const AbstractIdentifier &id) const
Test if the property list contains a property matching the given identifier.
Definition: PropList.h:81
Property * prop
Definition: PropList.h:93
elm::io::Output & operator<<(elm::io::Output &out, Address addr)
Definition: base.cpp:188
void setProp(const AbstractIdentifier *id)
Definition: PropList.h:78
Represents a unique identifier used by the annotation system.
Definition: AbstractIdentifier.h:32
This iterator is used for reading all properties of a property list.
Definition: PropList.h:92
void look(void)
Definition: PropList.h:123
const AbstractIdentifier * _id
Definition: PropList.h:45
Iter(const PropList &list)
Build a property iterator.
Definition: PropList.h:95
bool operator==(const AbstractIdentifier *id) const
Equality overload for testing if a property is equals to an identifier.
Definition: PropList.h:100
Property * extractProp(const AbstractIdentifier &id)
Remove a property matching the given identifier and return it.
Definition: PropList.h:77
PropList & operator=(const PropList &props)
Definition: PropList.h:88
virtual ~Property(void)
Virtual destructor for allowing destruction of any stored data.
Definition: PropList.h:47
void addProp(Property *prop)
Add property to the list without checking of duplication.
Definition: prop_PropList.cpp:537
Property * extractProp(const AbstractIdentifier *id)
Remove a property matching the given identifier and return it.
Definition: prop_PropList.cpp:427
const AbstractIdentifier & _id
Definition: PropList.h:122
void removeProp(const AbstractIdentifier &id)
Definition: PropList.h:75
sys::SystemOutStream & out
void clearProps(void)
Remove all properties from the list.
Definition: prop_PropList.cpp:452
void print(elm::io::Output &out) const
Display the current property list.
Definition: prop_PropList.cpp:639
void set(const T &value)
Definition: Property.h:70
void removeProp(const AbstractIdentifier *id)
Remove a property matching the given identifier.
Definition: prop_PropList.cpp:409
Getter(const PropList *list, const AbstractIdentifier &id)
Build an iterator on properties matching the given name.
Definition: PropList.h:113
bool ended(void) const
Test if there is still a property to examine.
Definition: PropList.h:98
void next(void)
Go to the next property.
Definition: PropList.h:97
virtual Property * copy(void)
This method is called when a property is copied.
Definition: PropList.h:48
Iter(const PropList *list)
Build a property iterator.
Definition: PropList.h:96
cstring name
Definition: odisasm.cpp:107
bool operator!=(const AbstractIdentifier *id) const
Equality overload for testing if a property is equals to an identifier.
Definition: PropList.h:102
const AbstractIdentifier END
This identifier is used for marking the end of property list definition in variable arguments "...
Property(const AbstractIdentifier *id)
Build a new property with the given identifier.
Definition: PropList.h:51
Property * item(void) const
Get the current property.
Definition: PropList.h:118
This a list of properties.
Definition: PropList.h:63
void removeAllProp(const AbstractIdentifier *id)
Remove all the properties matching the given identifier.
Definition: prop_PropList.cpp:547
bool operator!=(const AbstractIdentifier &id) const
Equality overload for testing if a property is equals to an identifier.
Definition: PropList.h:106
Property * item(void) const
Get the current property.
Definition: PropList.h:99
Property * getProp(const AbstractIdentifier *id) const
Find a property by its identifier.
Definition: prop_PropList.cpp:357
A property associates a data with an identifier.
Definition: PropList.h:42
Property * _next
Definition: PropList.h:44
Property(const AbstractIdentifier &id)
build a property from a static identifier.
Definition: PropList.h:52
Property * head
Definition: PropList.h:64
Property(elm::CString name)
Build a property with the name of its identifier.
Definition: PropList.h:53
void addProps(const PropList &props)
Add all properties from the given property list, in a reverse order.
Definition: prop_PropList.cpp:344