#include <Structure.h>
Collaboration diagram for Arxx::Structure:
This Structure class provides a general but standarized way to structure the items in an archive.
Public Types | |
typedef std::map< std::string, Arxx::Structure::Relation >::size_type | size_type |
Public Member Functions | |
Structure (Arxx::Item &Item) | |
This constructor binds the structure to a specific Arxx::Item. | |
bool | bAdd (Arxx::u4byte u4UniqueID, const std::string &sRelation="child") |
Adds an unresolved item reference to a relation. | |
bool | bDelete (Arxx::u4byte u4UniqueID, const std::string &sRelation="child") |
Deletes an unresolved item reference from a relation. | |
const Arxx::Structure::Relation & | GetRelation (const std::string &sRelation) const |
The const accessor for constant relations. | |
Arxx::Structure::Relation & | GetRelation (const std::string &sRelation) |
The accessor for relations. | |
bool | bHasRelation (const std::string &sRelation) const |
Query whether a paricular relation exists. | |
size_type | size (void) const |
Returns the number of Relations in the Structure. | |
Arxx::Structure::iterator | begin (void) |
Returns the first Relation iterator of the Structure. | |
Arxx::Structure::iterator | end (void) |
Returns the end Relation iterator of the Structure. | |
Arxx::Structure::const_iterator | begin (void) const |
Returns the first const Relation iterator of the Structure. | |
Arxx::Structure::const_iterator | end (void) const |
Returns the end const Relation iterator of the Structure. | |
Private Member Functions | |
void | vWriteToBuffer (Arxx::Buffer &Buffer) const |
Writes the Structure information to a Buffer. | |
void | vReadFromStream (Arxx::u4byte u4StructureDataLength, std::istream &IStream) |
void | vRemoveRelation (Arxx::Structure::Relation *pRelation) |
Private Attributes | |
Arxx::Item & | m_Item |
std::map< std::string, Arxx::Structure::Relation > | m_Relations |
Friends | |
class | Arxx::Archive |
class | Arxx::Structure::Relation |
Arxx::Buffer & | operator<< (Arxx::Buffer &Buffer, const Arxx::Structure &Structure) |
Convenience function that streams the structural information into a Arxx::Buffer. | |
Classes | |
class | const_iterator |
An iterator class defining basic operations to iterate the Relation objects in a Structure. More... | |
class | iterator |
An iterator class defining basic operations to iterate the Relation objects in a Structure. More... | |
class | Relation |
The object that holds references to other items. More... |
typedef std::map< std::string, Arxx::Structure::Relation >::size_type Arxx::Structure::size_type |
Arxx::Structure::Structure | ( | Arxx::Item & | Item | ) |
This constructor binds the structure to a specific Arxx::Item.
Item | The Arxx::Item that this structure is linked to. |
bool Arxx::Structure::bAdd | ( | Arxx::u4byte | u4UniqueID, | |
const std::string & | sRelation = "child" | |||
) |
Adds an unresolved item reference to a relation.
sRelation | The relation that is changed with this call. | |
u4UniqueID | A unique ID that is to be added to the relation. |
There are two things to consider:
Violating one of these conditions will abort the call and return without having done anything.
This function will create the relation if it does not exist yet and the unresolved reference with the unique ID u4UniqueID will be the only member of this new relation.
bool Arxx::Structure::bDelete | ( | Arxx::u4byte | u4UniqueID, | |
const std::string & | sRelation = "child" | |||
) |
Deletes an unresolved item reference from a relation.
sRelation | The relation that is changed with this call. | |
u4UniqueID | The unique item id that is tried to be deleted from the relation. |
If the unresolved item reference is not found in the relation the function may issue a second search.
There are two things to consider:
Any atempt to do so as well as deleting from a non-existent relation will be silently ignored.
If the deleted item reference was the last one in the relation so that the relation sRelation is now empty it is deleted from the relations container.
Arxx::Structure::const_iterator Arxx::Structure::begin | ( | void | ) | const |
Arxx::Structure::iterator Arxx::Structure::begin | ( | void | ) |
bool Arxx::Structure::bHasRelation | ( | const std::string & | sRelation | ) | const |
Query whether a paricular relation exists.
sRelation | The name of the relation. |
Arxx::Structure::const_iterator Arxx::Structure::end | ( | void | ) | const |
Arxx::Structure::iterator Arxx::Structure::end | ( | void | ) |
Arxx::Structure::Relation & Arxx::Structure::GetRelation | ( | const std::string & | sRelation | ) |
The accessor for relations.
sRelation | The relation's name. |
std::out_of_range | If a relation with the name sRelation does not exist in the structure. |
const Arxx::Structure::Relation & Arxx::Structure::GetRelation | ( | const std::string & | sRelation | ) | const |
The const accessor for constant relations.
sRelation | The relation's name. |
std::out_of_range | If a relation with the name sRelation does not exist in the structure. |
Arxx::Structure::size_type Arxx::Structure::size | ( | void | ) | const |
Returns the number of Relations in the Structure.
void Arxx::Structure::vReadFromStream | ( | Arxx::u4byte | u4StructureDataLength, | |
std::istream & | IStream | |||
) | [private] |
void Arxx::Structure::vRemoveRelation | ( | Arxx::Structure::Relation * | pRelation | ) | [private] |
void Arxx::Structure::vWriteToBuffer | ( | Arxx::Buffer & | Buffer | ) | const [private] |
friend class Arxx::Archive [friend] |
friend class Arxx::Structure::Relation [friend] |
Arxx::Buffer& operator<< | ( | Arxx::Buffer & | Buffer, | |
const Arxx::Structure & | Structure | |||
) | [friend] |
Convenience function that streams the structural information into a Arxx::Buffer.
Arxx::Item& Arxx::Structure::m_Item [private] |
std::map< std::string, Arxx::Structure::Relation > Arxx::Structure::m_Relations [private] |