BDE 4.14.0 Production release
Loading...
Searching...
No Matches
balxml::NamespaceRegistry Class Reference

#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
}
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (NamespaceRegistry, bslma::UsesBslmaAllocator)
 
 NamespaceRegistry (bslma::Allocator *basicAllocator=0)
 
 NamespaceRegistry (const NamespaceRegistry &other, bslma::Allocator *basicAllocator=0)
 
 ~NamespaceRegistry ()
 
NamespaceRegistryoperator= (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)
 

Detailed Description

Mapping that associates a unique integer with each registered namespace URI.

See balxml_namespaceregistry

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
e_NO_NAMESPACE 
e_PREDEF_MIN 
e_XML 
e_XMLNS 
e_XMLSCHEMA 
e_XMLSCHEMA_INSTANCE 
e_WSDL 
e_WSDL_SOAP 
e_BDEM 
BAEXML_PREDEF_MAX 
BAEXML_NO_NAMESPACE 
BAEXML_PREDEF_MIN 
BAEXML_XML 
BAEXML_XMLNS 
BAEXML_XMLSCHEMA 
BAEXML_XMLSCHEMA_INSTANCE 
BAEXML_WSDL 
BAEXML_WSDL_SOAP 
BAEXML_BDEM 
NSID_NO_NAMESPACE 
NSID_PREDEF_MIN 
NSID_XML 
NSID_XMLNS 
NSID_XMLSCHEMA 
NSID_XMLSCHEMA_INSTANCE 
NSID_WSDL 
NSID_WSDL_SOAP 
NSID_BDEM 
NSID_PREDEF_MAX 

Constructor & Destructor Documentation

◆ NamespaceRegistry() [1/2]

balxml::NamespaceRegistry::NamespaceRegistry ( bslma::Allocator basicAllocator = 0)
inline

Construct an empty registry. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the current default allocator is used.

◆ NamespaceRegistry() [2/2]

balxml::NamespaceRegistry::NamespaceRegistry ( const NamespaceRegistry other,
bslma::Allocator basicAllocator = 0 
)
inline

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.

◆ ~NamespaceRegistry()

balxml::NamespaceRegistry::~NamespaceRegistry ( )
inline

Destroy this object. Release all memory to the allocator used at construction.

Member Function Documentation

◆ BSLMF_NESTED_TRAIT_DECLARATION()

balxml::NamespaceRegistry::BSLMF_NESTED_TRAIT_DECLARATION ( NamespaceRegistry  ,
bslma::UsesBslmaAllocator   
)

◆ lookup() [1/2]

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.

◆ lookup() [2/2]

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.

◆ lookupOrRegister()

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.)

◆ operator=()

NamespaceRegistry & balxml::NamespaceRegistry::operator= ( const NamespaceRegistry rhs)
inline

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.

◆ print()

void balxml::NamespaceRegistry::print ( bsl::ostream &  stream) const

Print the contents of this object to the specified stream in human-readable form.

◆ reset()

void balxml::NamespaceRegistry::reset ( )
inline

Removes all registered namespaces. Preregistered namespaces are not removed.

Friends And Related Symbol Documentation

◆ operator==

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.

Return true if the specified lhs registry has the same value as the specified rhs registry and false otherwise. The two registries have the same value if, for any possible URI string, u, lhs.lookup(u) == rhs.lookup(u).


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