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 Log of diagnostics reported during XML processing. 20 * 21 * @htmlinclude not-sbml-warning.html 22 * 23 * The error log is a list. The XML layer of libSBML maintains an error 24 * log associated with a given XML document or data stream. When an 25 * operation results in an error, or when there is something wrong with the 26 * XML content, the problem is reported as an XMLError object stored in the 27 * XMLErrorLog list. Potential problems range from low-level issues (such 28 * as the inability to open a file) to XML syntax errors (such as 29 * mismatched tags or other problems). 30 * 31 * A typical approach for using this error log is to first use 32 * @if java XMLErrorLog::getNumErrors()@else getNumErrors()@endif 33 * to inquire how many XMLError object instances it contains, and then to 34 * iterate over the list of objects one at a time using 35 * getError(unsigned int n) . Indexing in the list begins at 0. 36 * 37 * In normal circumstances, programs using libSBML will actually obtain an 38 * SBMLErrorLog rather than an XMLErrorLog. The former is subclassed from 39 * XMLErrorLog and simply wraps commands for working with SBMLError objects 40 * rather than the low-level XMLError objects. Classes such as 41 * SBMLDocument use the higher-level SBMLErrorLog. 42 */ 43 44 public class XMLErrorLog : global::System.IDisposable { 45 private HandleRef swigCPtr; 46 protected bool swigCMemOwn; 47 XMLErrorLog(IntPtr cPtr, bool cMemoryOwn)48 internal XMLErrorLog(IntPtr cPtr, bool cMemoryOwn) 49 { 50 swigCMemOwn = cMemoryOwn; 51 swigCPtr = new HandleRef(this, cPtr); 52 } 53 getCPtr(XMLErrorLog obj)54 internal static HandleRef getCPtr(XMLErrorLog obj) 55 { 56 return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; 57 } 58 getCPtrAndDisown(XMLErrorLog obj)59 internal static HandleRef getCPtrAndDisown (XMLErrorLog obj) 60 { 61 HandleRef ptr = new HandleRef(null, IntPtr.Zero); 62 63 if (obj != null) 64 { 65 ptr = obj.swigCPtr; 66 obj.swigCMemOwn = false; 67 } 68 69 return ptr; 70 } 71 ~XMLErrorLog()72 ~XMLErrorLog() { 73 Dispose(false); 74 } 75 Dispose()76 public void Dispose() { 77 Dispose(true); 78 global::System.GC.SuppressFinalize(this); 79 } 80 Dispose(bool disposing)81 protected virtual void Dispose(bool disposing) { 82 lock(this) { 83 if (swigCPtr.Handle != global::System.IntPtr.Zero) { 84 if (swigCMemOwn) { 85 swigCMemOwn = false; 86 libsbmlPINVOKE.delete_XMLErrorLog(swigCPtr); 87 } 88 swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero); 89 } 90 } 91 } 92 operator ==(XMLErrorLog lhs, XMLErrorLog rhs)93 public static bool operator==(XMLErrorLog lhs, XMLErrorLog rhs) 94 { 95 if((Object)lhs == (Object)rhs) 96 { 97 return true; 98 } 99 100 if( ((Object)lhs == null) || ((Object)rhs == null) ) 101 { 102 return false; 103 } 104 105 return (getCPtr(lhs).Handle.ToString() == getCPtr(rhs).Handle.ToString()); 106 } 107 operator !=(XMLErrorLog lhs, XMLErrorLog rhs)108 public static bool operator!=(XMLErrorLog lhs, XMLErrorLog rhs) 109 { 110 return !(lhs == rhs); 111 } 112 Equals(Object sb)113 public override bool Equals(Object sb) 114 { 115 if ( ! (sb is XMLErrorLog) ) 116 { 117 return false; 118 } 119 120 return this == (XMLErrorLog)sb; 121 } 122 GetHashCode()123 public override int GetHashCode() 124 { 125 return swigCPtr.Handle.ToInt32(); 126 } 127 128 129 /** 130 * Returns the number of errors that have been logged. 131 * 132 * To retrieve individual errors from the log, callers may use 133 * @if clike getError() @else XMLErrorLog::getError(unsigned int n) @endif. 134 * 135 * @return the number of errors that have been logged. 136 */ public getNumErrors()137 long getNumErrors() { return (long)libsbmlPINVOKE.XMLErrorLog_getNumErrors(swigCPtr); } 138 139 140 /** 141 * Returns the <i>n</i>th XMLError object in this log. 142 * 143 * Index @p n is counted from 0. Callers should first inquire about the 144 * number of items in the log by using the method 145 * @if java XMLErrorLog::getNumErrors()@else getNumErrors()@endif. 146 * Attempts to use an error index number that exceeds the actual number 147 * of errors in the log will result in a @c null being returned. 148 * 149 * @param n the index number of the error to retrieve (with 0 being the 150 * first error). 151 * 152 * @return the <i>n</i>th XMLError in this log, or @c null if @p n is 153 * greater than or equal to 154 * @if java XMLErrorLog::getNumErrors()@else getNumErrors()@endif. 155 * 156 * @see getNumErrors() 157 */ public getError(long n)158 XMLError getError(long n) { 159 global::System.IntPtr cPtr = libsbmlPINVOKE.XMLErrorLog_getError(swigCPtr, n); 160 XMLError ret = (cPtr == global::System.IntPtr.Zero) ? null : new XMLError(cPtr, false); 161 return ret; 162 } 163 164 165 /** 166 * Deletes all errors from this log. 167 */ public clearLog()168 void clearLog() { 169 libsbmlPINVOKE.XMLErrorLog_clearLog(swigCPtr); 170 } 171 172 173 /** */ /* libsbml-internal */ public XMLErrorLog()174 XMLErrorLog() : this(libsbmlPINVOKE.new_XMLErrorLog__SWIG_0(), true) { 175 } 176 177 178 /** */ /* libsbml-internal */ public XMLErrorLog(XMLErrorLog other)179 XMLErrorLog(XMLErrorLog other) : this(libsbmlPINVOKE.new_XMLErrorLog__SWIG_1(XMLErrorLog.getCPtr(other)), true) { 180 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 181 } 182 183 184 /** */ /* libsbml-internal */ public add(XMLError error)185 void add(XMLError error) { 186 libsbmlPINVOKE.XMLErrorLog_add__SWIG_0(swigCPtr, XMLError.getCPtr(error)); 187 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 188 } 189 190 191 /** */ /* libsbml-internal */ public add(SWIGTYPE_p_std__vectorT_XMLError_p_t errors)192 void add(SWIGTYPE_p_std__vectorT_XMLError_p_t errors) { 193 libsbmlPINVOKE.XMLErrorLog_add__SWIG_1(swigCPtr, SWIGTYPE_p_std__vectorT_XMLError_p_t.getCPtr(errors)); 194 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 195 } 196 197 198 /** 199 * Writes all errors contained in this log to a string and returns it. 200 * 201 * This method uses printErrors() to format the diagnostic messages. 202 * Please consult that method for information about the organization 203 * of the messages in the string returned by this method. 204 * 205 * @return a string containing all logged errors and warnings. 206 * 207 * @see printErrors() 208 */ public toString()209 string toString() { 210 string ret = libsbmlPINVOKE.XMLErrorLog_toString(swigCPtr); 211 return ret; 212 } 213 214 215 /** 216 * Prints all the errors or warnings stored in this error log. 217 * 218 * This method prints the text to the stream given by the optional 219 * parameter @p stream. If no stream is given, the method prints the 220 * output to the standard error stream. 221 * 222 * The format of the output is: 223 * @verbatim 224 N error(s): 225 line NNN: (id) message 226 @endverbatim 227 * If no errors have occurred, i.e., 228 * <code>getNumErrors() == 0</code>, then no output will be produced. 229 230 * @param stream the ostream or ostringstream object indicating where 231 * the output should be printed. 232 * 233 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 234 */ public printErrors(OStream stream)235 void printErrors(OStream stream) { 236 libsbmlPINVOKE.XMLErrorLog_printErrors__SWIG_0(swigCPtr, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream())); 237 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 238 } 239 240 241 /** 242 * Prints all the errors or warnings stored in this error log. 243 * 244 * This method prints the text to the stream given by the optional 245 * parameter @p stream. If no stream is given, the method prints the 246 * output to the standard error stream. 247 * 248 * The format of the output is: 249 * @verbatim 250 N error(s): 251 line NNN: (id) message 252 @endverbatim 253 * If no errors have occurred, i.e., 254 * <code>getNumErrors() == 0</code>, then no output will be produced. 255 256 * @param stream the ostream or ostringstream object indicating where 257 * the output should be printed. 258 * 259 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 260 */ public printErrors()261 void printErrors() { 262 libsbmlPINVOKE.XMLErrorLog_printErrors__SWIG_1(swigCPtr); 263 } 264 265 266 /** 267 * Prints the errors or warnings with given severity stored in this error log. 268 * 269 * This method prints the text to the stream given by the optional 270 * parameter @p stream. If no stream is given, the method prints the 271 * output to the standard error stream. 272 * 273 * The format of the output is: 274 * @verbatim 275 N error(s): 276 line NNN: (id) message 277 @endverbatim 278 * If no errors with that severity was found, then no output will be produced. 279 * 280 * @param stream the ostream or ostringstream object indicating where 281 * the output should be printed. 282 * @param severity the severity of the errors sought. 283 * 284 */ public printErrors(OStream stream, long severity)285 void printErrors(OStream stream, long severity) { 286 libsbmlPINVOKE.XMLErrorLog_printErrors__SWIG_2(swigCPtr, SWIGTYPE_p_std__ostream.getCPtr(stream.get_ostream()), severity); 287 if (libsbmlPINVOKE.SWIGPendingException.Pending) throw libsbmlPINVOKE.SWIGPendingException.Retrieve(); 288 } 289 290 291 /** 292 * Returns a boolean indicating whether or not the severity has been 293 * overridden. 294 * 295 * 296 * 297 * The <em>severity override</em> mechanism in XMLErrorLog is intended to help 298 * applications handle error conditions in ways that may be more convenient 299 * for those applications. It is possible to use the mechanism to override 300 * the severity code of errors logged by libSBML, and even to disable error 301 * logging completely. An override stays in effect until the override is 302 * changed again by the calling application. 303 * 304 * @return @c true if an error severity override has been set, @c false 305 * otherwise. 306 * 307 * @see getSeverityOverride() 308 * @see setSeverityOverride(@if java int@endif) 309 * @see unsetSeverityOverride() 310 * @see changeErrorSeverity(@if java int, int, String@endif) 311 */ public isSeverityOverridden()312 bool isSeverityOverridden() { 313 bool ret = libsbmlPINVOKE.XMLErrorLog_isSeverityOverridden(swigCPtr); 314 return ret; 315 } 316 317 318 /** 319 * Usets an existing override. 320 * 321 * 322 * 323 * The <em>severity override</em> mechanism in XMLErrorLog is intended to help 324 * applications handle error conditions in ways that may be more convenient 325 * for those applications. It is possible to use the mechanism to override 326 * the severity code of errors logged by libSBML, and even to disable error 327 * logging completely. An override stays in effect until the override is 328 * changed again by the calling application. 329 * 330 * @see getSeverityOverride() 331 * @see setSeverityOverride(@if java int@endif) 332 * @see isSeverityOverridden() 333 * @see changeErrorSeverity(@if java int, int, String@endif) 334 */ public unsetSeverityOverride()335 void unsetSeverityOverride() { 336 libsbmlPINVOKE.XMLErrorLog_unsetSeverityOverride(swigCPtr); 337 } 338 339 340 /** 341 * Returns the current override. 342 * 343 * 344 * 345 * The <em>severity override</em> mechanism in XMLErrorLog is intended to help 346 * applications handle error conditions in ways that may be more convenient 347 * for those applications. It is possible to use the mechanism to override 348 * the severity code of errors logged by libSBML, and even to disable error 349 * logging completely. An override stays in effect until the override is 350 * changed again by the calling application. 351 * 352 * @return a severity override code. The possible values are drawn 353 * from @if clike the enumeration #XMLErrorSeverityOverride_t@else the 354 * set of integer constants whose names begin with the prefix 355 * <code>LIBSBML_OVERRIDE_</code>@endif: 356 * @li @link libsbml#LIBSBML_OVERRIDE_DISABLED LIBSBML_OVERRIDE_DISABLED@endlink 357 * @li @link libsbml#LIBSBML_OVERRIDE_DONT_LOG LIBSBML_OVERRIDE_DONT_LOG@endlink 358 * @li @link libsbml#LIBSBML_OVERRIDE_WARNING LIBSBML_OVERRIDE_WARNING@endlink 359 * 360 * @see isSeverityOverridden() 361 * @see setSeverityOverride(@if java int@endif) 362 * @see unsetSeverityOverride() 363 * @see changeErrorSeverity(@if java int, int, String@endif) 364 */ public getSeverityOverride()365 int getSeverityOverride() { 366 int ret = libsbmlPINVOKE.XMLErrorLog_getSeverityOverride(swigCPtr); 367 return ret; 368 } 369 370 371 /** 372 * Set the severity override. 373 * 374 * 375 * 376 * The <em>severity override</em> mechanism in XMLErrorLog is intended to help 377 * applications handle error conditions in ways that may be more convenient 378 * for those applications. It is possible to use the mechanism to override 379 * the severity code of errors logged by libSBML, and even to disable error 380 * logging completely. An override stays in effect until the override is 381 * changed again by the calling application. 382 * 383 * @param severity an override code indicating what to do. If the value is 384 * @link libsbml#LIBSBML_OVERRIDE_DISABLED LIBSBML_OVERRIDE_DISABLED@endlink 385 * (the default setting) all errors logged will be given the severity 386 * specified in their usual definition. If the value is 387 * @link libsbml#LIBSBML_OVERRIDE_WARNING LIBSBML_OVERRIDE_WARNING@endlink, 388 * then all errors will be logged as warnings. If the value is 389 * @link libsbml#LIBSBML_OVERRIDE_DONT_LOG LIBSBML_OVERRIDE_DONT_LOG@endlink, 390 * no error will be logged, regardless of their severity. 391 * 392 * @see isSeverityOverridden() 393 * @see getSeverityOverride() 394 * @see unsetSeverityOverride() 395 * @see changeErrorSeverity(@if java int, int, String@endif) 396 */ public setSeverityOverride(int severity)397 void setSeverityOverride(int severity) { 398 libsbmlPINVOKE.XMLErrorLog_setSeverityOverride(swigCPtr, severity); 399 } 400 401 402 /** 403 * Changes the severity override for errors in the log that have a given 404 * severity. 405 * 406 * This method searches through the list of errors in the log, comparing 407 * each one's severity to the value of @p originalSeverity. For each error 408 * encountered with that severity logged by the named @p package, the 409 * severity of the error is reset to @p targetSeverity. 410 * 411 * 412 * 413 * The <em>severity override</em> mechanism in XMLErrorLog is intended to help 414 * applications handle error conditions in ways that may be more convenient 415 * for those applications. It is possible to use the mechanism to override 416 * the severity code of errors logged by libSBML, and even to disable error 417 * logging completely. An override stays in effect until the override is 418 * changed again by the calling application. 419 * 420 * @param originalSeverity the severity code to match. 421 * 422 * @param targetSeverity the severity code to use as the new severity. 423 * 424 * @param package a string, the name of an SBML Level 3 package 425 * extension to use to narrow the search for errors. A value of @c 'all' 426 * signifies to match against errors logged from any package; a value of a 427 * package nickname such as @c 'comp' signifies to limit consideration to 428 * errors from just that package. If no value is provided, @c 'all' is the 429 * default. 430 * 431 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 432 * 433 * @see isSeverityOverridden() 434 * @see getSeverityOverride() 435 * @see setSeverityOverride(@if java int@endif) 436 * @see unsetSeverityOverride() 437 */ public changeErrorSeverity(int originalSeverity, int targetSeverity, string package)438 void changeErrorSeverity(int originalSeverity, int targetSeverity, string package) { 439 libsbmlPINVOKE.XMLErrorLog_changeErrorSeverity__SWIG_0(swigCPtr, originalSeverity, targetSeverity, package); 440 } 441 442 443 /** 444 * Changes the severity override for errors in the log that have a given 445 * severity. 446 * 447 * This method searches through the list of errors in the log, comparing 448 * each one's severity to the value of @p originalSeverity. For each error 449 * encountered with that severity logged by the named @p package, the 450 * severity of the error is reset to @p targetSeverity. 451 * 452 * 453 * 454 * The <em>severity override</em> mechanism in XMLErrorLog is intended to help 455 * applications handle error conditions in ways that may be more convenient 456 * for those applications. It is possible to use the mechanism to override 457 * the severity code of errors logged by libSBML, and even to disable error 458 * logging completely. An override stays in effect until the override is 459 * changed again by the calling application. 460 * 461 * @param originalSeverity the severity code to match. 462 * 463 * @param targetSeverity the severity code to use as the new severity. 464 * 465 * @param package a string, the name of an SBML Level 3 package 466 * extension to use to narrow the search for errors. A value of @c 'all' 467 * signifies to match against errors logged from any package; a value of a 468 * package nickname such as @c 'comp' signifies to limit consideration to 469 * errors from just that package. If no value is provided, @c 'all' is the 470 * default. 471 * 472 * @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif 473 * 474 * @see isSeverityOverridden() 475 * @see getSeverityOverride() 476 * @see setSeverityOverride(@if java int@endif) 477 * @see unsetSeverityOverride() 478 */ public changeErrorSeverity(int originalSeverity, int targetSeverity)479 void changeErrorSeverity(int originalSeverity, int targetSeverity) { 480 libsbmlPINVOKE.XMLErrorLog_changeErrorSeverity__SWIG_1(swigCPtr, originalSeverity, targetSeverity); 481 } 482 483 484 /** 485 * Returns @c true if XMLErrorLog contains an errorId 486 * 487 * @param errorId the error identifier of the error to be found. 488 */ public contains(long errorId)489 bool contains(long errorId) { 490 bool ret = libsbmlPINVOKE.XMLErrorLog_contains(swigCPtr, errorId); 491 return ret; 492 } 493 494 } 495 496 } 497