Use =default for skeleton copy constructor
[ACE_TAO.git] / ACE / ACEXML / common / InputSource.cpp
bloba18405223bf23938966e4407ddd73a2ae654f766
1 // -*- C++ -*-
3 #include "ACEXML/common/InputSource.h"
4 #include "ACEXML/common/StreamFactory.h"
5 #include "ace/ACE.h"
7 ACEXML_InputSource::ACEXML_InputSource ()
8 : charStream_ (0),
9 encoding_ (0),
10 publicId_ (0),
11 systemId_ (0)
15 ACEXML_InputSource::ACEXML_InputSource (ACEXML_CharStream *stm)
16 : charStream_ (stm),
17 encoding_ (ACE::strnew (stm->getEncoding())),
18 publicId_ (0),
19 systemId_ (stm->getSystemId() ? ACE::strnew (stm->getSystemId()): 0)
24 * Create a new input source with a character stream.
28 ACEXML_InputSource::ACEXML_InputSource (const ACEXML_Char *systemId)
29 : charStream_ (0),
30 encoding_ (0),
31 publicId_ (0),
32 systemId_ (ACE::strnew (systemId))
34 ACEXML_StreamFactory factory;
35 ACEXML_CharStream* stm = factory.create_stream (this->systemId_);
36 if (stm)
38 this->setCharStream (stm);
39 this->setEncoding (this->charStream_->getEncoding());
43 ACEXML_InputSource::~ACEXML_InputSource ()
45 delete[] this->publicId_;
46 this->publicId_ = 0;
47 delete[] this->systemId_;
48 this->systemId_ = 0;
49 delete this->charStream_;
50 this->charStream_ = 0;
51 delete[] this->encoding_;
52 this->encoding_ = 0;
55 ACEXML_CharStream *
56 ACEXML_InputSource::getCharStream () const
58 return this->charStream_;
61 const ACEXML_Char *
62 ACEXML_InputSource::getEncoding () const
64 return this->encoding_;
67 const ACEXML_Char *
68 ACEXML_InputSource::getPublicId () const
70 return this->publicId_;
73 const ACEXML_Char *
74 ACEXML_InputSource::getSystemId () const
76 return this->systemId_;
79 void
80 ACEXML_InputSource::setCharStream (ACEXML_CharStream *stm)
82 delete this->charStream_;
83 this->charStream_ = stm;
86 void
87 ACEXML_InputSource::setEncoding (const ACEXML_Char *encoding)
89 delete[] this->encoding_;
90 this->encoding_ = ACE::strnew (encoding);
93 void
94 ACEXML_InputSource::setPublicId (const ACEXML_Char *publicId)
96 delete[] this->publicId_;
97 this->publicId_ = ACE::strnew (publicId);
100 void
101 ACEXML_InputSource::setSystemId (const ACEXML_Char *systemId)
103 delete[] this->systemId_;
104 this->systemId_ = ACE::strnew (systemId);