1 //------------------------------------------------------------------------------
2 // <auto-generated />
3 //
4 // This file was automatically generated by SWIG (http://www.swig.org).
5 // Version 4.0.2
6 //
7 // Do not make changes to this file unless you know what you are doing--modify
8 // the SWIG interface file instead.
9 //------------------------------------------------------------------------------
10 
11 namespace libsbml {
12 
13  using System;
14  using System.Runtime.InteropServices;
15 
16 /**
17  * @sbmlpackage{core}
18  *
19 @htmlinclude pkg-marker-core.html An XML Namespace.
20  *
21  * @htmlinclude not-sbml-warning.html
22  *
23  * This class serves to organize functionality for tracking XML namespaces
24  * in a document or data stream.  The namespace declarations are stored as
25  * a list of pairs of XML namespace URIs and prefix strings.  These
26  * correspond to the parts of a namespace declaration on an XML element.
27  * For example, in the following XML fragment,
28  * @verbatim
29 <annotation>
30     <mysim:nodecolors xmlns:mysim='urn:lsid:mysim.org'
31          mysim:bgcolor='green' mysim:fgcolor='white'/>
32 </annotation>
33 @endverbatim
34  * there is one namespace declaration.  Its URI is
35  * <code>urn:lsid:mysim.org</code> and its prefix is <code>mysim</code>.
36  * This pair could be stored as one item in an XMLNamespaces list.
37  *
38  * XMLNamespaces provides various methods for manipulating the list of
39  * prefix-URI pairs.  Individual namespaces stored in a given XMLNamespace
40  * object instance can be retrieved based on their index using
41  * XMLNamespaces::getPrefix(int index), or by their characteristics such as
42  * their URI or position in the list.
43  */
44 
45 public class XMLNamespaces : global::System.IDisposable {
46 	private HandleRef swigCPtr;
47 	protected bool swigCMemOwn;
48 
XMLNamespaces(IntPtr cPtr, bool cMemoryOwn)49 	internal XMLNamespaces(IntPtr cPtr, bool cMemoryOwn)
50 	{
51 		swigCMemOwn = cMemoryOwn;
52 		swigCPtr    = new HandleRef(this, cPtr);
53 	}
54 
getCPtr(XMLNamespaces obj)55 	internal static HandleRef getCPtr(XMLNamespaces obj)
56 	{
57 		return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
58 	}
59 
getCPtrAndDisown(XMLNamespaces obj)60 	internal static HandleRef getCPtrAndDisown (XMLNamespaces obj)
61 	{
62 		HandleRef ptr = new HandleRef(null, IntPtr.Zero);
63 
64 		if (obj != null)
65 		{
66 			ptr             = obj.swigCPtr;
67 			obj.swigCMemOwn = false;
68 		}
69 
70 		return ptr;
71 	}
72 
~XMLNamespaces()73   ~XMLNamespaces() {
74     Dispose(false);
75   }
76 
Dispose()77   public void Dispose() {
78     Dispose(true);
79     global::System.GC.SuppressFinalize(this);
80   }
81 
Dispose(bool disposing)82   protected virtual void Dispose(bool disposing) {
83     lock(this) {
84       if (swigCPtr.Handle != global::System.IntPtr.Zero) {
85         if (swigCMemOwn) {
86           swigCMemOwn = false;
87           libsbmlPINVOKE.delete_XMLNamespaces(swigCPtr);
88         }
89         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
90       }
91     }
92   }
93 
operator ==(XMLNamespaces lhs, XMLNamespaces rhs)94   public static bool operator==(XMLNamespaces lhs, XMLNamespaces rhs)
95   {
96     if((Object)lhs == (Object)rhs)
97     {
98       return true;
99     }
100 
101     if( ((Object)lhs == null) || ((Object)rhs == null) )
102     {
103       return false;
104     }
105 
106     return (getCPtr(lhs).Handle.ToString() == getCPtr(rhs).Handle.ToString());
107   }
108 
operator !=(XMLNamespaces lhs, XMLNamespaces rhs)109   public static bool operator!=(XMLNamespaces lhs, XMLNamespaces rhs)
110   {
111     return !(lhs == rhs);
112   }
113 
Equals(Object sb)114   public override bool Equals(Object sb)
115   {
116     if ( ! (sb is XMLNamespaces) )
117     {
118       return false;
119     }
120 
121     return this == (XMLNamespaces)sb;
122   }
123 
GetHashCode()124   public override int GetHashCode()
125   {
126     return swigCPtr.Handle.ToInt32();
127   }
128 
129 
130 /**
131    * Creates a new empty list of XML namespace declarations.
132    */ public
XMLNamespaces()133  XMLNamespaces() : this(libsbmlPINVOKE.new_XMLNamespaces__SWIG_0(), true) {
134     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
135   }
136 
137 
138 /**
139    * Copy constructor; creates a copy of this XMLNamespaces list.
140    *
141    * @param orig the XMLNamespaces object to copy.
142    */ public
XMLNamespaces(XMLNamespaces orig)143  XMLNamespaces(XMLNamespaces orig) : this(libsbmlPINVOKE.new_XMLNamespaces__SWIG_1(XMLNamespaces.getCPtr(orig)), true) {
144     if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve();
145   }
146 
147 
148 /**
149    * Creates and returns a deep copy of this XMLNamespaces object.
150    *
151    * @return the (deep) copy of this XMLNamespaces object.
152    */ public
clone()153  XMLNamespaces clone() {
154     global::System.IntPtr cPtr = libsbmlPINVOKE.XMLNamespaces_clone(swigCPtr);
155     XMLNamespaces ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLNamespaces(cPtr, true);
156     return ret;
157   }
158 
159 
160 /**
161    * Appends an XML namespace prefix and URI pair to this list of namespace
162    * declarations.
163    *
164    * An XMLNamespaces object stores a list of pairs of namespaces and their
165    * prefixes.  If there is an XML namespace with the given @p uri prefix
166    * in this list, then its corresponding URI will be overwritten by the
167    * new @p uri unless the uri represents the core sbml namespace.
168    * Calling programs could use one of the other XMLNamespaces
169    * methods, such as
170    * XMLNamespaces::hasPrefix(@if java String@endif) and
171    * XMLNamespaces::hasURI(@if java String@endif) to
172    * inquire whether a given prefix and/or URI
173    * is already present in this XMLNamespaces object.
174    * If the @p uri represents the sbml namespaces then it will not be
175    * overwritten, as this has potentially serious consequences. If it
176    * is necessary to replace the sbml namespace the namespace should be removed
177    * prior to adding the new namespace.
178    *
179    * @param uri a string, the uri for the namespace.
180    * @param prefix a string, the prefix for the namespace.
181    *
182    *
183  * @return integer value indicating success/failure of the
184  * function.  @if clike The value is drawn from the
185  * enumeration #OperationReturnValues_t. @endif The possible values
186  * returned by this function are:
187  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
188    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
189    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
190    *
191    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
192    */ public
add(string uri, string prefix)193  int add(string uri, string prefix) {
194     int ret = libsbmlPINVOKE.XMLNamespaces_add__SWIG_0(swigCPtr, uri, prefix);
195     return ret;
196   }
197 
198 
199 /**
200    * Appends an XML namespace prefix and URI pair to this list of namespace
201    * declarations.
202    *
203    * An XMLNamespaces object stores a list of pairs of namespaces and their
204    * prefixes.  If there is an XML namespace with the given @p uri prefix
205    * in this list, then its corresponding URI will be overwritten by the
206    * new @p uri unless the uri represents the core sbml namespace.
207    * Calling programs could use one of the other XMLNamespaces
208    * methods, such as
209    * XMLNamespaces::hasPrefix(@if java String@endif) and
210    * XMLNamespaces::hasURI(@if java String@endif) to
211    * inquire whether a given prefix and/or URI
212    * is already present in this XMLNamespaces object.
213    * If the @p uri represents the sbml namespaces then it will not be
214    * overwritten, as this has potentially serious consequences. If it
215    * is necessary to replace the sbml namespace the namespace should be removed
216    * prior to adding the new namespace.
217    *
218    * @param uri a string, the uri for the namespace.
219    * @param prefix a string, the prefix for the namespace.
220    *
221    *
222  * @return integer value indicating success/failure of the
223  * function.  @if clike The value is drawn from the
224  * enumeration #OperationReturnValues_t. @endif The possible values
225  * returned by this function are:
226  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
227    * @li @link libsbml#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT@endlink
228    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
229    *
230    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
231    */ public
add(string uri)232  int add(string uri) {
233     int ret = libsbmlPINVOKE.XMLNamespaces_add__SWIG_1(swigCPtr, uri);
234     return ret;
235   }
236 
237 
238 /**
239    * Removes an XML Namespace stored in the given position of this list.
240    *
241    * @param index an integer, position of the namespace to remove.
242    *
243    *
244  * @return integer value indicating success/failure of the
245  * function.  @if clike The value is drawn from the
246  * enumeration #OperationReturnValues_t. @endif The possible values
247  * returned by this function are:
248  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
249    * @li @link libsbml#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE@endlink
250    */ public
remove(int index)251  int remove(int index) {
252     int ret = libsbmlPINVOKE.XMLNamespaces_remove__SWIG_0(swigCPtr, index);
253     return ret;
254   }
255 
256 
257 /**
258    * Removes an XML Namespace with the given prefix.
259    *
260    * @param prefix a string, prefix of the required namespace.
261    *
262    *
263  * @return integer value indicating success/failure of the
264  * function.  @if clike The value is drawn from the
265  * enumeration #OperationReturnValues_t. @endif The possible values
266  * returned by this function are:
267  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
268    * @li @link libsbml#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE@endlink
269    *
270    * @see remove(int index)
271    */ public
remove(string prefix)272  int remove(string prefix) {
273     int ret = libsbmlPINVOKE.XMLNamespaces_remove__SWIG_1(swigCPtr, prefix);
274     return ret;
275   }
276 
277 
278 /**
279    * Clears (deletes) all XML namespace declarations in this XMLNamespaces
280    * object.
281    *
282    *
283  * @return integer value indicating success/failure of the
284  * function.  @if clike The value is drawn from the
285  * enumeration #OperationReturnValues_t. @endif The possible values
286  * returned by this function are:
287  * @li @link libsbml#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS@endlink
288    * @li @link libsbml#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED@endlink
289    *
290    * @see remove(int index)
291    */ public
clear()292  int clear() {
293     int ret = libsbmlPINVOKE.XMLNamespaces_clear(swigCPtr);
294     return ret;
295   }
296 
297 
298 /**
299    * Look up the index of an XML namespace declaration by URI.
300    *
301    * An XMLNamespaces object stores a list of pairs of namespaces and their
302    * prefixes.  If this XMLNamespaces object contains a pair with the given
303    * URI @p uri, this method returns its index in the list.
304    *
305    * @param uri a string, the URI of the sought-after namespace.
306    *
307    * @return the index of the given declaration, or <code>-1</code> if not
308    * present.
309    */ public
getIndex(string uri)310  int getIndex(string uri) {
311     int ret = libsbmlPINVOKE.XMLNamespaces_getIndex(swigCPtr, uri);
312     return ret;
313   }
314 
315 
316 /**
317    * Tests whether the given uri is contained in this set of namespaces.
318    *
319    */ public
containsUri(string uri)320  bool containsUri(string uri) {
321     bool ret = libsbmlPINVOKE.XMLNamespaces_containsUri(swigCPtr, uri);
322     return ret;
323   }
324 
325 
326 /**
327    * Look up the index of an XML namespace declaration by @p prefix.
328    *
329    * An XMLNamespaces object stores a list of pairs of namespaces and their
330    * prefixes.  If this XMLNamespaces object contains a pair with the given
331    * prefix @p prefix, this method returns its index in the list.
332    *
333    * @param prefix a string, the prefix string of the sought-after
334    * namespace.
335    *
336    * @return the index of the given declaration, or <code>-1</code> if not
337    * present.
338    */ public
getIndexByPrefix(string prefix)339  int getIndexByPrefix(string prefix) {
340     int ret = libsbmlPINVOKE.XMLNamespaces_getIndexByPrefix(swigCPtr, prefix);
341     return ret;
342   }
343 
344 
345 /**
346    * Returns the total number of URI-and-prefix pairs stored in this
347    * particular XMLNamespaces instance.
348    *
349    * @return the number of namespaces in this list.
350    */ public
getLength()351  int getLength() {
352     int ret = libsbmlPINVOKE.XMLNamespaces_getLength(swigCPtr);
353     return ret;
354   }
355 
356 
357 /**
358    * Returns the total number of URI-and-prefix pairs stored in this
359    * particular XMLNamespaces instance.
360    *
361    * @return the number of namespaces in this list.
362    *
363    * This function is an alias for getLength introduced for consistency
364    * with other XML classes.
365    */ public
getNumNamespaces()366  int getNumNamespaces() {
367     int ret = libsbmlPINVOKE.XMLNamespaces_getNumNamespaces(swigCPtr);
368     return ret;
369   }
370 
371 
372 /**
373    * Look up the prefix of an XML namespace declaration by its position.
374    *
375    * An XMLNamespaces object stores a list of pairs of namespaces and their
376    * prefixes.  This method returns the prefix of the <code>n</code>th
377    * element in that list (if it exists).  Callers should use
378    * XMLAttributes::getLength() first to find out how many namespaces are
379    * stored in the list.
380    *
381    * @param index an integer, position of the sought-after prefix.
382    *
383    * @return the prefix of an XML namespace declaration in this list (by
384    * position), or an empty string if the @p index is out of range.
385    *
386    * @see getLength()
387    */ public
getPrefix(int index)388  string getPrefix(int index) {
389     string ret = libsbmlPINVOKE.XMLNamespaces_getPrefix__SWIG_0(swigCPtr, index);
390     return ret;
391   }
392 
393 
394 /**
395    * Look up the prefix of an XML namespace declaration by its URI.
396    *
397    * An XMLNamespaces object stores a list of pairs of namespaces and their
398    * prefixes.  This method returns the prefix for a pair that has the
399    * given @p uri.
400    *
401    * @param uri a string, the URI of the prefix being sought.
402    *
403    * @return the prefix of an XML namespace declaration given its URI, or
404    * an empty string if no such @p uri exists in this XMLNamespaces object.
405    */ public
getPrefix(string uri)406  string getPrefix(string uri) {
407     string ret = libsbmlPINVOKE.XMLNamespaces_getPrefix__SWIG_1(swigCPtr, uri);
408     return ret;
409   }
410 
411 
412 /**
413    * Look up the URI of an XML namespace declaration by its position.
414    *
415    * An XMLNamespaces object stores a list of pairs of namespaces and their
416    * prefixes.  This method returns the URI of the <code>n</code>th element
417    * in that list (if it exists).  Callers should use
418    * XMLAttributes::getLength() first to find out how many namespaces are
419    * stored in the list.
420    *
421    * @param index an integer, position of the required URI.
422    *
423    * @return the URI of an XML namespace declaration in this list (by
424    * position), or an empty string if the @p index is out of range.
425    *
426    * @see getLength()
427    */ public
getURI(int index)428  string getURI(int index) {
429     string ret = libsbmlPINVOKE.XMLNamespaces_getURI__SWIG_0(swigCPtr, index);
430     return ret;
431   }
432 
433 
434 /**
435    * Look up the URI of an XML namespace declaration by its prefix.
436    *
437    * An XMLNamespaces object stores a list of pairs of namespaces and their
438    * prefixes.  This method returns the namespace URI for a pair that has
439    * the given @p prefix.
440    *
441    * @param prefix a string, the prefix of the required URI.
442    *
443    * @return the URI of an XML namespace declaration having the given @p
444    * prefix, or an empty string if no such prefix-and-URI pair exists
445    * in this XMLNamespaces object.
446    *
447    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
448    *
449    * @see getURI()
450    */ public
getURI(string prefix)451  string getURI(string prefix) {
452     string ret = libsbmlPINVOKE.XMLNamespaces_getURI__SWIG_1(swigCPtr, prefix);
453     return ret;
454   }
455 
456 
457 /**
458    * Look up the URI of an XML namespace declaration by its prefix.
459    *
460    * An XMLNamespaces object stores a list of pairs of namespaces and their
461    * prefixes.  This method returns the namespace URI for a pair that has
462    * the given @p prefix.
463    *
464    * @param prefix a string, the prefix of the required URI.
465    *
466    * @return the URI of an XML namespace declaration having the given @p
467    * prefix, or an empty string if no such prefix-and-URI pair exists
468    * in this XMLNamespaces object.
469    *
470    * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif
471    *
472    * @see getURI()
473    */ public
getURI()474  string getURI() {
475     string ret = libsbmlPINVOKE.XMLNamespaces_getURI__SWIG_2(swigCPtr);
476     return ret;
477   }
478 
479 
480 /**
481    * Predicate returning @c true or @c false depending on whether this
482    * XMLNamespaces list is empty.
483    *
484    * @return @c true if this XMLNamespaces list is empty, @c false otherwise.
485    */ public
isEmpty()486  bool isEmpty() {
487     bool ret = libsbmlPINVOKE.XMLNamespaces_isEmpty(swigCPtr);
488     return ret;
489   }
490 
491 
492 /**
493    * Predicate returning @c true or @c false depending on whether an XML
494    * Namespace with the given URI is contained in this XMLNamespaces list.
495    *
496    * @param uri a string, the uri for the namespace.
497    *
498    * @return @c true if an XML Namespace with the given URI is contained in
499    * this XMLNamespaces list, @c false otherwise.
500    */ public
hasURI(string uri)501  bool hasURI(string uri) {
502     bool ret = libsbmlPINVOKE.XMLNamespaces_hasURI(swigCPtr, uri);
503     return ret;
504   }
505 
506 
507 /**
508    * Predicate returning @c true or @c false depending on whether an XML
509    * Namespace with the given prefix is contained in this XMLNamespaces
510    * list.
511    *
512    * @param prefix a string, the prefix for the namespace.
513    *
514    * @return @c true if an XML Namespace with the given URI is contained in
515    * this XMLNamespaces list, @c false otherwise.
516    */ public
hasPrefix(string prefix)517  bool hasPrefix(string prefix) {
518     bool ret = libsbmlPINVOKE.XMLNamespaces_hasPrefix(swigCPtr, prefix);
519     return ret;
520   }
521 
522 
523 /**
524    * Predicate returning @c true or @c false depending on whether an XML
525    * Namespace with the given URI and prefix pair is contained in this
526    * XMLNamespaces list.
527    *
528    * @param uri a string, the URI for the namespace.
529    * @param prefix a string, the prefix for the namespace.
530    *
531    * @return @c true if an XML Namespace with the given uri/prefix pair is
532    * contained in this XMLNamespaces list, @c false otherwise.
533    */ public
hasNS(string uri, string prefix)534  bool hasNS(string uri, string prefix) {
535     bool ret = libsbmlPINVOKE.XMLNamespaces_hasNS(swigCPtr, uri, prefix);
536     return ret;
537   }
538 
539 }
540 
541 }
542