rwsf::Memberrwsf::HandleBase
#include rwsf/xmlbinding/Member.h
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.
rwsf::Member implements the handle/body idiom. An instance of this class is a handle to one of two private, reference-counted bodies, either rwsf::PrimitiveMemberImp if the member is simple type, or rwsf::TypedMemberImp if the member is a complex type.
Member();
Constructs an empty member handle.
Member(MemberImp * imp);
Constructs a new handle attached to the body imp.
Member createPrimitive(const T & value);
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.
Member createTyped(const T & value);
Returns a new rwsf::Member instance templatized on a complex type. This instance provides generic get(),set(), and exists() methods to access its members.
int exists(rwsf::Member m, std::string xpath);
Determines whether xpath represents a valid path to the member represented by rwsf::Memberm.
Return values are:
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 the member does not exist, this method creates it using the factory methods (see rwsf::XmlBindingFactory).
std::vector< rwsf::Member > get(rwsf::Member m, std::string xpath);
A generic get the 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 represented by the rwsf::Memberm. 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 a rwsf::Exception.
std::vector< rwsf::Member > get(rwsf::Member m, std::string xpath, const rwsf::XmlNamespaceStack & nsStack);
A generic get the 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 represented by the rwsf::Memberm. The return vector contains rwsf::Member instances that wrap the values of the elements or attributes contained in the member.
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.
The namespace stack parameter nsStack allows member names qualified with a namespace to be resolved. Create the namespace stack as follows:
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 a rwsf::Exception.
void set(rwsf::Member m, std::string xpath, const std::vector< rwsf::Member > & values);
A generic set the 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 represented by the rwsf::Memberm 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, using the factory methods (see rwsf::XmlBindingFactory). If the path is not valid, throws a rwsf::Exception.
MemberImp & body() const;
Reimplements method in rwsf::HandleBase
Base class documentation:
Gets a reference for the body instance, if any; otherwise, throws an rwsf::Exception exception.
Implementation documentation:
Returns a reference to the body. If the body pointer is null, throws a rwsf::ExternalException exception.
int exists(const rwsf::XmlName & member);
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 0.
std::vector< Member > get(const rwsf::XmlName & member);
Returns the values of the member named in member as a vector of rwsf::Member instances. If the member represents a complex type, this method passes to the get() method of that type. If the member represents a simple type, the method returns an empty vector.
void set(const rwsf::XmlName & member, const std::vector< Member > & values);
Sets the values of the member named by member, using the data in the rwsf::Member instances contained in the vector values. If the member represents a complex type, the method passes to the set() method of that type. If the member represents a simple type, the method does nothing.
© Copyright Rogue Wave Software, Inc. All Rights Reserved. All Rights Reserved. Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. HydraExpress is a trademark of Rogue Wave Software, Inc. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.