InputSource.cpp

Go to the documentation of this file.
00001 // -*- C++ -*- InputSource.cpp,v 1.8 2003/05/30 03:31:48 kitty Exp
00002 
00003 #include "ACEXML/common/InputSource.h"
00004 #include "ACEXML/common/StreamFactory.h"
00005 #include "ace/ACE.h"
00006 #include "ace/Swap.h"
00007 
00008 ACEXML_InputSource::ACEXML_InputSource (void)
00009   : charStream_ (0),
00010     encoding_ (0),
00011     publicId_ (0),
00012     systemId_ (0)
00013 {
00014 }
00015 
00016 ACEXML_InputSource::ACEXML_InputSource (ACEXML_CharStream *stm)
00017   : charStream_ (stm),
00018     encoding_ (ACE::strnew (stm->getEncoding())),
00019     publicId_ (0),
00020     systemId_ (stm->getSystemId() ? ACE::strnew (stm->getSystemId()): 0)
00021 {
00022 }
00023 
00024   /*
00025    * Create a new input source with a character stream.
00026    *
00027   */
00028 
00029 ACEXML_InputSource::ACEXML_InputSource (const ACEXML_Char *systemId)
00030   : charStream_ (0),
00031     encoding_ (0),
00032     publicId_ (0),
00033     systemId_ (ACE::strnew (systemId))
00034 {
00035   ACEXML_StreamFactory factory;
00036   ACEXML_CharStream* stm = factory.create_stream (this->systemId_);
00037   if (stm)
00038     {
00039       this->setCharStream (stm);
00040       this->setEncoding (this->charStream_->getEncoding());
00041     }
00042 }
00043 
00044 ACEXML_InputSource::~ACEXML_InputSource (void)
00045 {
00046   delete[] this->publicId_;
00047   this->publicId_ = 0;
00048   delete[] this->systemId_;
00049   this->systemId_ = 0;
00050   delete this->charStream_;
00051   this->charStream_ = 0;
00052   delete[] this->encoding_;
00053   this->encoding_ = 0;
00054 }
00055 
00056 ACEXML_CharStream *
00057 ACEXML_InputSource::getCharStream (void) const
00058 {
00059   return this->charStream_;
00060 }
00061 
00062 const ACEXML_Char *
00063 ACEXML_InputSource::getEncoding (void) const
00064 {
00065   return this->encoding_;
00066 }
00067 
00068 const ACEXML_Char *
00069 ACEXML_InputSource::getPublicId (void) const
00070 {
00071   return this->publicId_;
00072 }
00073 
00074 const ACEXML_Char *
00075 ACEXML_InputSource::getSystemId (void) const
00076 {
00077   return this->systemId_;
00078 }
00079 
00080 void
00081 ACEXML_InputSource::setCharStream (ACEXML_CharStream *stm)
00082 {
00083   delete this->charStream_;
00084   this->charStream_ = stm;
00085 }
00086 
00087 void
00088 ACEXML_InputSource::setEncoding (const ACEXML_Char *encoding)
00089 {
00090   delete[] this->encoding_;
00091   this->encoding_ = ACE::strnew (encoding);
00092 }
00093 
00094 void
00095 ACEXML_InputSource::setPublicId (const ACEXML_Char *publicId)
00096 {
00097   delete[] this->publicId_;
00098   this->publicId_ = ACE::strnew (publicId);
00099 }
00100 
00101 void
00102 ACEXML_InputSource::setSystemId (const ACEXML_Char *systemId)
00103 {
00104   delete[] this->systemId_;
00105   this->systemId_ = ACE::strnew (systemId);
00106 }

Generated on Thu Nov 9 11:45:37 2006 for ACEXML by doxygen 1.3.6