/*

cls_2: Curl Like Syntax
Yauheni A. Akhotnikau (C) 2001-2003
eao197@yahoo.com
-------------------------------------------------

Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:

1. This software is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2. The origin of this software must not be misrepresented, either by
   explicit claim or by omission.

3. Altered versions must be plainly marked as such, and must not be
   misrepresented as being the original software.

-------------------------------------------------

*/
#include <cassert>
#include <cstring>

#include <cls_2/std_cpp/h/es_ios.hpp>

namespace cls_2 {

namespace std_cpp {

/*
** es_ios_t
*/
es_ios_t::es_ios_t() :
	m_stream( &std::cerr ) {
}

es_ios_t::es_ios_t(
	std::ostream * stream ) :
	m_stream( stream ) {

	assert( m_stream );
}

es_ios_t::~es_ios_t() {
}

std::ostream *
es_ios_t::set_stream(
	std::ostream * stream ) {
	std::ostream * old = m_stream;

	m_stream = stream;

	return old;
}

error_stream_t &
es_ios_t::out( const char * str ) {
	if( m_stream ) {
		*m_stream << ( str ? str : "NULL" );
	}

	return *this;
}

} /* namespace std_cpp */

} /* namespace cls_2 */
