Quick Links: |
#include <balxml_namespaceregistry.h>
Public Types | |
enum | { e_NO_NAMESPACE = -1, e_PREDEF_MIN = 0x40000000, e_XML = e_PREDEF_MIN, e_XMLNS, e_XMLSCHEMA, e_XMLSCHEMA_INSTANCE, e_WSDL, e_WSDL_SOAP, e_BDEM, BAEXML_PREDEF_MAX, BAEXML_NO_NAMESPACE = e_NO_NAMESPACE, BAEXML_PREDEF_MIN = e_PREDEF_MIN, BAEXML_XML = e_XML, BAEXML_XMLNS = e_XMLNS, BAEXML_XMLSCHEMA = e_XMLSCHEMA, BAEXML_XMLSCHEMA_INSTANCE = e_XMLSCHEMA_INSTANCE, BAEXML_WSDL = e_WSDL, BAEXML_WSDL_SOAP = e_WSDL_SOAP, BAEXML_BDEM = e_BDEM, NSID_NO_NAMESPACE = e_NO_NAMESPACE, NSID_PREDEF_MIN = e_PREDEF_MIN, NSID_XML = e_XML, NSID_XMLNS = e_XMLNS, NSID_XMLSCHEMA = e_XMLSCHEMA, NSID_XMLSCHEMA_INSTANCE = e_XMLSCHEMA_INSTANCE, NSID_WSDL = e_WSDL, NSID_WSDL_SOAP = e_WSDL_SOAP, NSID_BDEM = e_BDEM, NSID_PREDEF_MAX = BAEXML_PREDEF_MAX } |
Preregistered namespace IDs. More... | |
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION (NamespaceRegistry, bslma::UsesBslmaAllocator) | |
NamespaceRegistry (bslma::Allocator *basicAllocator=0) | |
NamespaceRegistry (const NamespaceRegistry &other, bslma::Allocator *basicAllocator=0) | |
~NamespaceRegistry () | |
NamespaceRegistry & | operator= (const NamespaceRegistry &rhs) |
int | lookupOrRegister (const bsl::string_view &namespaceUri) |
void | reset () |
int | lookup (const bsl::string_view &namespaceUri) const |
const char * | lookup (int id) const |
void | print (bsl::ostream &stream) const |
Friends | |
bool | operator== (const NamespaceRegistry &lhs, const NamespaceRegistry &rhs) |
Mapping that associates a unique integer with each registered namespace URI.
See Component balxml_namespaceregistry
anonymous enum |
balxml::NamespaceRegistry::NamespaceRegistry | ( | bslma::Allocator * | basicAllocator = 0 |
) |
Construct an empty registry. Optionally specify a basicAllocator
used to supply memory. If basicAllocator
is 0, the current default allocator is used.
balxml::NamespaceRegistry::NamespaceRegistry | ( | const NamespaceRegistry & | other, | |
bslma::Allocator * | basicAllocator = 0 | |||
) |
Construct a copy of the specified other
namespace registry using the (optionally) specified basicAllocator
. For a given URI, the results of calling lookup
by URI will produce equal results for this object and for other
. For a given integer ID, the result of calling lookup
by ID will produce different pointers that compare equal using strcmp
.
balxml::NamespaceRegistry::~NamespaceRegistry | ( | ) |
Destroy this object. Release all memory to the allocator used at construction.
balxml::NamespaceRegistry::BSLMF_NESTED_TRAIT_DECLARATION | ( | NamespaceRegistry | , | |
bslma::UsesBslmaAllocator | ||||
) |
NamespaceRegistry& balxml::NamespaceRegistry::operator= | ( | const NamespaceRegistry & | rhs | ) |
Discard the contents of this registry and assign it the contents of the specified rhs
registry. For a given URI, the results of calling lookup
by URI will produce equal results for this object and for rhs
. For a given integer ID, the result of calling lookup
by ID will produce different pointers that compare equal using strcmp
.
int balxml::NamespaceRegistry::lookupOrRegister | ( | const bsl::string_view & | namespaceUri | ) |
Return the integer ID for the specified namespaceUri
, assigning a new ID if the namespaceUri
has not been registered before. Note that the IDs for pre-registered namespaces (including the empty URI) are less than zero. (See "Preregistered Namespaces" in the 'balxml_namespaceregistry component-level documentation.)
void balxml::NamespaceRegistry::reset | ( | ) |
Removes all registered namespaces. Preregistered namespaces are not removed.
int balxml::NamespaceRegistry::lookup | ( | const bsl::string_view & | namespaceUri | ) | const |
Return the integer ID for the specified namespaceUri
or -1 if the namespace has not been registered. Note that not all negative return values correspond to unregistered namespaces. Preregistered namespaces always have negative IDs. (See "Preregistered
Namespaces" in the balxml_namespaceregistry
component-level documentation.) Note that a return value of -1 can mean either an unregistered namespace or an empty URI string. This dual-use of -1 is deliberate and simplifies error handling in most clients.
const char* balxml::NamespaceRegistry::lookup | ( | int | id | ) | const |
Return the null-terminated string containing the URI of the namespace registered with the specified id
or an empty (not null) string if id
does not correspond to a preregistered namespace or a namespace that was previously registered with this object.
void balxml::NamespaceRegistry::print | ( | bsl::ostream & | stream | ) | const |
Print the contents of this object to the specified stream
in human-readable form.
bool operator== | ( | const NamespaceRegistry & | lhs, | |
const NamespaceRegistry & | rhs | |||
) | [friend] |
Must be a friend for engineering reasons. Unlike most value-semantic types, there is no efficient way to read the entire value of a namespace registry object.