HydraExpress™ C++ API Reference Guide

Product Documentation:
   HydraExpress C++
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions | Related Functions
rwsf::Member Class Reference

Container for holding class instances that represent members of XML Binding classes. More...

#include <rwsf/xmlbinding/Member.h>

Inheritance diagram for rwsf::Member:
rwsf::HandleBase

Public Member Functions

 Member ()
 
virtual int exists (const rwsf::XmlName &member)
 
virtual std::vector< Memberget (const rwsf::XmlName &member)
 
virtual void set (const rwsf::XmlName &member, const std::vector< Member > &values)
 
- Public Member Functions inherited from rwsf::HandleBase
bool isValid (void) const
 
bool operator!= (const HandleBase &second) const
 
bool operator== (const HandleBase &second) const
 

Static Public Member Functions

template<class T >
static Member createPrimitive (const T &value)
 
template<class T >
static Member createTyped (const T &value)
 
static int exists (rwsf::Member m, std::string xpath)
 
static std::vector< rwsf::Memberget (rwsf::Member m, std::string xpath)
 
static std::vector< rwsf::Memberget (rwsf::Member m, std::string xpath, const rwsf::XmlNamespaceStack &nsStack)
 
static void set (rwsf::Member m, std::string xpath, const std::vector< rwsf::Member > &values)
 

Related Functions

(Note that these are not member functions.)

template<class T >
void operator>> (const Member &m, T &value)
 

Additional Inherited Members

- Protected Member Functions inherited from rwsf::HandleBase
 HandleBase (void)
 
 HandleBase (StaticCtor)
 
 HandleBase (BodyBase *body)
 
 HandleBase (const HandleBase &second)
 
virtual ~HandleBase (void)
 
BodyBase & body (void) const
 
HandleBaseoperator= (const HandleBase &second)
 

Detailed Description

Class rwsf::Member is a container for holding class instances that represent members of XML Binding classes. rwsf::Member instances provide a generic way of returning values using the get() interface and of passing values using the set() interface of each XML Binding class.

Constructor & Destructor Documentation

rwsf::Member::Member ( )
inline

Constructs an empty member handle.

Member Function Documentation

template<class T >
static Member rwsf::Member::createPrimitive ( const T &  value)
inlinestatic

Returns a new rwsf::Member instance templatized on a primitive type. As a primitive type, this instance contains no instances of nested classes, and so has no generic get(), set(), and exists() methods.

template<class T >
static Member rwsf::Member::createTyped ( const T &  value)
inlinestatic

Returns a new rwsf::Member instance templatized on code-generated types representing XML Schema complex content an XML type. This instance provides generic get(), set(), and exists() methods to access its members.

virtual int rwsf::Member::exists ( const rwsf::XmlName member)
inlinevirtual

Determines whether the specified member exists within this. If the member contains an array of elements (maxOccurs>1), returns its length. If the member contains a single element, returns 1. If member does not exist, returns -1.

static int rwsf::Member::exists ( rwsf::Member  m,
std::string  xpath 
)
static

Determines whether xpath represents a valid path to the member contained by rwsf::Member m.

Return values are:

  • -1 if the path is not valiid
  • 1 if the path is valid and the member exists
  • If the path is valid but the member does not exist, attempts to create the member, returning 1 if successful and throws rwsf::Exception otherwise.
  • 1 if the path is valid and the leaf element does not represent a collection else returns the size of the collection.

The XPath expression must be relative, beginning either with a dot (.) or with an identifier. The leaf node may be either an element or an attribute. For attributes, you can use the "@" character for clarity, but it is not required.

These are the restrictions when creating a new member for a valid path that lacks a member:

  • If no member exists, creates path/element[0]/item.
  • If there are existing members but the path references a non-existing member, the method creates a member if the reference is to an index no more than 1 beyond the last existing one. For example, if path/element[1]/item is the last existing member, the method will create a member for the reference path/element[2]/item, but NOT for path/element[3]/ item. When the path is invalid under these circumstances, the method returns -1.
virtual std::vector<Member> rwsf::Member::get ( const rwsf::XmlName member)
inlinevirtual

Returns the values associated with the child member named member as a vector.

Note
If this instance represents a simple type this method returns an empty vector.
static std::vector<rwsf::Member> rwsf::Member::get ( rwsf::Member  m,
std::string  xpath 
)
static

A generic get that supports access to nested members by name without having to specify the type of the member. This method uses the XPath expression xpath to return the values for nested members contained in rwsf::Member m. The return vector contains rwsf::Member instances that wrap the values of the elements or attributes contained in the member.

The XPath expression must be relative, beginning either with a dot (.) or with an identifier. The leaf node may be either an element or an attribute. For attributes, you can use the "@" character for clarity, but it is not required.

If the path is valid but the member does not exist, the method returns an empty vector. If the path is not valid, the method throws an rwsf::Exception.

static std::vector<rwsf::Member> rwsf::Member::get ( rwsf::Member  m,
std::string  xpath,
const rwsf::XmlNamespaceStack &  nsStack 
)
static

A generic get that supports access to nested members by name without having to specify the type of the member. This method uses the XPath expression xpath to return the values for nested members contained in rwsf::Member m. The return vector contains rwsf::Member instances that wrap the values of the elements or attributes contained in the member.

The XPath expression must be relative, beginning either with a dot (.) or with an identifier. The leaf node may be either an element or an attribute. For attributes, you can use the "@" character for clarity, but it is not required.

If the path is valid but the member does not exist, the method returns an empty vector. If the path is not valid, the method throws an rwsf::Exception.

The namespace stack parameter nsStack allows member names qualified with a namespace to be resolved.

virtual void rwsf::Member::set ( const rwsf::XmlName member,
const std::vector< Member > &  values 
)
inlinevirtual

Sets the values of the child member named member, using the data in the rwsf::Member instances contained in the vector values.

Note
If this instance represents a simple type, this method does nothing.
static void rwsf::Member::set ( rwsf::Member  m,
std::string  xpath,
const std::vector< rwsf::Member > &  values 
)
static

A generic set that supports setting the values of nested members by name without having to specify the type of the member. This method uses the XPath expression xpath to set the values for a nested member contained in rwsf::Member m based on the values contained in values.

The XPath expression must relative, beginning either with a dot (.) or with an identifier. The leaf node may be either an element or an attribute. For attributes, you can use the "@" character for clarity, but it is not required.

If the path is valid but m does not exist, this method creates it.

If the path is not valid, this method throws an rwsf::Exception.

Friends And Related Function Documentation

template<class T >
void operator>> ( const Member m,
T &  value 
)
related

Stores the value of m in value.

Copyright © 2019 Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is registered trademark of Rogue Wave Software, Inc. in the United States and other countries, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.