libCombine
C++ library for working with the COMBINE Archive format
Loading...
Searching...
No Matches
CaNamespaces Class Reference

Public Member Functions

 CaNamespaces (unsigned int level=OMEX_DEFAULT_LEVEL, unsigned int version=OMEX_DEFAULT_VERSION)
 Creates a new CaNamespaces object corresponding to the given OMEX level and version. More...
 
virtual ~CaNamespaces ()
 Destroys this CaNamespaces object. More...
 
 CaNamespaces (const CaNamespaces &orig)
 Copy constructor; creates a copy of a CaNamespaces. More...
 
CaNamespacesoperator= (const CaNamespaces &rhs)
 Assignment operator for CaNamespaces. More...
 
virtual CaNamespacesclone () const
 Creates and returns a deep copy of this CaNamespaces object. More...
 
virtual std::string getURI () const
 Returns a string representing the OMEX XML namespace of this object. More...
 
unsigned int getLevel ()
 Get the OMEX Level of this CaNamespaces object. More...
 
unsigned int getLevel () const
 Get the OMEX Level of this CaNamespaces object. More...
 
unsigned int getVersion ()
 Get the OMEX Version of this CaNamespaces object. More...
 
unsigned int getVersion () const
 Get the OMEX Version of this CaNamespaces object. More...
 
XMLNamespaces * getNamespaces ()
 Get the XML namespaces list for this CaNamespaces object. More...
 
const XMLNamespaces * getNamespaces () const
 Get the XML namespaces list for this CaNamespaces object. More...
 
int addNamespaces (const XMLNamespaces *xmlns)
 Add the given XML namespaces list to the set of namespaces within this CaNamespaces object. More...
 
int addNamespace (const std::string &uri, const std::string &prefix)
 Add an XML namespace (a pair of URI and prefix) to the set of namespaces within this CaNamespaces object. More...
 
int removeNamespace (const std::string &uri)
 Removes an XML namespace from the set of namespaces within this CaNamespaces object. More...
 
bool isValidCombination ()
 Predicate returning true if the given set of namespaces represent a valid set. More...
 

Static Public Member Functions

static std::string getCaNamespaceURI (unsigned int level, unsigned int version)
 Returns a string representing the OMEX XML namespace for the given level and version of OMEX. More...
 
static const List * getSupportedNamespaces ()
 Returns a list of all supported CaNamespaces in this version of libcombine. More...
 
static void freeCaNamespaces (List *supportedNS)
 Frees the list of supported namespaces as generated by getSupportedNamespaces(). More...
 
static bool isCaNamespace (const std::string &uri)
 Predicate returning true if the given URL is one of OMEX XML namespaces. More...
 

Constructor & Destructor Documentation

◆ CaNamespaces() [1/2]

CaNamespaces::CaNamespaces ( unsigned int  level = OMEX_DEFAULT_LEVEL,
unsigned int  version = OMEX_DEFAULT_VERSION 
)

Creates a new CaNamespaces object corresponding to the given OMEX level and version.

Parameters
levelthe OMEX level
versionthe OMEX version

◆ ~CaNamespaces()

virtual CaNamespaces::~CaNamespaces ( )
virtual

Destroys this CaNamespaces object.

◆ CaNamespaces() [2/2]

CaNamespaces::CaNamespaces ( const CaNamespaces orig)

Copy constructor; creates a copy of a CaNamespaces.

Parameters
origthe CaNamespaces instance to copy.

Member Function Documentation

◆ addNamespace()

int CaNamespaces::addNamespace ( const std::string &  uri,
const std::string &  prefix 
)

Add an XML namespace (a pair of URI and prefix) to the set of namespaces within this CaNamespaces object.

Parameters
urithe XML namespace to be added.
prefixthe prefix of the namespace to be added.
  • @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t}
  • @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t}
  • @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t}

◆ addNamespaces()

int CaNamespaces::addNamespaces ( const XMLNamespaces *  xmlns)

Add the given XML namespaces list to the set of namespaces within this CaNamespaces object.

Parameters
xmlnsthe XML namespaces to be added.
  • @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t}
  • @omexconstant{LIBCOMBINE_OPERATION_FAILED, OperationReturnValues_t}
  • @omexconstant{LIBCOMBINE_INVALID_OBJECT, OperationReturnValues_t}

◆ clone()

virtual CaNamespaces * CaNamespaces::clone ( ) const
virtual

Creates and returns a deep copy of this CaNamespaces object.

Returns
the (deep) copy of this CaNamespaces object.

◆ freeCaNamespaces()

static void CaNamespaces::freeCaNamespaces ( List *  supportedNS)
static

Frees the list of supported namespaces as generated by getSupportedNamespaces().

Parameters
supportedNSthe list to be freed.

◆ getCaNamespaceURI()

static std::string CaNamespaces::getCaNamespaceURI ( unsigned int  level,
unsigned int  version 
)
static

Returns a string representing the OMEX XML namespace for the given level and version of OMEX.

Parameters
levelthe OMEX level
versionthe OMEX version
Returns
a string representing the OMEX namespace that reflects the OMEX Level and Version specified.

◆ getLevel() [1/2]

unsigned int CaNamespaces::getLevel ( )

Get the OMEX Level of this CaNamespaces object.

Returns
the OMEX Level of this CaNamespaces object.

◆ getLevel() [2/2]

unsigned int CaNamespaces::getLevel ( ) const

Get the OMEX Level of this CaNamespaces object.

Returns
the OMEX Level of this CaNamespaces object.

◆ getNamespaces() [1/2]

XMLNamespaces * CaNamespaces::getNamespaces ( )

Get the XML namespaces list for this CaNamespaces object.

Returns
the XML namespaces of this CaNamespaces object.

◆ getNamespaces() [2/2]

const XMLNamespaces * CaNamespaces::getNamespaces ( ) const

Get the XML namespaces list for this CaNamespaces object.

Returns
the XML namespaces of this CaNamespaces object.

◆ getSupportedNamespaces()

static const List * CaNamespaces::getSupportedNamespaces ( )
static

Returns a list of all supported CaNamespaces in this version of libcombine.

Returns
a list with supported OMEX namespaces.

◆ getURI()

virtual std::string CaNamespaces::getURI ( ) const
virtual

Returns a string representing the OMEX XML namespace of this object.

Returns
a string representing the OMEX namespace that reflects the OMEX Level and Version of this object.

◆ getVersion() [1/2]

unsigned int CaNamespaces::getVersion ( )

Get the OMEX Version of this CaNamespaces object.

Returns
the OMEX Version of this CaNamespaces object.

◆ getVersion() [2/2]

unsigned int CaNamespaces::getVersion ( ) const

Get the OMEX Version of this CaNamespaces object.

Returns
the OMEX Version of this CaNamespaces object.

◆ isCaNamespace()

static bool CaNamespaces::isCaNamespace ( const std::string &  uri)
static

Predicate returning true if the given URL is one of OMEX XML namespaces.

Parameters
urithe URI of namespace
Returns
true if the "uri" is one of OMEX namespaces, false otherwise.

◆ isValidCombination()

bool CaNamespaces::isValidCombination ( )

Predicate returning true if the given set of namespaces represent a valid set.

Returns
true if the set of namespaces is valid, false otherwise.

◆ operator=()

CaNamespaces & CaNamespaces::operator= ( const CaNamespaces rhs)

Assignment operator for CaNamespaces.

◆ removeNamespace()

int CaNamespaces::removeNamespace ( const std::string &  uri)

Removes an XML namespace from the set of namespaces within this CaNamespaces object.

Parameters
urithe XML namespace to be added.
  • @omexconstant{LIBCOMBINE_OPERATION_SUCCESS, OperationReturnValues_t}
  • @omexconstant{LIBCOMBINE_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}