001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 2.0.11
004 *
005 * Do not make changes to this file unless you know what you are doing--modify
006 * the SWIG interface file instead.
007 * ----------------------------------------------------------------------------- */
008
009package org.sbml.libsbml;
010
011/** 
012 * Wrapper class for the C++ standard stream <code>ostringstream</code>.
013 * <p>
014 * The C++ <code>ostringstream</code> ('output string stream class')
015 * provides an interface to manipulating strings as if they were output
016 * streams.  This class class, {@link OStringStream}, wraps the
017 * <code>ostringstream</code> and provides an {@link OStream} interface to it.
018 * <p>
019 * This class may be useful because some libSBML methods accept an argument
020 * for indicating where to send text string output.  An example is the 
021 * {@link SBMLDocument#printErrors(OStream stream)} method.  The methods use
022 * C++ style streams and not Java stream objects.  The {@link OStream} object
023 * exists to bridge the Java and underlying native implementation.  It is a
024 * simple wrapper around the underlying stream object and provides a few
025 * basic methods for manipulating it.
026 */
027
028public class OStringStream extends OStream {
029   private long swigCPtr;
030
031   protected OStringStream(long cPtr, boolean cMemoryOwn)
032   {
033     super(libsbmlJNI.OStringStream_SWIGUpcast(cPtr), cMemoryOwn);
034     swigCPtr = cPtr;
035   }
036
037   protected static long getCPtr(OStringStream obj)
038   {
039     return (obj == null) ? 0 : obj.swigCPtr;
040   }
041
042   protected static long getCPtrAndDisown (OStringStream obj)
043   {
044     long ptr = 0;
045
046     if (obj != null)
047     {
048       ptr             = obj.swigCPtr;
049       obj.swigCMemOwn = false;
050     }
051
052     return ptr;
053   }
054
055  protected void finalize() {
056    delete();
057  }
058
059  public synchronized void delete() {
060    if (swigCPtr != 0) {
061      if (swigCMemOwn) {
062        swigCMemOwn = false;
063        libsbmlJNI.delete_OStringStream(swigCPtr);
064      }
065      swigCPtr = 0;
066    }
067    super.delete();
068  }
069
070  
071/**
072     * Creates a new {@link OStringStream} object
073     */ public
074 OStringStream() {
075    this(libsbmlJNI.new_OStringStream(), true);
076  }
077
078  
079/**
080     * Returns the copy of the string object currently assosiated 
081     * with this <code>ostringstream</code> buffer.
082     * <p>
083     * @return a copy of the string object for this stream
084     */ public
085 String str() {
086    return libsbmlJNI.OStringStream_str__SWIG_0(swigCPtr, this);
087  }
088
089  
090/**
091     * Sets string <code>s</code> to the string object currently assosiated with
092     * this stream buffer.
093     * <p>
094     * @param s the string to write to this stream
095     */ public
096 void str(String s) {
097    libsbmlJNI.OStringStream_str__SWIG_1(swigCPtr, this, s);
098  }
099
100}