10#ifndef HPP_ALIB_COMPATIBILITY_STD_STRINGS_IOSTREAM
11#define HPP_ALIB_COMPATIBILITY_STD_STRINGS_IOSTREAM 1
13#if !defined(HPP_ALIB) && !defined(ALIB_DOX)
19#if !defined(HPP_ALIB_COMPATIBILITY_STD_CHARACTERS)
23#if !defined (_GLIBCXX_IOSTREAM ) && !defined(_IOSTREAM_)
27#if !defined (HPP_ALIB_STRINGS_LOCALSTRING)
32namespace alib {
namespace strings {
namespace compatibility {
namespace std {
55#define ALIB_STRINGS_SUPPRESS_STD_OSTREAM_OPERATOR(TYPE) \
56 namespace alib::strings::compatibility::std { \
57 template<> struct T_SuppressStdOstreamOperator<TYPE> : ::std::true_type {}; }
86template<
typename TChar>
135 namespace APPENDABLES {
143template<
typename TChar>
struct T_Append<compatibility::std::TISReadLine<TChar>, TChar>
166namespace compatibility {
namespace std {
205 : ostream( &::std::cout )
247 if( ostream ==
nullptr )
249 ALIB_WARNING(
"STRINGS",
"StringWriter::WriteAndGetWideLength: No output stream")
264 if( ostream ==
nullptr )
266 ALIB_WARNING(
"STRINGS",
"StringWriter::WriteAndGetWideLength: No output stream")
270 converter.
Reset( src );
271 ostream->write( converter.
Buffer(), converter.
Length() );
290 if( ostream ==
nullptr )
292 ALIB_WARNING(
"STRINGS",
"StringWriter::WriteAndGetWideLength: No output stream")
304 if( ostream ==
nullptr )
306 ALIB_WARNING(
"STRINGS",
"StringWriter::WriteAndGetWideLength: No output stream")
309 converter.
Reset( src );
310 ostream->write( converter.
Buffer(), converter.
Length() );
337 : readOp( &::std::cin )
371 target.
Reset( readOp );
383 converter.
Reset( readOp );
407 namespace strings {
namespace compatibility {
namespace std {
422 if (
string.IsNotEmpty() )
423 stream.write(
string.Buffer(),
string.Length() );
437 stream->write(
string.Buffer(),
string.Length() );
510 if (
string.IsNotEmpty() )
512 #if ALIB_CHARACTERS_NATIVE_WCHAR
513 stream.write(
string.Buffer(),
string.Length() );
548 string << alib::strings::compatibility::std::TISReadLine<alib::nchar>( &stream,
566 if (stream !=
nullptr)
567 string << alib::strings::compatibility::std::TISReadLine<alib::nchar>( stream,
590inline std::basic_istream<wchar_t>&
operator>>( std::basic_istream<wchar_t>& stream,
593 #if ALIB_CHARACTERS_NATIVE_WCHAR
594 string << alib::strings::compatibility::std::TISReadLine<wchar_t>( &stream,
599 converter << alib::strings::compatibility::std::TISReadLine<wchar_t>( &stream,
601 string.Reset( converter );
619inline std::basic_istream<wchar_t>*
operator>>( std::basic_istream<wchar_t>* stream,
624 if (stream !=
nullptr)
641template<
typename TAppendable,
642 typename TEnableIf=
typename std::enable_if< alib::strings::TT_IsAppendable<TAppendable,alib::nchar>::value
645std::ostream&
operator<<( std::ostream& stream,
const TAppendable& appendable )
666template<
typename TAppendable,
667 typename TEnableIf=
typename std::enable_if< alib::strings::TT_IsAppendable<TAppendable,alib::nchar>::value
671std::ostream*
operator<<( std::ostream* stream,
const TAppendable& appendable )
673 if (stream !=
nullptr)
689template<
typename TAppendable,
690 typename TEnableIf=
typename std::enable_if< alib::strings::TT_IsAppendable<TAppendable,alib::wchar>::value
694std::wostream&
operator<<( std::wostream& stream,
const TAppendable& appendable )
696 #if ALIB_CHARACTERS_NATIVE_WCHAR
719template<
typename TAppendable,
720 typename TEnableIf=
typename std::enable_if< alib::strings::TT_IsAppendable<TAppendable,alib::wchar>::value
723std::wostream*
operator<<( std::wostream* stream,
const TAppendable& appendable )
725 if (stream !=
nullptr)
733 }}
namespace APPENDABLES {
735 namespace alib {
namespace strings {
TAString & _(const TString< TChar > &src, integer regionStart, integer regionLength=MAX_LEN)
void DbgDisableBufferReplacementWarning()
constexpr bool IsNotEmpty() const
constexpr integer Length() const
constexpr const TChar * Buffer() const
integer WStringLength() const
void Read(NAString &target)
void SetStream(::std::istream *is)
::std::istream * GetStream()
void Read(WAString &target)
compatibility::std::TISReadLine< nchar > readOp
::std::ostream * GetStream()
void SetStream(::std::ostream *os)
integer WriteAndGetWideLength(const NString &src)
integer WriteAndGetWideLength(const WString &src)
void Write(const NString &src)
void Write(const WString &src)
#define ALIB_WARNING(...)
#define ALIB_ASSERT_MODULE(modulename)
#define ALIB_STRINGS_SUPPRESS_STD_OSTREAM_OPERATOR(TYPE)
#define ALIB_ASSERT_WARNING(cond,...)
@ Keep
Chooses not no clear existing data.
@ Clear
Chooses to clear existing data.
std::ostream & operator<<(std::ostream &stream, const alib::NString &string)
std::istream & operator>>(std::istream &stream, alib::NAString &string)
lang::integer integer
Type alias in namespace alib.
void operator()(TAString< TChar > &target, const compatibility::std::TISReadLine< TChar > &reader)
TISReadLine(::std::basic_istream< TChar > *istream, lang::CurrentData targetData=lang::CurrentData::Clear, integer bufferSize=256, integer maxLineWidth=4096)
::std::basic_istream< TChar > * IStream
lang::CurrentData TargetData