mirror of
https://github.com/jezhiggins/arabica
synced 2024-11-17 07:48:50 +01:00
extended to take std::auto_ptr<iostream> as well as std::auto_ptr<std::istream>
This commit is contained in:
parent
0dd9e4f728
commit
f900c435e6
2 changed files with 34 additions and 0 deletions
|
@ -169,6 +169,7 @@ public:
|
|||
*
|
||||
*/
|
||||
explicit IStreamHandle(std::auto_ptr<std::istream> is);
|
||||
explicit IStreamHandle(std::auto_ptr<std::iostream> is);
|
||||
|
||||
/** Construct an IStreamHandle sharing a std::istream with <em>rhs</em>.
|
||||
*
|
||||
|
@ -224,6 +225,7 @@ public:
|
|||
*
|
||||
*/
|
||||
IStreamHandle& operator=(std::auto_ptr<std::istream> rhs);
|
||||
IStreamHandle& operator=(std::auto_ptr<std::iostream> rhs);
|
||||
|
||||
/** Assign a new std::istream to <code>this</code>. This destroys the
|
||||
* std::istream held by <code>this</code> if <code>this</code> <i>owns</i>
|
||||
|
@ -303,6 +305,17 @@ IStreamHandle::IStreamHandle(std::auto_ptr<std::istream> is)
|
|||
ISTREAMHANDLE_POSTCONDITION(is.get() == 0);
|
||||
}
|
||||
|
||||
inline
|
||||
IStreamHandle::IStreamHandle(std::auto_ptr<std::iostream> is)
|
||||
: is_(is.release()),
|
||||
counter_(new int(0)),
|
||||
owner_(true)
|
||||
{
|
||||
addRef();
|
||||
ISTREAMHANDLE_POSTCONDITION(*counter_ == 1);
|
||||
ISTREAMHANDLE_POSTCONDITION(is.get() == 0);
|
||||
}
|
||||
|
||||
inline
|
||||
IStreamHandle::IStreamHandle(const IStreamHandle& rhs)
|
||||
: is_(rhs.is_),
|
||||
|
@ -350,6 +363,19 @@ IStreamHandle& IStreamHandle::operator=(std::auto_ptr<std::istream> rhs)
|
|||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
IStreamHandle& IStreamHandle::operator=(std::auto_ptr<std::iostream> rhs)
|
||||
{
|
||||
removeRef();
|
||||
set(rhs.release(), true);
|
||||
|
||||
ISTREAMHANDLE_POSTCONDITION(*counter_ == 1);
|
||||
ISTREAMHANDLE_POSTCONDITION(owner_ == true);
|
||||
ISTREAMHANDLE_POSTCONDITION(rhs.get() == 0);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
IStreamHandle& IStreamHandle::operator=(std::istream& rhs)
|
||||
{
|
||||
|
|
|
@ -141,6 +141,14 @@ public:
|
|||
systemId_(),
|
||||
encoding_()
|
||||
{ }
|
||||
|
||||
basic_InputSource(std::auto_ptr<std::iostream> byteStream) :
|
||||
byteStream_(byteStream),
|
||||
publicId_(),
|
||||
systemId_(),
|
||||
encoding_()
|
||||
{ }
|
||||
|
||||
|
||||
virtual ~basic_InputSource() { }
|
||||
|
||||
|
|
Loading…
Reference in a new issue