![]() |
PIP 5.5.3
Platform-Independent Primitives
|
This class provides key-value properties storage. More...
#include <pipropertystorage.h>
Classes | |
| class | Property |
| PIPropertyStorage element. More... | |
Public Member Functions | |
| PIPropertyStorage () | |
| Contructs an empty PIPropertyStorage. | |
| PIPropertyStorage (const PIVector< Property > &pl) | |
| Contructs PIPropertyStorage with "pl" properties. | |
| PIPropertyStorage (PIVector< Property > &&o) | |
| Contructs PIPropertyStorage from another "o". | |
| int | length () const |
| Returns properties count. | |
| int | size () const |
| Returns properties count. | |
| bool | isEmpty () const |
| Returns if no properties. | |
| bool | isNotEmpty () const |
| Returns if properties. | |
| Property & | front () |
| Returns first property. | |
| const Property & | front () const |
| Returns first property as const. | |
| Property & | back () |
| Returns last property. | |
| const Property & | back () const |
| Returns last property as const. | |
| void | removeAt (int i) |
| Remove property at index "i". | |
| void | clear () |
| Remove all properties. | |
| PIPropertyStorage | copy () const |
| Returns copy of this PIPropertyStorage. | |
| int | propertiesCount () const |
| Returns properties count. | |
| PIVector< Property > & | properties () |
| Returns properties as PIVector. | |
| const PIVector< Property > & | properties () const |
| Returns properties as const PIVector. | |
| bool | isPropertyExists (const PIString &name) const |
| Returns if properties with name "name" exists. | |
| void | clearProperties () |
| Remove all properties. | |
| bool | addProperty (const Property &p) |
| Add property if name isn't present in storage, otherwrise update existing property with same name. More... | |
| bool | addProperty (const PIString &_name, const PIVariant &_def_value, const PIString &_comment=PIString(), int _flags=0) |
| Add property if name isn't present in storage, otherwrise update existing property with same name. More... | |
| bool | removeProperty (const PIString &name) |
| Remove property with name "name", returns if property removed. | |
| int | removePropertiesByFlag (int flag) |
| Remove all properties with flag "flag" set, returns removed properties count. More... | |
| void | updateProperties (const PIVector< Property > &properties, int flag_ignore=0) |
| Merge other "properties" into this. More... | |
| Property | propertyByName (const PIString &name) const |
| Returns property with name "name" or default-constructed PIPropertyStorage::Property. | |
| PIVariant | propertyValueByName (const PIString &name) const |
| Returns property value with name "name" or invalid PIVariant. | |
| bool | setPropertyValue (const PIString &name, const PIVariant &value) |
| Set value of property with name "name" to "value", returns if property exists. | |
| bool | setPropertyComment (const PIString &name, const PIString &comment) |
| Set comment of property with name "name" to "comment", returns if property exists. | |
| bool | setPropertyFlags (const PIString &name, int flags) |
| Set flags of property with name "name" to "flags", returns if property exists. | |
| PIPropertyStorage & | operator<< (const PIPropertyStorage::Property &p) |
| Add property "p". | |
| PIPropertyStorage & | operator<< (const PIVector< Property > &p) |
| Add properties "p". | |
| PIPropertyStorage & | operator<< (const PIPropertyStorage &p) |
| Add properties "p". | |
| Property & | operator[] (int i) |
| Returns property with index "i". | |
| const Property & | operator[] (int i) const |
| Returns property with index "i" as const. | |
| Property & | operator[] (const PIString &name) |
| Returns property with name "name". | |
| const Property | operator[] (const PIString &name) const |
| Returns property with name "name" as const. | |
This class provides key-value properties storage.
Key-value storage, based on PIVector with PIPropertyStorage::Property elements. Each element in vector contains unique name. You can access property by name with propertyValueByName() or propertyByName(). You can add or replace property by addProperty(const Property&) or addProperty(const PIString&, const PIVariant&, const PIString&, int).
Example:
| bool PIPropertyStorage::addProperty | ( | const Property & | p | ) |
Add property if name isn't present in storage, otherwrise update existing property with same name.
Returns "true" if new property added, else if update existing property return "false"
| bool PIPropertyStorage::addProperty | ( | const PIString & | _name, |
| const PIVariant & | _def_value, | ||
| const PIString & | _comment = PIString(), |
||
| int | _flags = 0 |
||
| ) |
Add property if name isn't present in storage, otherwrise update existing property with same name.
Returns "true" if new property added, else if update existing property return "false"
| int PIPropertyStorage::removePropertiesByFlag | ( | int | flag | ) |
Remove all properties with flag "flag" set, returns removed properties count.
"flag" checked as bitfield