libNuML 1.1.1
Library for reading / writing NuML documents
NUMLList.h
Go to the documentation of this file.
1/*
2* ****************************************************************************
3* This file is part of libNUML. Please visit http://code.google.com/p/numl/for more
4* information about NUML, and the latest version of libNUML.
5* Copyright (c) 2013 The University of Manchester.
6*
7* This library is free software; you can redistribute it and/or modify it
8* under the terms of the GNU Lesser General Public License as published
9* by the Free Software Foundation. A copy of the license agreement is
10* provided in the file named "LICENSE.txt" included with this software
11* distribution and also available online as http://www.gnu.org/licenses/lgpl.html
12*
13* Contributors:
14* Joseph O. Dada, The University of Manchester - initial API and implementation
15* ****************************************************************************
16**/
17
24#ifndef NUMLLIST_H_
25#define NUMLLIST_H_
26
27#include <numl/common/extern.h>
28#include <numl/common/numlfwd.h>
29#include <numl/NUMLTypeCodes.h>
30
31
32
33
34
35#include <vector>
36
37#include <numl/NMBase.h>
38
39#ifdef __cplusplus
40LIBNUML_CPP_NAMESPACE_BEGIN
41
42/*
43 *
44 */
46public:
47
65 NUMLList (unsigned int level, unsigned int version);
66
88 NUMLList (NUMLNamespaces* numlns);
89
90 NUMLList();
91 virtual ~NUMLList();
92
96 NUMLList (const NUMLList& orig);
97
98
102 NUMLList& operator=(const NUMLList& rhs);
103
104
114 virtual bool accept (NUMLVisitor& v) const;
115
116
122 virtual NMBase* clone () const;
123
124
136 void append (const NMBase* item);
137
138
150 void appendAndOwn (NMBase* item);
151
152
162 virtual const NMBase* get (unsigned int n) const;
163
164
174 virtual NMBase* get (unsigned int n);
175
176
177#if 0
189 virtual const NMBase* get (const std::string& sid) const;
190#endif
191
192
193#if 0
205 virtual NMBase* get (const std::string& sid);
206#endif
207
208
221 void clear (bool doDelete = true);
222
223
234 virtual NMBase* remove (unsigned int n);
235
236
237#if 0
250 virtual NMBase* remove (const std::string& sid);
251#endif
252
253
259 unsigned int size () const;
260
261
268 virtual void setNUMLDocument (NUMLDocument* d);
269
270
276 virtual void setParentNUMLObject (NMBase* sb);
277
278
279
310// virtual int getTypeCode () const;
311
312
341 // virtual int getItemTypeCode () const;
342
343
344
345
346
347
368 virtual NUMLTypeCode_t getTypeCode () const;
369
370
389 virtual NUMLTypeCode_t getItemTypeCode () const;
390
391
398 virtual const std::string& getElementName () const;
399
400
406 virtual void writeElements (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const;
407
408
409protected:
410
416 virtual void readAttributes (const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLAttributes& attributes);
417
428 virtual void writeAttributes (LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream& stream) const;
429
430 std::vector<NMBase*> mItems;
431
432
433};
434
435LIBNUML_CPP_NAMESPACE_END
436
437#endif /* __cplusplus */
438
439#ifndef SWIG
440
441LIBNUML_CPP_NAMESPACE_BEGIN
443
444//TODO
445
447LIBNUML_CPP_NAMESPACE_END
448
449#endif /* !SWIG */
450
451#endif /* NUMLLIST_H_ */
NUMLTypeCode_t
An enumeration of NUML types to help identify NUML objects at runtime.
Definition: NUMLTypeCodes.h:34
This is the base class for all numl objects.
Definition: NMBase.h:71
NMBase & operator=(const NMBase &orig)
Assignment operator for NMBase.
Definition: NMBase.cpp:168
virtual NUMLTypeCode_t getTypeCode() const
Returns the libnuml type code for this object.
Definition: NMBase.cpp:624
virtual const std::string & getElementName() const =0
Returns the XML element name of this object.
virtual bool accept(NUMLVisitor &v) const =0
Accepts the given NUMLVisitor for this instance of NMBase.
virtual NMBase * clone() const =0
Creates and returns a deep copy of this NMBase object.
virtual void setNUMLDocument(NUMLDocument *d)
Sets the parent NUMLDocument of this NUML object.
Definition: NMBase.cpp:435
virtual void setParentNUMLObject(NMBase *sb)
Sets the parent NUML object of this NUML object.
Definition: NMBase.cpp:486
virtual void writeAttributes(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLOutputStream &stream) const
Subclasses should override this method to write their XML attributes to the XMLOutputStream.
Definition: NMBase.cpp:2160
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 spe...
Definition: NMBase.cpp:2135
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.
Definition: NMBase.cpp:1694
This represents the numl document that contains all information.
Definition: NUMLDocument.h:107
Parent class for the various NUML list classes e.g.
Definition: NUMLList.h:45
std::vector< NMBase * > mItems
Definition: NUMLList.h:430
namespace class
Definition: NUMLNamespaces.h:47
Implementation of the Visitor design pattern, for operations on NUML objects.
Definition: NUMLVisitor.h:73
#define BEGIN_C_DECLS
Definition: extern.h:112
#define LIBNUML_EXTERN
Begin svn Header.
Definition: extern.h:104
#define END_C_DECLS
Definition: extern.h:113