#include <ulxr_value.h>
Inheritance diagram for ulxr::Struct:
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< CppString > | getMemberNames () 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 ValueBase * | cloneValue () 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 Members & | getAllMembers () 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... |
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.
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.
ulxr::Struct::Struct | ( | ) |
ulxr::Struct::~Struct | ( | ) | [virtual] |
Adds a name/Value pair.
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.
Definition at line 1574 of file ulxr_value.cpp.
Returns the Value of a member.
name | the name of the member |
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.
name | the name of the member |
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.
Definition at line 1453 of file ulxr_value.cpp.
ValueBase * ulxr::Struct::cloneValue | ( | ) | const [virtual] |
Creates a copy of the actual object.
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.
deep | if nested types exist, include them |
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.
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.
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.
indent | current indentation level |
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.
name | the declaration name |
void ulxr::Struct::clear | ( | ) |
const Struct::Members & ulxr::Struct::getAllMembers | ( | ) | const [protected] |
Members ulxr::Struct::val [private] |
Definition at line 1027 of file ulxr_value.h.