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 Methods for checking the validity of SBML identifiers. 20 * 21 * @htmlinclude not-sbml-warning.html 22 * 23 * This utility class provides static methods for checking the syntax of 24 * identifiers and other text used in an SBML model. The methods allow 25 * callers to verify that strings such as SBML identifiers and XHTML notes 26 * text conform to the SBML specifications. 27 */ 28 29 public class SyntaxChecker : global::System.IDisposable { 30 private HandleRef swigCPtr; 31 protected bool swigCMemOwn; 32 SyntaxChecker(IntPtr cPtr, bool cMemoryOwn)33 internal SyntaxChecker(IntPtr cPtr, bool cMemoryOwn) 34 { 35 swigCMemOwn = cMemoryOwn; 36 swigCPtr = new HandleRef(this, cPtr); 37 } 38 getCPtr(SyntaxChecker obj)39 internal static HandleRef getCPtr(SyntaxChecker obj) 40 { 41 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 42 } 43 getCPtrAndDisown(SyntaxChecker obj)44 internal static HandleRef getCPtrAndDisown (SyntaxChecker obj) 45 { 46 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 47 48 if (obj != null) 49 { 50 ptr = obj.swigCPtr; 51 obj.swigCMemOwn = false; 52 } 53 54 return ptr; 55 } 56 ~SyntaxChecker()57 ~SyntaxChecker() { 58 Dispose(false); 59 } 60 Dispose()61 public void Dispose() { 62 Dispose(true); 63 global::System.GC.SuppressFinalize(this); 64 } 65 Dispose(bool disposing)66 protected virtual void Dispose(bool disposing) { 67 lock(this) { 68 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 69 if (swigCMemOwn) { 70 swigCMemOwn = false; 71 libsbmlPINVOKE.delete_SyntaxChecker(swigCPtr); 72 } 73 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 74 } 75 } 76 } 77 78 79 /** 80 * Returns @c true or @c false depending on whether the argument 81 * string conforms to the syntax of SBML identifiers. 82 * 83 * 84 * 85 * In SBML, identifiers that are the values of 'id' attributes on objects 86 * must conform to a data type called <code>SId</code> in the SBML 87 * specifications. LibSBML does not provide an explicit <code>SId</code> 88 * data type; it uses ordinary character strings, which is easier for 89 * applications to support. (LibSBML does, however, test for identifier 90 * validity at various times, such as when reading in models from files 91 * and data streams.) 92 * 93 * 94 * 95 * 96 * This method provides programs with the ability to test explicitly that 97 * the identifier strings they create conform to the SBML identifier 98 * syntax. 99 * 100 * @param sid string to be checked for conformance to SBML identifier 101 * syntax. 102 * 103 * @return @c true if the string conforms to type SBML data type 104 * <code>SId</code>, @c false otherwise. 105 * 106 * The identifier given by an object's 'id' attribute value 107 * is used to identify the object within the SBML model definition. 108 * Other objects can refer to the component using this identifier. The 109 * data type of 'id' is always <code>SId</code> or a type derived 110 * from that, such as <code>UnitSId</code>, depending on the object in 111 * question. All data types are defined as follows: 112 * <pre style='margin-left: 2em; border: none; font-weight: bold; color: black'> 113 * letter ::= 'a'..'z','A'..'Z' 114 * digit ::= '0'..'9' 115 * idChar ::= letter | digit | '_' 116 * SId ::= ( letter | '_' ) idChar* 117 * </pre> 118 * 119 * The equality of <code>SId</code> and <code>SId</code>-derived values 120 * in SBML is determined by an exact character sequence match; i.e., 121 * comparisons of these identifiers must be performed in a case-sensitive 122 * manner. This applies to all uses of <code>SId</code>, 123 * <code>SIdRef</code>, and derived types. 124 * 125 * 126 * @if python @note Because this is a static method on a class, the Python 127 * language interface for libSBML will contain two variants. One will be the 128 * expected, normal static method on the class (i.e., a regular 129 * <em>methodName</em>), and the other will be a standalone top-level 130 * function with the name <em>ClassName_methodName()</em>. This is merely an 131 * artifact of how the language interfaces are created in libSBML. The 132 * methods are functionally identical. @endif 133 * 134 * 135 * 136 * @see @if clike isValidUnitSId(string sid) @else SyntaxChecker::isValidUnitSId(string sid) @endif 137 * @see @if clike isValidXMLID(string sid) @else SyntaxChecker::isValidXMLID(string sid) @endif 138 */ public isValidSBMLSId(string sid)139 static bool isValidSBMLSId(string sid) { 140 bool ret = libsbmlPINVOKE.SyntaxChecker_isValidSBMLSId(sid); 141 return ret; 142 } 143 144 145 /** 146 * Returns @c true or @c false depending on whether the argument string 147 * conforms to the XML data type <code>ID</code>. 148 * 149 * 150 * 151 * The optional attribute named 'metaid', present on every major SBML 152 * component type, is for supporting metadata annotations using RDF (<a 153 * href='http://www.w3.org/RDF/'>Resource Description Format</a>). The 154 * attribute value has the data type <a 155 * href='http://www.w3.org/TR/REC-xml/#id'>XML <code>ID</code></a>, the XML 156 * identifier type, which means each 'metaid' value must be globally unique 157 * within an SBML file. The latter point is important, because the 158 * uniqueness criterion applies across <em>any</em> attribute with type 159 * <code>ID</code> anywhere in the file, not just the 'metaid' attribute used 160 * by SBML---something to be aware of if your application-specific XML 161 * content inside the 'annotation' subelement happens to use the XML 162 * <code>ID</code> type. Although SBML itself specifies the use of <a 163 * href='http://www.w3.org/TR/REC-xml/#id'>XML <code>ID</code></a> only for 164 * the 'metaid' attribute, SBML-compatible applications should be careful if 165 * they use XML <code>ID</code>'s in XML portions of a model that are not 166 * defined by SBML, such as in the application-specific content of the 167 * 'annotation' subelement. Finally, note that LibSBML does not provide an 168 * explicit XML <code>ID</code> data type; it uses ordinary character 169 * strings, which is easier for applications to support. 170 * 171 * 172 * 173 * This method provides programs with the ability to test explicitly that 174 * the identifier strings they create conform to the SBML identifier 175 * syntax. 176 * 177 * @param id string to be checked for conformance to the syntax of 178 * <a target='_blank' href='http://www.w3.org/TR/REC-xml/#id'>XML ID</a>. 179 * 180 * @return @c true if the string is a syntactically-valid value for the 181 * XML type <a target='_blank' 182 * href='http://www.w3.org/TR/REC-xml/#id'>ID</a>, @c false otherwise. 183 * 184 * @note @htmlinclude xmlid-syntax.html 185 * 186 * 187 * @if python @note Because this is a static method on a class, the Python 188 * language interface for libSBML will contain two variants. One will be the 189 * expected, normal static method on the class (i.e., a regular 190 * <em>methodName</em>), and the other will be a standalone top-level 191 * function with the name <em>ClassName_methodName()</em>. This is merely an 192 * artifact of how the language interfaces are created in libSBML. The 193 * methods are functionally identical. @endif 194 * 195 * 196 * 197 * @see @if clike isValidSBMLSId(string sid) @else SyntaxChecker::isValidSBMLSId(string sid) @endif 198 * @see @if clike isValidUnitSId(string sid) @else SyntaxChecker::isValidUnitSId(string sid) @endif 199 */ public isValidXMLID(string id)200 static bool isValidXMLID(string id) { 201 bool ret = libsbmlPINVOKE.SyntaxChecker_isValidXMLID(id); 202 return ret; 203 } 204 205 206 /** 207 * Returns @c true or @c false depending on whether the @p uri argument string 208 * conforms to the XML data type <code>anyURI</code>. 209 * 210 * Type anyURI is defined by XML Schema 1.0. It is a character string 211 * data type whose values are interpretable as URIs (Universal Resource 212 * Identifiers) as described by the W3C document RFC 3986. LibSBML 213 * does not provide an explicit XML <code>anyURI</code> data type; it uses 214 * ordinary character strings, which is easier for applications to 215 * support. LibSBML does, however, test for anyURI validity at 216 * various times, such as when reading in models from files and data 217 * streams. 218 * 219 * This method provides programs with the ability to test explicitly that 220 * the strings they create conform to the XML anyURI syntax. 221 * 222 * @param uri string to be checked for conformance to the syntax of 223 * <a target='_blank' 224 * href='http://www.w3.org/TR/xmlschema-2/#anyURI'>anyURI</a>. 225 * 226 * @return @c true if the string is a syntactically-valid value for the 227 * XML type <a target='_blank' 228 * href='http://www.w3.org/TR/xmlschema-2/#anyURI'>anyURI</a>, 229 * @c false otherwise. 230 * 231 * 232 * @if python @note Because this is a static method on a class, the Python 233 * language interface for libSBML will contain two variants. One will be the 234 * expected, normal static method on the class (i.e., a regular 235 * <em>methodName</em>), and the other will be a standalone top-level 236 * function with the name <em>ClassName_methodName()</em>. This is merely an 237 * artifact of how the language interfaces are created in libSBML. The 238 * methods are functionally identical. @endif 239 * 240 * 241 */ public isValidXMLanyURI(string uri)242 static bool isValidXMLanyURI(string uri) { 243 bool ret = libsbmlPINVOKE.SyntaxChecker_isValidXMLanyURI(uri); 244 return ret; 245 } 246 247 248 /** 249 * Returns @c true or @c false depending on whether the argument string 250 * conforms to the syntax of SBML unit identifiers. 251 * 252 * In SBML, the identifiers of units (of both the predefined units and 253 * user-defined units) must conform to a data type called 254 * <code>UnitSId</code> in the SBML specifications. LibSBML does not 255 * provide an explicit <code>UnitSId</code> data type; it uses ordinary 256 * character strings, which is easier for applications to support. 257 * LibSBML does, however, test for identifier validity at various times, 258 * such as when reading in models from files and data streams. 259 * 260 * This method provides programs with the ability to test explicitly that 261 * the identifier strings they create conform to the SBML identifier 262 * syntax. 263 * 264 * @param units string to be checked for conformance to SBML unit 265 * identifier syntax. 266 * 267 * @return @c true if the string conforms to type SBML data type 268 * <code>UnitSId</code>, @c false otherwise. 269 * 270 * @note @htmlinclude unitid-syntax.html 271 * 272 * 273 * @if python @note Because this is a static method on a class, the Python 274 * language interface for libSBML will contain two variants. One will be the 275 * expected, normal static method on the class (i.e., a regular 276 * <em>methodName</em>), and the other will be a standalone top-level 277 * function with the name <em>ClassName_methodName()</em>. This is merely an 278 * artifact of how the language interfaces are created in libSBML. The 279 * methods are functionally identical. @endif 280 * 281 * 282 * 283 * @see @if clike isValidSBMLSId(string sid) @else SyntaxChecker::isValidSBMLSId(string sid) @endif 284 * @see @if clike isValidXMLID(string sid) @else SyntaxChecker::isValidXMLID(string sid) @endif 285 */ public isValidUnitSId(string units)286 static bool isValidUnitSId(string units) { 287 bool ret = libsbmlPINVOKE.SyntaxChecker_isValidUnitSId(units); 288 return ret; 289 } 290 291 292 /** 293 * Returns @c true or @c false depending on whether the given XMLNode 294 * object contains valid XHTML content. 295 * 296 * 297 * 298 * The optional SBML element named 'notes', present on every major SBML 299 * component type (and in SBML Level 3, the 'message' subelement of 300 * Constraint), is intended as a place for storing optional information 301 * intended to be seen by humans. An example use of the 'notes' element 302 * would be to contain formatted user comments about the model element in 303 * which the 'notes' element is enclosed. Every object derived directly or 304 * indirectly from type SBase can have a separate value for 'notes', allowing 305 * users considerable freedom when adding comments to their models. 306 * 307 * The format of 'notes' elements conform to the definition of <a 308 * target='_blank' href='http://www.w3.org/TR/xhtml1/'>XHTML 1.0</a>. 309 * However, the content cannot be @em entirely free-form; it must satisfy 310 * certain requirements defined in the <a target='_blank' 311 * href='http://sbml.org/Documents/Specifications'>SBML specifications</a> 312 * for specific SBML Levels. To help verify the formatting of 'notes' 313 * content, libSBML provides the static utility method 314 * SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif); this 315 * method implements a verification process that lets callers check whether 316 * the content of a given XMLNode object conforms to the SBML requirements 317 * for 'notes' and 'message' structure. Developers are urged to consult the 318 * appropriate <a target='_blank' 319 * href='http://sbml.org/Documents/Specifications'>SBML specification 320 * document</a> for the Level and Version of their model for more in-depth 321 * explanations of using 'notes' in SBML. The SBML Level 2 and 3 322 * specifications have considerable detail about how 'notes' element content 323 * must be structured. 324 * 325 * 326 * 327 * An aspect of XHTML validity is that the content is declared to be in 328 * the XML namespace for XHTML 1.0. There is more than one way in 329 * which this can be done in XML. In particular, a model might not 330 * contain the declaration within the 'notes' or 'message' subelement 331 * itself, but might instead place the declaration on an enclosing 332 * element and use an XML namespace prefix within the 'notes' element to 333 * refer to it. In other words, the following is valid: 334 * @verbatim 335 <sbml xmlns='http://www.sbml.org/sbml/level2/version3' level='2' version='3' 336 xmlns:xhtml='http://www.w3.org/1999/xhtml'> 337 <model> 338 <notes> 339 <xhtml:body> 340 <xhtml:center><xhtml:h2>A Simple Mitotic Oscillator</xhtml:h2></xhtml:center> 341 <xhtml:p>A minimal cascade model for the mitotic oscillator.</xhtml:p> 342 </xhtml:body> 343 </notes> 344 ... rest of model ... 345 </sbml> 346 @endverbatim 347 * Contrast the above with the following, self-contained version, which 348 * places the XML namespace declaration within the <code><notes></code> 349 * element itself: 350 * @verbatim 351 <sbml xmlns='http://www.sbml.org/sbml/level2/version3' level='2' version='3'> 352 <model> 353 <notes> 354 <html xmlns='http://www.w3.org/1999/xhtml'> 355 <head> 356 <title/> 357 </head> 358 <body> 359 <center><h2>A Simple Mitotic Oscillator</h2></center> 360 <p>A minimal cascade model for the mitotic oscillator.</p> 361 </body> 362 </html> 363 </notes> 364 ... rest of model ... 365 </sbml> 366 @endverbatim 367 * 368 * Both of the above are valid XML. The purpose of the @p sbmlns 369 * argument to this method is to allow callers to check the validity of 370 * 'notes' and 'message' subelements whose XML namespace declarations 371 * have been put elsewhere in the manner illustrated above. Callers can 372 * can pass in the SBMLNamespaces object of a higher-level model 373 * component if the XMLNode object does not itself have the XML namespace 374 * declaration for XHTML 1.0. 375 * 376 * @param xhtml the XMLNode to be checked for conformance. 377 * @param sbmlns the SBMLNamespaces associated with the object. 378 * 379 * @return @c true if the XMLNode content conforms, @c false otherwise. 380 * 381 * 382 * @if python @note Because this is a static method on a class, the Python 383 * language interface for libSBML will contain two variants. One will be the 384 * expected, normal static method on the class (i.e., a regular 385 * <em>methodName</em>), and the other will be a standalone top-level 386 * function with the name <em>ClassName_methodName()</em>. This is merely an 387 * artifact of how the language interfaces are created in libSBML. The 388 * methods are functionally identical. @endif 389 * 390 * 391 * 392 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 393 */ public hasExpectedXHTMLSyntax(XMLNode xhtml, SBMLNamespaces sbmlns)394 static bool hasExpectedXHTMLSyntax(XMLNode xhtml, SBMLNamespaces sbmlns) { 395 bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_0(XMLNode.getCPtr(xhtml), SBMLNamespaces.getCPtr(sbmlns)); 396 return ret; 397 } 398 399 400 /** 401 * Returns @c true or @c false depending on whether the given XMLNode 402 * object contains valid XHTML content. 403 * 404 * 405 * 406 * The optional SBML element named 'notes', present on every major SBML 407 * component type (and in SBML Level 3, the 'message' subelement of 408 * Constraint), is intended as a place for storing optional information 409 * intended to be seen by humans. An example use of the 'notes' element 410 * would be to contain formatted user comments about the model element in 411 * which the 'notes' element is enclosed. Every object derived directly or 412 * indirectly from type SBase can have a separate value for 'notes', allowing 413 * users considerable freedom when adding comments to their models. 414 * 415 * The format of 'notes' elements conform to the definition of <a 416 * target='_blank' href='http://www.w3.org/TR/xhtml1/'>XHTML 1.0</a>. 417 * However, the content cannot be @em entirely free-form; it must satisfy 418 * certain requirements defined in the <a target='_blank' 419 * href='http://sbml.org/Documents/Specifications'>SBML specifications</a> 420 * for specific SBML Levels. To help verify the formatting of 'notes' 421 * content, libSBML provides the static utility method 422 * SyntaxChecker::hasExpectedXHTMLSyntax(@if java XMLNode@endif); this 423 * method implements a verification process that lets callers check whether 424 * the content of a given XMLNode object conforms to the SBML requirements 425 * for 'notes' and 'message' structure. Developers are urged to consult the 426 * appropriate <a target='_blank' 427 * href='http://sbml.org/Documents/Specifications'>SBML specification 428 * document</a> for the Level and Version of their model for more in-depth 429 * explanations of using 'notes' in SBML. The SBML Level 2 and 3 430 * specifications have considerable detail about how 'notes' element content 431 * must be structured. 432 * 433 * 434 * 435 * An aspect of XHTML validity is that the content is declared to be in 436 * the XML namespace for XHTML 1.0. There is more than one way in 437 * which this can be done in XML. In particular, a model might not 438 * contain the declaration within the 'notes' or 'message' subelement 439 * itself, but might instead place the declaration on an enclosing 440 * element and use an XML namespace prefix within the 'notes' element to 441 * refer to it. In other words, the following is valid: 442 * @verbatim 443 <sbml xmlns='http://www.sbml.org/sbml/level2/version3' level='2' version='3' 444 xmlns:xhtml='http://www.w3.org/1999/xhtml'> 445 <model> 446 <notes> 447 <xhtml:body> 448 <xhtml:center><xhtml:h2>A Simple Mitotic Oscillator</xhtml:h2></xhtml:center> 449 <xhtml:p>A minimal cascade model for the mitotic oscillator.</xhtml:p> 450 </xhtml:body> 451 </notes> 452 ... rest of model ... 453 </sbml> 454 @endverbatim 455 * Contrast the above with the following, self-contained version, which 456 * places the XML namespace declaration within the <code><notes></code> 457 * element itself: 458 * @verbatim 459 <sbml xmlns='http://www.sbml.org/sbml/level2/version3' level='2' version='3'> 460 <model> 461 <notes> 462 <html xmlns='http://www.w3.org/1999/xhtml'> 463 <head> 464 <title/> 465 </head> 466 <body> 467 <center><h2>A Simple Mitotic Oscillator</h2></center> 468 <p>A minimal cascade model for the mitotic oscillator.</p> 469 </body> 470 </html> 471 </notes> 472 ... rest of model ... 473 </sbml> 474 @endverbatim 475 * 476 * Both of the above are valid XML. The purpose of the @p sbmlns 477 * argument to this method is to allow callers to check the validity of 478 * 'notes' and 'message' subelements whose XML namespace declarations 479 * have been put elsewhere in the manner illustrated above. Callers can 480 * can pass in the SBMLNamespaces object of a higher-level model 481 * component if the XMLNode object does not itself have the XML namespace 482 * declaration for XHTML 1.0. 483 * 484 * @param xhtml the XMLNode to be checked for conformance. 485 * @param sbmlns the SBMLNamespaces associated with the object. 486 * 487 * @return @c true if the XMLNode content conforms, @c false otherwise. 488 * 489 * 490 * @if python @note Because this is a static method on a class, the Python 491 * language interface for libSBML will contain two variants. One will be the 492 * expected, normal static method on the class (i.e., a regular 493 * <em>methodName</em>), and the other will be a standalone top-level 494 * function with the name <em>ClassName_methodName()</em>. This is merely an 495 * artifact of how the language interfaces are created in libSBML. The 496 * methods are functionally identical. @endif 497 * 498 * 499 * 500 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 501 */ public hasExpectedXHTMLSyntax(XMLNode xhtml)502 static bool hasExpectedXHTMLSyntax(XMLNode xhtml) { 503 bool ret = libsbmlPINVOKE.SyntaxChecker_hasExpectedXHTMLSyntax__SWIG_1(XMLNode.getCPtr(xhtml)); 504 return ret; 505 } 506 507 508 /** */ /* libsbml-internal */ public isValidInternalSId(string sid)509 static bool isValidInternalSId(string sid) { 510 bool ret = libsbmlPINVOKE.SyntaxChecker_isValidInternalSId(sid); 511 return ret; 512 } 513 514 515 /** */ /* libsbml-internal */ public isValidInternalUnitSId(string sid)516 static bool isValidInternalUnitSId(string sid) { 517 bool ret = libsbmlPINVOKE.SyntaxChecker_isValidInternalUnitSId(sid); 518 return ret; 519 } 520 SyntaxChecker()521 public SyntaxChecker() : this(libsbmlPINVOKE.new_SyntaxChecker(), true) { 522 } 523 524 } 525 526 } 527