libNuML
1.1.1
Library for reading / writing NuML documents
|
Parent class for the various NUML list classes e.g. More...
#include <NUMLList.h>
Public Member Functions | |
NUMLList (unsigned int level, unsigned int version) | |
Creates a new NUMLList using the given NUML level and version values. More... | |
NUMLList (NUMLNamespaces *numlns) | |
Creates a new DimensionDescription using the given NUMLNamespaces object numlns . More... | |
NUMLList () | |
virtual | ~NUMLList () |
NUMLList (const NUMLList &orig) | |
Copy constructor. More... | |
NUMLList & | operator= (const NUMLList &rhs) |
Assignment operator for NUMLList. More... | |
virtual bool | accept (NUMLVisitor &v) const |
Accepts the given NUMLVisitor. More... | |
virtual NMBase * | clone () const |
Creates and returns a deep copy of this NUMLList. More... | |
void | append (const NMBase *item) |
Adds item to the end of this NUMLList. More... | |
void | appendAndOwn (NMBase *item) |
Adds item to the end of this NUMLList. More... | |
virtual const NMBase * | get (unsigned int n) const |
Get an item from the list. More... | |
virtual NMBase * | get (unsigned int n) |
Get an item from the list. More... | |
void | clear (bool doDelete=true) |
Removes all items in this NUMLList object. More... | |
virtual NMBase * | remove (unsigned int n) |
Removes the nth item from this NUMLList items and returns a pointer to it. More... | |
unsigned int | size () const |
Get the size of this NUMLList. More... | |
virtual void | setNUMLDocument (NUMLDocument *d) |
Sets the parent NUMLDocument of this NUML object. More... | |
virtual void | setParentNUMLObject (NMBase *sb) |
Sets the parent NUML object of this NUML object. More... | |
virtual NUMLTypeCode_t | getTypeCode () const |
Returns the libnuml type code for this object, namely, NUMLLIST . More... | |
virtual NUMLTypeCode_t | getItemTypeCode () const |
Get the type code of the objects contained in this NUMLList. More... | |
virtual const std::string & | getElementName () const |
Returns the XML element name of this object, which for NUMLList, is always "listOf" . More... | |
virtual void | writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Subclasses should override this method to write out their contained NUML objects as XML elements. More... | |
![]() | |
virtual | ~NMBase () |
Destroy this object. More... | |
NMBase & | operator= (const NMBase &orig) |
Assignment operator for NMBase. More... | |
const std::string & | getMetaId () const |
Returns the value of the "metaid" attribute of this object. More... | |
std::string & | getMetaId () |
Returns the value of the "metaid" attribute of this object. More... | |
virtual const std::string & | getId () const |
virtual const std::string & | getName () const |
virtual LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces * | getNamespaces () const |
Returns the content of the "annotation" subelement of this object as a character string. More... | |
const NUMLDocument * | getNUMLDocument () const |
Returns the parent NUMLDocument object. More... | |
NUMLDocument * | getNUMLDocument () |
Returns the parent NUMLDocument object. More... | |
NMBase * | getParentNUMLObject () |
Returns the parent NUML object. More... | |
NMBase * | getAncestorOfType (NUMLTypeCode_t type) |
Returns the ancestor NUML object that corresponds to the given NUMLTypeCode_t. More... | |
unsigned int | getLine () const |
Returns the line number on which this object first appears in the XML representation of the NUML document. More... | |
unsigned int | getColumn () const |
Returns the column number on which this object first appears in the XML representation of the NUML document. More... | |
bool | isSetMetaId () const |
Predicate returning true or false depending on whether this object's "metaid" attribute has been set. More... | |
bool | isSetName () const |
int | setMetaId (const std::string &metaid) |
Sets the value of the "metaid" attribute of this object. More... | |
virtual int | setId (const std::string &sid) |
int | setNamespaces (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns) |
Sets the namespaces relevant of this NUML object. More... | |
int | unsetMetaId () |
Unsets the value of the "metaid" attribute of this NUML object. More... | |
unsigned int | getLevel () const |
Returns the NUML Level of the overall NUML document. More... | |
unsigned int | getVersion () const |
Returns the Version within the NUML Level of the overall NUML document. More... | |
bool | hasValidLevelVersionNamespaceCombination () |
Predicate returning true or false depending on whether this object's level/version and namespace values correspond to a valid NUML specification. More... | |
char * | toNUML () |
Returns a string that consists of the partial NUML describing this object. More... | |
void | read (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream) |
Reads (initializes) this NUML object by reading from XMLInputStream. More... | |
void | write (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Writes (serializes) this NUML object by writing it to XMLOutputStream. More... | |
virtual bool | hasRequiredAttributes () const |
virtual bool | hasRequiredElements () const |
void | setNUMLNamespaces (NUMLNamespaces *numlns) |
NUMLNamespaces * | getNUMLNamespaces () const |
void | syncAnnotation () |
bool | isSetNotes () const |
bool | isSetAnnotation () const |
virtual int | setAnnotation (const XMLNode *annotation) |
virtual int | setAnnotation (const std::string &annotation) |
virtual int | appendAnnotation (const XMLNode *annotation) |
virtual int | appendAnnotation (const std::string &annotation) |
int | removeTopLevelAnnotationElement (const std::string elementName, const std::string elementURI="") |
int | replaceTopLevelAnnotationElement (const XMLNode *annotation) |
int | replaceTopLevelAnnotationElement (const std::string &annotation) |
int | setNotes (const XMLNode *notes) |
int | setNotes (const std::string ¬es, bool addXHTMLMarkup=false) |
int | appendNotes (const XMLNode *notes) |
int | appendNotes (const std::string ¬es) |
int | unsetNotes () |
int | unsetAnnotation () |
XMLNode * | getNotes () const |
std::string | getNotesString () const |
XMLNode * | getAnnotation () const |
std::string | getAnnotationString () const |
Protected Member Functions | |
virtual void | readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes &attributes) |
Subclasses should override this method to read values from the given XMLAttributes set into their specific fields. More... | |
virtual void | writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Subclasses should override this method to write their XML attributes to the XMLOutputStream. More... | |
![]() | |
virtual void | writeXMLNS (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const |
Subclasses should override this method to write their xmlns attriubutes (if any) to the XMLOutputStream. More... | |
NMBase (const std::string &id="", const std::string &name="") | |
Only subclasses may create NMBase objects. More... | |
NMBase (unsigned int level, unsigned int version) | |
Creates a new NMBase object with the given sboTerm. More... | |
NMBase (NUMLNamespaces *numlns) | |
Creates a new NMBase object with the given NUMLNamespaces. More... | |
NMBase (const NMBase &orig) | |
Copy constructor. More... | |
virtual NMBase * | createObject (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream) |
Subclasses should override this method to create, store, and then return an NUML object corresponding to the next XMLToken in the XMLInputStream. More... | |
virtual bool | readOtherXML (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream &stream) |
Subclasses should override this method to read (and store) XHTML, MathML, etc. More... | |
virtual int | getElementPosition () const |
The NUML XML Schema is written such that the order of child elements is significant. More... | |
NUMLErrorLog * | getErrorLog () |
void | logError (unsigned int id, const unsigned int level=2, const unsigned int version=3, const std::string &details="") |
Convenience method for easily logging problems from within method implementations. More... | |
void | logUnknownAttribute (std::string attribute, const unsigned int level, const unsigned int version, const std::string element) |
Helper to log a common type of error. More... | |
void | logUnknownElement (const std::string element, const unsigned int level, const unsigned int version) |
Helper to log a common type of error. More... | |
void | logEmptyString (std::string attribute, const unsigned int level, const unsigned int version, std::string element) |
Helper to log a common type of error. More... | |
void | checkOrderAndLogError (NMBase *object, int expected) |
Checks that NUML element has been read in the proper order. More... | |
void | checkNUMLListPopulated (NMBase *object) |
Checks that an NUML NUMLList element has been populated. More... | |
void | checkDefaultNamespace (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNamespaces *xmlns, const std::string &elementName) |
Checks that the given default namespace in the given element is valid. More... | |
void | checkXHTML (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode *) |
Checks that the XHTML is valid. More... | |
void | checkAnnotation () |
Checks the annotation does not declare an numl namespace. More... | |
Protected Attributes | |
std::vector< NMBase * > | mItems |
![]() | |
std::string | mMetaId |
std::string | mId |
std::string | mName |
NUMLDocument * | mNUML |
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * | mNotes |
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode * | mAnnotation |
NUMLNamespaces * | mNUMLNamespaces |
unsigned int | mLine |
unsigned int | mColumn |
int | mDept |
NMBase * | mParentNUMLObject |
bool | mHasBeenDeleted |
std::string | mEmptyString |
Parent class for the various NUML list classes e.g.
Operations, Result, ResultComponent etc.
LIBNUML_CPP_NAMESPACE_BEGIN NUMLList::NUMLList | ( | unsigned int | level, |
unsigned int | version | ||
) |
Creates a new NUMLList using the given NUML level
and version
values.
level | an unsigned int, the NUML Level to assign to this NUMLList |
version | an unsigned int, the NUML Version to assign to this NUMLList |
level
, version
for the document override those used to create the NUMLList. Despite this, the ability to supply the values at creation time is an important aid to creating valid NUML. Knowledge of the intented NUML Level and Version determine whether it is valid to assign a particular value to an attribute, or whether it is valid to add an object to an existing NUMLDocument. NUMLList::NUMLList | ( | NUMLNamespaces * | numlns | ) |
Creates a new DimensionDescription using the given NUMLNamespaces object numlns
.
The NUMLNamespaces object encapsulates NUML Level/Version/namespaces information. It is used to communicate the NUML Level, Version, and (in Level 3) packages used in addition to NUML Level Core. A common approach to using this class constructor is to create an NUMLNamespaces object somewhere in a program, once, then pass it to object constructors such as this one when needed.
numlns | an NUMLNamespaces object. |
level
, version
and xmlns
namespaces for the document override those used to create the DimensionDescription. Despite this, the ability to supply the values at creation time is an important aid to creating valid NUML. Knowledge of the intented NUML Level and Version determine whether it is valid to assign a particular value to an attribute, or whether it is valid to add an object to an existing NUMLDocument. NUMLList::NUMLList | ( | ) |
|
virtual |
|
virtual |
Accepts the given NUMLVisitor.
v | the NUMLVisitor instance to be used. |
v.visit()
, which indicates whether the Visitor would like to visit the next item in the list. Implements NMBase.
Reimplemented in CompositeDescription, Dimension, DimensionDescription, CompositeValue, AtomicDescription, and AtomicValue.
void NUMLList::append | ( | const NMBase * | item | ) |
Adds item to the end of this NUMLList.
This variant of the method makes a clone of the item
handed to it. This means that when the NUMLList is destroyed, the original items will not be destroyed.
item | the item to be added to the list. |
void NUMLList::appendAndOwn | ( | NMBase * | item | ) |
Adds item to the end of this NUMLList.
This variant of the method does not clone the item
handed to it; instead, it assumes ownership of it. This means that when the NUMLList is destroyed, the item will be destroyed along with it.
item | the item to be added to the list. |
void NUMLList::clear | ( | bool | doDelete = true | ) |
Removes all items in this NUMLList object.
Used by NUMLList::get() to lookup an NMBase based by its id.
If doDelete is true (default), all items in this NUMLList object are deleted and cleared, and thus the caller doesn't have to delete those items. Otherwise, all items are just cleared from this NUMLList object and the caller is responsible for deleting all items (In this case, pointers to all items should be stored elsewhere before calling this function by the caller).
doDelete | if true (default), all items are deleted and cleared. Otherwise, all items are just cleared and not deleted. |
|
virtual |
Creates and returns a deep copy of this NUMLList.
Implements NMBase.
Reimplemented in ResultComponents, OntologyTerms, AtomicDescription, AtomicValue, Dimension, DimensionDescription, CompositeDescription, CompositeValue, Tuple, and TupleDescription.
|
virtual |
Get an item from the list.
n | the index number of the item to get. |
Reimplemented in ResultComponents, OntologyTerms, CompositeDescription, CompositeValue, DimensionDescription, and Dimension.
|
virtual |
Get an item from the list.
n | the index number of the item to get. |
Reimplemented in ResultComponents, OntologyTerms, CompositeDescription, CompositeValue, DimensionDescription, and Dimension.
|
virtual |
Returns the XML element name of this object, which for NUMLList, is always "listOf"
.
Implements NMBase.
Reimplemented in ResultComponents, OntologyTerms, CompositeDescription, Dimension, CompositeValue, DimensionDescription, TupleDescription, Tuple, AtomicDescription, and AtomicValue.
|
virtual |
Get the type code of the objects contained in this NUMLList.
NUML_UNKNOWN
(default). Reimplemented in ResultComponents, OntologyTerms, CompositeDescription, DimensionDescription, CompositeValue, Dimension, TupleDescription, and Tuple.
|
virtual |
Returns the libnuml type code for this object, namely, NUMLLIST
.
NUMLLIST
.NUML_UNKNOWN
(default).Reimplemented from NMBase.
Reimplemented in ResultComponents, OntologyTerms, CompositeDescription, DimensionDescription, Dimension, CompositeValue, AtomicDescription, TupleDescription, AtomicValue, and Tuple.
|
protectedvirtual |
Subclasses should override this method to read values from the given XMLAttributes set into their specific fields.
Be sure to call your parents implementation of this method as well.
Reimplemented from NMBase.
Reimplemented in CompositeDescription, CompositeValue, Tuple, TupleDescription, AtomicDescription, and AtomicValue.
|
virtual |
Removes the nth item from this NUMLList items and returns a pointer to it.
The caller owns the returned item and is responsible for deleting it.
n | the index of the item to remove |
Reimplemented in ResultComponents, OntologyTerms, CompositeDescription, CompositeValue, DimensionDescription, and Dimension.
|
virtual |
Sets the parent NUMLDocument of this NUML object.
d | the NUMLDocument that should become the parent of this NUMLList. |
Reimplemented from NMBase.
|
virtual |
Sets the parent NUML object of this NUML object.
sb | the NUML object to use |
Reimplemented from NMBase.
unsigned int NUMLList::size | ( | ) | const |
|
protectedvirtual |
Subclasses should override this method to write their XML attributes to the XMLOutputStream.
Be sure to call your parents implementation of this method as well. For example:
NMBase::writeAttributes(stream); stream.writeAttribute( "id" , mId ); stream.writeAttribute( "name", mName ); ...
Reimplemented from NMBase.
Reimplemented in CompositeDescription, CompositeValue, Tuple, TupleDescription, AtomicDescription, and AtomicValue.
|
virtual |
Subclasses should override this method to write out their contained NUML objects as XML elements.
Be sure to call your parents implementation of this method as well.
Reimplemented from NMBase.
|
protected |