Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions

balxml::ElementAttribute Class Reference

#include <balxml_elementattribute.h>

List of all members.

Public Types

enum  {
  k_ATTR_NO_FLAGS = 0x0000, k_ATTR_IS_DEFAULT = 0x0001, k_ATTR_IS_NSDECL = 0x0002, k_ATTR_IS_XSIDECL = 0x0004,
  BAEXML_ATTR_NO_FLAGS = k_ATTR_NO_FLAGS, BAEXML_ATTR_IS_DEFAULT = k_ATTR_IS_DEFAULT, BAEXML_ATTR_IS_NSDECL = k_ATTR_IS_NSDECL, BAEXML_ATTR_IS_XSIDECL = k_ATTR_IS_XSIDECL,
  ATTR_NO_FLAGS = k_ATTR_NO_FLAGS, ATTR_IS_DEFAULT = k_ATTR_IS_DEFAULT, ATTR_IS_NSDECL = k_ATTR_IS_NSDECL
}

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (ElementAttribute, bsl::is_trivially_copyable)
 ElementAttribute ()
 ElementAttribute (const PrefixStack *prefixStack, const char *qualifiedName, const char *value, const char *prefix=0, const char *localName=0, int namespaceId=INT_MIN, const char *namespaceUri=0, unsigned flags=0)
void reset ()
void reset (const PrefixStack *prefixStack, const char *qualifiedName, const char *value, const char *prefix=0, const char *localName=0, int namespaceId=INT_MIN, const char *namespaceUri=0, unsigned flags=0)
const PrefixStackprefixStack () const
const char * qualifiedName () const
const char * value () const
const char * prefix () const
const char * localName () const
int namespaceId () const
const char * namespaceUri () const
unsigned flags () const
bool isNull () const
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const

Detailed Description

Class to represent the properties of an attribute in an XML element tag. Note that this class is not value semantic and does not own any of its pointer values. The owner of the arguments used to set the value of a ElementAttribute is responsible for ensuring that the values remain valid or else must document the conditions that will make the values invalid. Some facets are computed the first time that they are needed. To avoid extra processing, the caller may supply otherwise-computed facets at construction or by calling reset. Facets provided by the caller are not checked to ensure that they are consistent with one another.

See Component balxml_elementattribute


Member Enumeration Documentation

anonymous enum
Enumerator:
k_ATTR_NO_FLAGS 

No flags set.

k_ATTR_IS_DEFAULT 

Set this bit if the value for this attribute object was generated from the default attribute value in the DTD or schema.

k_ATTR_IS_NSDECL 

Set this bit if this attribute represents a namespace declaration.

k_ATTR_IS_XSIDECL 

Set this bit if this attribute represents a XML schema instance declaration.

BAEXML_ATTR_NO_FLAGS 
BAEXML_ATTR_IS_DEFAULT 
BAEXML_ATTR_IS_NSDECL 
BAEXML_ATTR_IS_XSIDECL 
ATTR_NO_FLAGS 
ATTR_IS_DEFAULT 
ATTR_IS_NSDECL 

Constructor & Destructor Documentation

balxml::ElementAttribute::ElementAttribute (  ) 

Construct a null attribute object: Set all string facets to zero, the namespace ID to INT_MIN, and flags to zero.

balxml::ElementAttribute::ElementAttribute ( const PrefixStack prefixStack,
const char *  qualifiedName,
const char *  value,
const char *  prefix = 0,
const char *  localName = 0,
int  namespaceId = INT_MIN,
const char *  namespaceUri = 0,
unsigned  flags = 0 
)

Construct an attribute object with the specified, prefixStack, qualifiedName, and value, with optionally specified prefix, localName, namespaceId, namespaceUri, and flags. Except for flags, if any of the optional arguments are null (for pointers) or INT_MIN (for integer arguments), then the corresponding facet will computed from the other arguments on an as-needed basis. If all of the optional arguments are given non-null, non-'INT_MIN' values, then prefixStack is unused and may be null. Arguments are permitted to be inconsistent with one another (e.g., prefix may not match the beginning of qualifiedName) and will produce an object for with facets that are inconsistent with one another. The constructed object will become invalid if any of the supplied pointers is invalidated during its lifetime (or before it is reset). An invalid object may be destroyed or reset, but any other access yields undefined behavior.


Member Function Documentation

balxml::ElementAttribute::BSLMF_NESTED_TRAIT_DECLARATION ( ElementAttribute  ,
bsl::is_trivially_copyable   
)
void balxml::ElementAttribute::reset (  ) 

Reset this object to the default-constructed state.

void balxml::ElementAttribute::reset ( const PrefixStack prefixStack,
const char *  qualifiedName,
const char *  value,
const char *  prefix = 0,
const char *  localName = 0,
int  namespaceId = INT_MIN,
const char *  namespaceUri = 0,
unsigned  flags = 0 
)

Reset this attribute object with the specified, prefixStack, qualifiedName, and value, with optionally specified prefix, localName, namespaceId, namespaceUri, and flags. Except for flags, if any of the optional arguments are null (for pointers) or INT_MIN (for integer arguments), then the corresponding facet will computed from the other arguments on an as-needed basis. If all of the optional arguments are given non-null, non-'INT_MIN' values, then prefixStack is unused and may be null. Arguments are permitted to be inconsistent with one another (e.g., prefix may not match the beginning of qualifiedName) and will produce an object for with facets that are inconsistent with one another. This object will become invalid if any of the supplied pointers is invalidated during its lifetime (or before it is reset). An invalid object may be destroyed or reset, but any other access yields undefined behavior.

const PrefixStack* balxml::ElementAttribute::prefixStack (  )  const

Return the value of prefixStack specified at the last call to reset or the constructor or 0 if no prefix stack was specified.

const char* balxml::ElementAttribute::qualifiedName (  )  const

Return the value of qualifiedName specified at the last call to reset or the constructor or 0 if no qualified name was specified.

const char* balxml::ElementAttribute::value (  )  const

Return the value of value specified at the last call to reset or the constructor or 0 if no value was specified.

const char* balxml::ElementAttribute::prefix (  )  const

Return the value of prefix specified at the last call to reset or the constructor, if non-zero, else return a copy of the prefix portion of the qualified name. More precisely, return a copy of the portion of qualifiedName() up to, but not including, the colon. Return an empty string if the qualified name has no colon or if prefixStack() returns zero.

const char* balxml::ElementAttribute::localName (  )  const

Return the value of localName specified at the last call to reset or the constructor, if non-zero, else return the local part of the qualified name. More precisely, return the portion of qualifiedName() after the colon, if any, or the entire qualifiedName() if there is no colon.

int balxml::ElementAttribute::namespaceId (  )  const

Return the value of localName specified at the last call to reset or the constructor, if not INT_MIN, else return the ID returned by the prefix stack for the current value of prefix(). Return -1 if prefix() is an empty string, prefixStack() is zero, or prefix() is not active in the prefix stack. Note that, as per the XML namespace standard, an empty prefix does NOT refer to the default namespace, but rather refers to NO namespace.

const char* balxml::ElementAttribute::namespaceUri (  )  const

Return the value of namespaceUri specified at the last call to reset or the constructor, if non-zero, else return the URI returned by the prefix stack for the current value of prefix(). Return an empty string if prefix() is an empty string, prefixStack() is zero, or prefix() is not active in the prefix stack. Note that, as per the XML namespace standard, an empty prefix does NOT refer to the default namespace, but rather refers to NO namespace.

unsigned balxml::ElementAttribute::flags (  )  const

Return the value of flags specified at the last call to reset or the constructor, if non-zero, or zero otherwise. Pre-defined flags are enumerated in the class definition.

bool balxml::ElementAttribute::isNull (  )  const

Return true if this object is null. More precisely, return true if qualifiedName() returns 0. A default-constructed object will be null, as will an object that was reset with no arguments.

bsl::ostream& balxml::ElementAttribute::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line. If stream is not valid on entry, this operation has no effect. Facet values that have not yet been computed are represented by "<null>" in the resulting stream.


The documentation for this class was generated from the following file: