libNuML 1.1.1
Library for reading / writing NuML documents
NUMLList.cpp File Reference
#include <algorithm>
#include <functional>
#include <numl/NUMLVisitor.h>
#include <numl/NUMLList.h>

Classes

struct  Delete
 Used by the Destructor to delete each item in mErrors. More...
 
struct  Clone
 Used by the Copy Constructor to clone each item in mItems. More...
 
struct  SetNUMLDocument
 Used by NUMLList::setNUMLDocument(). More...
 
struct  SetParentNUMLObject
 Used by NUMLList::setParentNUMLObject(). More...
 
struct  Write
 Used by NUMLList::writeElements(). More...
 

Functions

LIBNUML_EXTERN NUMLList_tNUMLList_create ()
 Creates a new NUMLList. More...
 
LIBNUML_EXTERN void NUMLList_free (NUMLList_t *lo)
 Frees the given NUMLList and its constituent items. More...
 
LIBNUML_EXTERN NUMLList_tNUMLList_clone (const NUMLList_t *lo)
 
LIBNUML_EXTERN void NUMLList_append (NUMLList_t *lo, const NMBase *item)
 Adds a copy of item to the end of this NUMLList items. More...
 
LIBNUML_EXTERN void NUMLList_appendAndOwn (NUMLList_t *lo, NMBase_t *item)
 Adds the given item to the end of this NUMLList items. More...
 
LIBNUML_EXTERN NMBaseNUMLList_get (NUMLList_t *lo, unsigned int n)
 Returns the nth item in this NUMLList items. More...
 
LIBNUML_EXTERN void NUMLList_clear (NUMLList_t *lo, int doDelete)
 Removes all items in this NUMLList object. More...
 
LIBNUML_EXTERN NMBaseNUMLList_remove (NUMLList_t *lo, unsigned int n)
 Removes the nth item from this NUMLList items and returns a pointer to it. More...
 
LIBNUML_EXTERN unsigned int NUMLList_size (const NUMLList_t *lo)
 Returns the number of items in this NUMLList items. More...
 
LIBNUML_EXTERN NUMLTypeCode_t NUMLList_getItemTypeCode (const NUMLList_t *lo)
 

Function Documentation

◆ NUMLList_append()

LIBNUML_EXTERN void NUMLList_append ( NUMLList_t lo,
const NMBase item 
)

Adds a copy of item to the end of this NUMLList items.

◆ NUMLList_appendAndOwn()

LIBNUML_EXTERN void NUMLList_appendAndOwn ( NUMLList_t lo,
NMBase_t item 
)

Adds the given item to the end of this NUMLList items.

◆ NUMLList_clear()

LIBNUML_EXTERN void NUMLList_clear ( NUMLList_t lo,
int  doDelete 
)

Removes all items in this NUMLList object.

If doDelete is true (non-zero), all items in this NUMLList object are deleted and cleared, and thus the caller doesn't have to delete those items. Otherwise (zero), 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).

◆ NUMLList_clone()

LIBNUML_EXTERN NUMLList_t * NUMLList_clone ( const NUMLList_t lo)
Returns
a (deep) copy of this NUMLList items.

◆ NUMLList_create()

LIBNUML_EXTERN NUMLList_t * NUMLList_create ( )

Creates a new NUMLList.

Returns
a pointer to created NUMLList.

◆ NUMLList_free()

LIBNUML_EXTERN void NUMLList_free ( NUMLList_t lo)

Frees the given NUMLList and its constituent items.

This function assumes each item in the list is derived from NMBase.

◆ NUMLList_get()

LIBNUML_EXTERN NMBase * NUMLList_get ( NUMLList_t lo,
unsigned int  n 
)

Returns the nth item in this NUMLList items.

◆ NUMLList_getItemTypeCode()

LIBNUML_EXTERN NUMLTypeCode_t NUMLList_getItemTypeCode ( const NUMLList_t lo)
Returns
the NUMLTypeCode_t of NUML objects contained in this NUMLList or NUML_UNKNOWN (default).

◆ NUMLList_remove()

LIBNUML_EXTERN NMBase * NUMLList_remove ( NUMLList_t lo,
unsigned int  n 
)

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.

◆ NUMLList_size()

LIBNUML_EXTERN unsigned int NUMLList_size ( const NUMLList_t lo)

Returns the number of items in this NUMLList items.