ulxr::Struct Class Reference
[Value types in an XML-RPC call]

Implementation of a "named" collection. More...

#include <ulxr_value.h>

Inheritance diagram for ulxr::Struct:

Inheritance graph
[legend]
Collaboration diagram for ulxr::Struct:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Struct ()
 Default constructor for an empty Struct.
virtual ~Struct ()
 Destroys the Value.
void addMember (const CppString &name, const Value &item)
 Adds a name/Value pair.
std::vector< CppStringgetMemberNames () const
 Gets a list of all member names.
Value getMember (const CppString &name) const
 Returns the Value of a member.
bool hasMember (const CppString &name) const
 Tests if a member exists.
unsigned size () const
 Returns the number of array members.
virtual ValueBasecloneValue () const
 Creates a copy of the actual object.
virtual CppString getSignature (bool deep=false) const
 Returns the signature of value.
virtual std::string getWbXml () const
 Returns the call as binary xml string.
virtual CppString getXml (int indent=0) const
 Returns the value as xml string.
CppString dump_C_decl (const char *name) const
 Returns the value as C++ structure declaration.
void clear ()
 Removes all elements of the Struct.

Static Public Member Functions

static CppString getValueName ()
 Returns the xml name of the Value.

Protected Types

typedef std::map< CppString,
Value
Members

Protected Member Functions

const MembersgetAllMembers () const
 Returns all elements of the Struct.

Private Types

typedef std::pair< CppString,
Value
Member_pair

Private Attributes

Members val

Classes

class  Member
 Implementation of a key-value pair. More...

Detailed Description

Implementation of a "named" collection.

A Struct can contain an arbitrary amount of values of any type here mentioned, even nested Structs. Unlike arrays you access their values by their member names and not by their index.

Definition at line 927 of file ulxr_value.h.


Member Typedef Documentation

typedef std::map<CppString, Value> ulxr::Struct::Members [protected]

Definition at line 1017 of file ulxr_value.h.

typedef std::pair<CppString, Value> ulxr::Struct::Member_pair [private]

Definition at line 1025 of file ulxr_value.h.


Constructor & Destructor Documentation

ulxr::Struct::Struct (  ) 

Default constructor for an empty Struct.

Definition at line 1429 of file ulxr_value.cpp.

ulxr::Struct::~Struct (  )  [virtual]

Destroys the Value.

Definition at line 1435 of file ulxr_value.cpp.


Member Function Documentation

void ulxr::Struct::addMember ( const CppString name,
const Value item 
)

Adds a name/Value pair.

Parameters:
name the name of the member
item its content

Definition at line 1547 of file ulxr_value.cpp.

References ulxr::RpcStruct, ULXR_ASSERT_RPCTYPE, and ULXR_TRACE.

Referenced by ulxr::operator<<(), ulxr::MethodResponse::setFault(), and ulxr::Dispatcher::system_getCapabilities().

std::vector< CppString > ulxr::Struct::getMemberNames (  )  const

Gets a list of all member names.

Returns:
vector with all member names

Definition at line 1574 of file ulxr_value.cpp.

Value ulxr::Struct::getMember ( const CppString name  )  const

Returns the Value of a member.

Parameters:
name the name of the member
Returns:
the members Value

Definition at line 1562 of file ulxr_value.cpp.

References ulxr::ApplicationError, ulxr::RpcStruct, ULXR_ASSERT_RPCTYPE, ulxr_i18n, and ULXR_PCHAR.

bool ulxr::Struct::hasMember ( const CppString name  )  const

Tests if a member exists.

Parameters:
name the name of the member
Returns:
true, if the member exists

Definition at line 1555 of file ulxr_value.cpp.

References ulxr::RpcStruct, and ULXR_ASSERT_RPCTYPE.

unsigned ulxr::Struct::size (  )  const

Returns the number of array members.

Returns:
the array size

Definition at line 1453 of file ulxr_value.cpp.

ValueBase * ulxr::Struct::cloneValue (  )  const [virtual]

Creates a copy of the actual object.

Returns:
pointer to the copy

Implements ulxr::ValueBase.

Definition at line 1440 of file ulxr_value.cpp.

References ulxr::RpcStruct, and ULXR_ASSERT_RPCTYPE.

CppString ulxr::Struct::getSignature ( bool  deep = false  )  const [virtual]

Returns the signature of value.

The signature may consist of the concatenated name/element pairs of all elements sourrounded by braces. The element pairs are grouped by braces as well.

Parameters:
deep if nested types exist, include them
Returns:
The signature

Implements ulxr::ValueBase.

Definition at line 1465 of file ulxr_value.cpp.

References ulxr::RpcStruct, ULXR_ASSERT_RPCTYPE, ULXR_CHAR, and ULXR_PCHAR.

CppString ulxr::Struct::getValueName (  )  [static]

Returns the xml name of the Value.

Returns:
value name

Definition at line 1494 of file ulxr_value.cpp.

References ULXR_PCHAR.

std::string ulxr::Struct::getWbXml (  )  const [virtual]

Returns the call as binary xml string.

The method call is converted to a wbxml sequence. It is prepended with the necessary xml procession instruction with version and encoding set to UTF-8.

Returns:
The wbxml content

Implements ulxr::ValueBase.

Definition at line 1524 of file ulxr_value.cpp.

References ulxr::getWbXmlString(), ulxr::RpcStruct, ULXR_ASSERT_RPCTYPE, ulxr::ValueParserWb::wbToken_Member, ulxr::ValueParserWb::wbToken_Name, ulxr::ValueParserWb::wbToken_Struct, ulxr::ValueParserWb::wbToken_Value, and ulxr::WbXmlParser::wbxml_END.

CppString ulxr::Struct::getXml ( int  indent = 0  )  const [virtual]

Returns the value as xml string.

The content and its type name is converted to an xml text. The structure of the text is indented to facilitate easy reading of larger blocks.

Parameters:
indent current indentation level
Returns:
The xml content

Implements ulxr::ValueBase.

Definition at line 1500 of file ulxr_value.cpp.

References ulxr::getXmlIndent(), ulxr::getXmlLinefeed(), ulxr::RpcStruct, ULXR_ASSERT_RPCTYPE, and ULXR_PCHAR.

CppString ulxr::Struct::dump_C_decl ( const char *  name  )  const

Returns the value as C++ structure declaration.

Parameters:
name the declaration name
Returns:
The C++ source

void ulxr::Struct::clear (  ) 

Removes all elements of the Struct.

Definition at line 1447 of file ulxr_value.cpp.

const Struct::Members & ulxr::Struct::getAllMembers (  )  const [protected]

Returns all elements of the Struct.

Definition at line 1459 of file ulxr_value.cpp.


Member Data Documentation

Members ulxr::Struct::val [private]

Definition at line 1027 of file ulxr_value.h.


The documentation for this class was generated from the following files:
Generated on Sun Aug 19 20:09:11 2007 for ulxmlrpcpp by  doxygen 1.5.1