ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
stdiostream.mpp
Go to the documentation of this file.
1//==================================================================================================
2/// \file
3/// This header-file is part of the \aliblong.
4/// With supporting legacy or module builds, .mpp-files are either recognized by the build-system
5/// as C++20 Module interface files, or are included by the
6/// \ref alib_manual_modules_impludes "import/include headers".
7///
8/// \emoji :copyright: 2013-2025 A-Worx GmbH, Germany.
9/// Published under \ref mainpage_license "Boost Software License".
10//==================================================================================================
11#if !defined(ALIB_C20_MODULES) || ((ALIB_C20_MODULES != 0) && (ALIB_C20_MODULES != 1))
12# error "Symbol ALIB_C20_MODULES has to be given to the compiler as either 0 or 1"
13#endif
14#if ALIB_C20_MODULES
15 module;
16#endif
17// ====================================== Global Fragment ======================================
19
20#include <string>
21#include <string_view>
22#include <vector>
23#include <iostream>
24
25// =========================================== Module ==========================================
26#if ALIB_C20_MODULES
27 /// This is a C++ Module of the \aliblong. Due to the dual-compile option - as either
28 /// C++20 Modules or legacy C++ inclusion, the C++20 Module names are not of further interest
29 /// or use.<br>
30 /// In general, the names equal the names of the header files listed in the chapter
31 /// \ref alib_manual_modules_impludes of the \alib User Manual.
32 /// This chapter, among others, provides further explanations.
33 export module ALib.Strings.StdIOStream;
34 import ALib.Lang;
35# if ALIB_STRINGS
36 import ALib.Strings;
37# endif
38#else
39# include "ALib.Lang.H"
40# include "ALib.Strings.H"
41#endif
42
43// ========================================== Exports ==========================================
45ALIB_EXPORT namespace alib { namespace strings { namespace compatibility { namespace std {
46
47//==================================================================================================
48/// This template type may be specialized to suppress ambiguities for types \p{T} which
49/// - have <c>std::operator<<(ostream, const T&)</c> defined, \b and
50/// - are \ref alib_strings_assembly_ttostring "appendable" to \alib strings.
51///
52/// \note
53/// The ambiguity occurs due to the definition of <c>std::operator<<</c> for all appendable
54/// types.
55///
56/// If a specialization of this template struct exists that inherits <c>std::true_type</c>,
57/// the compiler will not choose the \alib implementation of the operator, which resolves the
58/// ambiguity.
59///
60/// \see
61/// Specialization might be done with macro
62/// \ref ALIB_STRINGS_SUPPRESS_STD_OSTREAM_OPERATOR.
63///
64/// @tparam T The appendable type to suppress
65//==================================================================================================
66template<typename T> struct SuppressStdOStreamOpTraits : ::std::false_type {};
67
68//==================================================================================================
69/// Parameter class used to append to objects of type \alib{strings;TAString;AString}, which
70/// invokes the method of the according specialization of template struct
71/// <b>AppendableTraits<ISReadLine,TChar,HeapAllocator></b>.<br>
72/// This then reads a line of text from the encapsulated \b std::istream and appends that line to the
73/// target \b %AString.
74///
75/// This class can be created 'inline', similar to, for example,
76/// \ref alib_strings_assembly_ttostring_builtin "special types appendable to" class \b AString.
77/// But in the common cases, where a series of lines are to be read from a \b std::istream, a local
78/// object of this type should be created.
79/// In the case of a reading-loop, it is efficient to place it outside such a loop.
80///
81/// Field #IsEOF can be used to detect the end of the input stream.
82///
83/// \see
84/// - \alib{strings;compatibility::std::operator>>(std::istream&;NAString& string)} and
85/// \alib{strings;compatibility::std::operator<<(std::ostream&;const NString&)}.
86/// - For a sample, refer to the source code of \alib class \b %IniFile, method
87/// \alib{variables;IniFile::Read}.
88///
89///
90/// @tparam TChar The character type of the input stream as well as the receiving string.<br>
91/// Specializations for character types \alib{characters;nchar},
92/// \alib{characters;wchar} exist. Those have corresponding alias type definition
93/// shortcuts \alib{ISReadLineN} and \alib{ISReadLineW} in namespace #alib.
94//==================================================================================================
95template<typename TChar>
97{
98 /// The input stream to read from.
99 ::std::basic_istream<TChar>* IStream;
100
101 /// If \c CurrentData::KEEP, the target \c %AString is not cleared before the read operation.
103
104 /// The amount of characters that the buffer is increased while reading parts of the line.
106
107 /// The maximum length of a single line to be read. Longer lines get truncated.
109
110 /// Indicates if the end of the input stream was detected with the last read operation.
111 /// If so, a next read operation will not change the string (or clear it, if #TargetData is
112 /// \c false
113 bool IsEOF = false;
114
115 //==============================================================================================
116 /// Constructor.
117 ///
118 /// @param istream The input stream to read from.
119 /// @param targetData If \c CurrentData::Keep, the target \c %AString is not cleared
120 /// before the read operation is performed.
121 /// Defaults to \c CurrentData::Clear.
122 /// @param bufferSize The amount of characters that the buffer is increased while reading
123 /// parts of the line. Defaults to 256 characters.
124 /// @param maxLineWidth The maximum length of a single line to be read. Longer lines
125 /// get truncated. Defaults to 4096 characters.
126 //==============================================================================================
127 TISReadLine( ::std::basic_istream<TChar>* istream,
129 integer bufferSize = 256,
130 integer maxLineWidth = 4096 )
131 : IStream (istream),
132 TargetData (targetData),
133 BufferSize (bufferSize),
134 MaxLineWidth(maxLineWidth)
135 {}
136};
137
138
139}} // namespace alib::strings[::compatibility::std]
140
141#if DOXYGEN
142 namespace APPENDABLES {
143#endif
144
145/// Specialization of the type trait \alib{strings;AppendableTraits} for type
146/// \alib{strings::compatibility::std;TISReadLine}.
147/// @tparam TChar The <b>AString</b>'s \ref alib_characters_chars "character type".
148template<typename TChar> struct AppendableTraits<compatibility::std::TISReadLine<TChar>, TChar, lang::HeapAllocator>
149{
150 //==============================================================================================
151 /// Reads a line from a text file and appends the contents to \p{target}.
152 /// If the end of the input stream was reached, field
153 /// \alib{strings::compatibility::std::TISReadLine;IsEOF} of parameter \p{reader} will be set
154 /// to \c true, which indicates that the next read operation would fail if it was performed.
155 ///
156 /// \note
157 /// For setting field <em>IsEOF</em> the object will be cast to a non-constant reference.
158 /// See functor \alib{strings;AppendableTraits} for an explanation why it is OK to do so.
159 ///
160 /// @param target The AString object to read into.
161 /// @param reader The object holding the \b std::istream and some parameters.
162 //==============================================================================================
165};
166
167#if DOXYGEN
168}
169#endif
170
171namespace compatibility { namespace std {
172
173//==================================================================================================
174/// This class is a simple helper-class that converts strings of the
175/// \alib{characters;character;default character type} to narrow strings as expected by
176/// \c std::ostream objects.
177///
178/// The basic goal of this class is to avoid preprocessor directives for code selection when
179/// the default string-type of \alib uses wide characters.
180///
181/// For example, to write string data into a file, the following approach is advised:
182///
183/// 1. Create an output stream of (derived) type \c std::ostream.
184/// 2. Create an object of this class and pass the output stream via #SetStream.
185/// 3. Write string data stored in objects of platform-dependent type alias \ref alib::AString
186/// by passing those to method #Write.
187///
188/// Within step 3, the compiler chooses the right overloaded version of the method #Write.
189/// Hence, the potentially necessary conversion of the string data is done transparently and only
190/// if needed.
191///
192/// \see Class \alib{strings::compatibility::std;StringReader}.
193//==================================================================================================
195{
196 protected:
197 /// The string buffer used for conversion.
199
200 public:
201 /// The output stream as provided with #SetStream. Will be set to the \c std::cout,
202 /// respectively \c std::wcout in the constructor.
203 ::std::ostream* ostream;
204
205 public:
206 //==========================================================================================
207 /// Constructor.
208 /// Invokes #SetStream passing \c std::cout.
209 //==========================================================================================
211 : ostream( &::std::cout )
212 {}
213
214
215 //==========================================================================================
216 /// Sets the output stream.
217 ///
218 /// @param os Pointer to the output stream to write to.
219 //==========================================================================================
220 void SetStream( ::std::ostream * os) { ostream= os; }
221
222 //==========================================================================================
223 /// Returns the output stream previously set with #SetStream.
224 ///
225 /// @return The output stream set with #SetStream.
226 //==========================================================================================
227 ::std::ostream* GetStream() { return ostream; }
228
229 //==========================================================================================
230 /// Write the given narrow string to the stream and return the length of the string given
231 /// if it was converted to wide characters.
232 ///
233 /// \note
234 /// The return value is the length of the given string if it was converted to wide string,
235 /// even though in this overloaded version it is unnecessary to be converted.
236 /// This is useful to determine the "real" output width when an output text is formatted.
237 /// Of course, in many locales, this is still not the real output width because even
238 /// uni-code characters are not guaranteed to represent exactly one printable character.
239 /// But still, this value is already a much better approximation than the length of the
240 /// given narrow string.
241 ///
242 /// @param src The string to write.
243 /// @return Returns the length of the given string as wide string.
244 //==========================================================================================
247
248 //==========================================================================================
249 /// Write the given wide string to the stream and returns the length of the string given
250 /// @param src The string to write.
251 /// @return Returns the length of the given wide string.
252 //==========================================================================================
255
256 //==========================================================================================
257 /// Write the given narrow string to the stream.
258 /// @param src The string to write.
259 //==========================================================================================
261 void Write( const NString& src );
262
263 //==========================================================================================
264 /// Write the given narrow character repeatedly to the stream.
265 /// @param fillChar The character to write.
266 /// @param count The number of characters to write.
267 //==========================================================================================
269 void WriteChars( const nchar fillChar, integer count );
270
271 //==========================================================================================
272 /// Write the given wide string to the stream.
273 /// @param src The string to write.
274 //==========================================================================================
276 void Write( const WString& src );
277};
278
279//==================================================================================================
280/// This class is a helper-class that converts narrow string data read from an object of
281/// type \c std::istream to the \alib{characters;character;default character type}.
282///
283/// \see Further explanations are given with sibling class
284/// \alib{strings::compatibility::std;StringWriter}.
285//==================================================================================================
287{
288 protected:
289 /// The string buffer used for conversion.
291
292 /// The input stream as provided with #SetStream. Will be set to the \c std::cin,
293 /// respectively \c std::win in the constructor.
295
296
297 public:
298 //==========================================================================================
299 /// Constructor.Invokes #SetStream passing \c std::cin.
300 //==========================================================================================
302 : readOp( &::std::cin )
303 {}
304
305
306 //==========================================================================================
307 /// Sets the input stream.
308 ///
309 /// @param is Pointer to the input stream to read from to.
310 //==========================================================================================
311 void SetStream( ::std::istream* is ) { readOp.IStream= is;}
312
313 //==========================================================================================
314 /// Returns the input stream previously set with #SetStream.
315 ///
316 /// @return The input stream set with #SetStream.
317 //==========================================================================================
318 ::std::istream* GetStream() { return readOp.IStream; }
319
320 //==========================================================================================
321 /// Returns \c true if the input stream signaled its end, \c false otherwise.
322 ///
323 /// @return \c true if the input stream is known to be at its end, \c false otherwise.
324 //==========================================================================================
325 bool IsEOF() { return readOp.IsEOF; }
326
327
328 //==========================================================================================
329 /// Reads one line of text from the input stream into a narrow string.
330 ///
331 /// @param target The storage buffer for the string to read. This string will be cleared
332 /// independent of the availability of input data.
333 //==========================================================================================
334 void Read( NAString& target )
335 {
336 target.Reset( readOp );
337 }
338
339 //==========================================================================================
340 /// Reads one line of text from the internal input stream into a wide string.
341 ///
342 /// @param target The storage buffer for the string to read. This string will be cleared
343 /// independent of the availability of input data.
344 //==========================================================================================
345 void Read( WAString& target )
346 {
347 target.Reset();
348 converter.Reset( readOp );
349 target << converter;
350 }
351};
352
353}}} // namespace alib[::strings::compatibility::std]
354
355/// Type alias in namespace \b alib.
357
358/// Type alias in namespace \b alib.
360
361/// Type alias in namespace \b alib.
363
364/// Type alias in namespace \b alib.
366
367/// Type alias in namespace \b alib.
369
370
371// #################################################################################################
372// #################### std::ostream& operator<< ###############################
373// #################################################################################################
374#if DOXYGEN
375 namespace strings { namespace compatibility { namespace std {
376#else
377} // namespace [alib]
378#endif
379
380//==================================================================================================
381/// Copies the contents of the given \b %NString to into the \c std::ostream given as reference.
382///
383/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
384/// @param stream The ostream object to write the given String into.
385/// @param string The String to write into the given ostream.
386/// @returns The ostream to allow concatenated operations.
387//==================================================================================================
389inline std::ostream& operator<<( std::ostream& stream, const alib::NString& string )
390{
391 if ( string.IsNotEmpty() )
392 stream.write( string.Buffer(), string.Length() );
393 return stream;
394}
395
396//==================================================================================================
397/// Copies the contents of the given \b %NString to into the \c std::ostream given as pointer.
398///
399/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
400/// @param stream The ostream object to write the given String into.
401/// @param string The String to write into the given ostream.
402/// @returns The ostream to allow concatenated operations.
403//==================================================================================================
405inline std::ostream* operator<<( std::ostream* stream, const alib::NString& string )
406{
407 stream->write( string.Buffer(), string.Length() );
408 return stream;
409}
410
411//==================================================================================================
412/// Copies the contents of the given \b %WString to into the \c std::ostream given as reference.
413///
414/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
415/// @param stream The ostream object to write the given String into.
416/// @param string The String to write into the given ostream.
417/// @returns The ostream to allow concatenated operations.
418//==================================================================================================
420ALIB_DLL std::ostream& operator<<( std::ostream& stream, const alib::WString& string );
421
422//==================================================================================================
423/// Copies the contents of the given \b %WString to into the \c std::ostream given as pointer.
424///
425/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
426/// @param stream The ostream object to write the given String into.
427/// @param string The String to write into the given ostream.
428/// @returns The ostream to allow concatenated operations.
429//==================================================================================================
431inline std::ostream* operator<<( std::ostream* stream, const alib::WString& string )
432{
433 (*stream) << string;
434 return stream;
435}
436
437//==================================================================================================
438/// Copies the contents of the given \b %NString to into the \c std::wostream given as reference.
439///
440/// \note
441/// This operator uses a local string buffer of 256 bytes size to convert the given narrow string
442/// to an string of \c wchar_t characters that the output stream accepts. In case that
443/// the given \p{string} is larger, a dynamic memory allocation has to be made.<br>
444/// In performance-critical code that writes larger string data, a custom conversion method,
445/// that for example reuses a buffer, may be appropriate.
446///
447/// <p>
448/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
449/// @param stream The ostream object to write the given String into.
450/// @param string The String to write into the given ostream.
451/// @returns The ostream to allow concatenated operations.
452//==================================================================================================
454ALIB_DLL std::wostream& operator<<( std::wostream& stream, const alib::NString& string );
455
456//==================================================================================================
457/// Copies the contents of the given \b %NString to into the \c std::wostream given as pointer.
458///
459/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
460/// \see The notes on memory efficiency, documented with operator
461/// \alib{strings::compatibility::std;operator<<(std::wostream&,const NString&)}
462/// which this operator uses inline.
463/// @param stream The ostream object to write the given String into.
464/// @param string The String to write into the given ostream.
465/// @returns The ostream to allow concatenated operations.
466//==================================================================================================
468inline std::wostream* operator<<( std::wostream* stream, const alib::NString& string )
469{
470 (*stream) << string;
471 return stream;
472}
473
474//==================================================================================================
475/// Copies the contents of the given \b %WString to into the \c std::wostream given as reference.
476///
477/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
478/// @param stream The ostream object to write the given String into.
479/// @param string The String to write into the given ostream.
480/// @returns The ostream to allow concatenated operations.
481//==================================================================================================
483inline std::wostream& operator<<( std::wostream& stream, const alib::WString& string )
484{
485 if ( string.IsNotEmpty() )
486 {
487 #if ALIB_CHARACTERS_NATIVE_WCHAR
488 stream.write( string.Buffer(), string.Length() );
489 #else
490 alib::XLocalString<1024> converter( string );
492 stream.write( converter.Buffer(), converter.Length() );
493 #endif
494 }
495 return stream;
496}
497
498//==================================================================================================
499/// Copies the contents of the given \b %WString to into the \c std::wostream given as pointer.
500///
501/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
502/// @param stream The ostream object to write the given String into.
503/// @param string The String to write into the given ostream.
504/// @returns The ostream to allow concatenated operations.
505//==================================================================================================
507inline std::wostream* operator<<( std::wostream* stream, const alib::WString& string )
508{
509 (*stream) << string;
510 return stream;
511}
512
513//==================================================================================================
514/// Clears the given \b %NAString and extracts data from the std::istream into it. The extractions
515/// ends with either the end of the std::istream or when reading a newline character.
516///
517/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
518/// @param stream The istream object to extract data from.
519/// @param string The AString to receive data.
520/// @returns The ostream to allow concatenated operations.
521//==================================================================================================
523inline std::istream& operator>>( std::istream& stream, alib::NAString& string )
524{
525 string << alib::strings::compatibility::std::TISReadLine<alib::nchar>( &stream,
527 return stream;
528}
529
530//==================================================================================================
531/// Clears the given \b %NAString and extracts data from the std::istream into it. The extractions
532/// ends with either the end of the std::istream or when reading a newline character.
533///
534/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
535/// @param stream The istream object to extract data from.
536/// @param string The AString to receive data.
537/// @returns The ostream to allow concatenated operations.
538//==================================================================================================
540inline std::istream* operator>>( std::istream* stream, alib::NAString& string )
541{
542 ALIB_ASSERT_WARNING( stream != nullptr, "STRINGS", "Given std::IStream is nullptr" )
543
544 if (stream != nullptr)
545 string << alib::strings::compatibility::std::TISReadLine<alib::nchar>( stream,
547 return stream;
548}
549
550//==================================================================================================
551/// Clears the given \b %WAString and extracts data from the std::istream into it. The extractions
552/// ends with either the end of the std::istream or when reading a newline character.
553///
554/// \note
555/// If code selection symbol \ref ALIB_CHARACTERS_NATIVE_WCHAR evaluates to false, a local buffer
556/// is used to convert the string of \c wchar_t characters that the input stream provides.
557/// In case that the string read from the stream is larger, a dynamic memory allocation has to
558/// be made.<br>
559/// In performance-critical code that receives larger string data, a custom conversion method
560/// that, for example, reuses a buffer may be appropriate.
561///
562/// <p>
563/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
564/// @param stream The istream object to extract data from.
565/// @param string The AString to receive data.
566/// @returns The ostream to allow concatenated operations.
567//==================================================================================================
569inline std::basic_istream<wchar_t>& operator>>( std::basic_istream<wchar_t>& stream,
570 alib::WAString& string )
571{
572 #if ALIB_CHARACTERS_NATIVE_WCHAR
573 string << alib::strings::compatibility::std::TISReadLine<wchar_t>( &stream,
575 #else
576 alib::XLocalString<1024> converter;
578 converter << alib::strings::compatibility::std::TISReadLine<wchar_t>( &stream,
580 string.Reset( converter );
581 #endif
582 return stream;
583}
584
585//==================================================================================================
586/// Clears the given \b %WAString and extracts data from the std::istream into it. The extractions
587/// ends with either the end of the std::istream or when reading a newline character.
588///
589/// \note Unlike this documentation indicates, the operator is defined in the global namespace.
590///
591/// \see The notes on memory efficiency, documented with operator
592/// \alib{strings::compatibility::std;operator>>(std::basic_istream<wchar_t>&, WAString& )}
593/// which this operator uses inline.
594/// @param stream The istream object to extract data from.
595/// @param string The AString to receive data.
596/// @returns The ostream to allow concatenated operations.
597//==================================================================================================
599inline std::basic_istream<wchar_t>* operator>>( std::basic_istream<wchar_t>* stream,
600 alib::WAString& string )
601{
602 ALIB_ASSERT_WARNING ( stream != nullptr, "STRINGS", "Given std::istream is nullptr" )
603
604 if (stream != nullptr)
605 (*stream) >> string;
606 return stream;
607}
608
609
610//==================================================================================================
611/// Copies the contents of the given \ref alib_strings_assembly_ttostring "appendable type"
612/// the \c std::ostream given as reference.
613///
614/// \note Unlike this documentation indicates, this operator is defined in the global namespace.
615///
616/// @tparam TAppendable The appendable type.
617/// @param stream The \c std::ostream object to write the given String into.
618/// @param appendable The object whose contents is to be written into the given \p{stream}.
619/// @returns The ostream to allow concatenated operations.
620//==================================================================================================
622template<typename TAppendable>
625std::ostream& operator<<( std::ostream& stream, const TAppendable& appendable )
626{
629
630 if ( buf._(appendable).IsNotEmpty() )
631 stream.write( buf.Buffer(), buf.Length() );
632 return stream;
633}
634
635//==================================================================================================
636/// Copies the contents of the given \alib{strings;AppendableTraits;appendable type} the \c std::ostream
637/// given as pointer.
638///
639/// \note Unlike this documentation indicates, this operator is defined in the global namespace.
640///
641/// @tparam TAppendable The appendable type.
642/// @param stream The \c std::ostream object to write the given String into.
643/// @param appendable The object whose contents is to be written into the given \p{stream}.
644/// @returns The ostream to allow concatenated operations.
645//==================================================================================================
647template<typename TAppendable>
650std::ostream* operator<<( std::ostream* stream, const TAppendable& appendable )
651{
652 if (stream != nullptr)
653 operator<<( * stream, appendable );
654 return stream;
655}
656
657//==================================================================================================
658/// Copies the contents of the given \alib{strings;AppendableTraits;appendable type} the \c std::ostream
659/// given as reference.
660///
661/// \note Unlike this documentation indicates, this operator is defined in the global namespace.
662///
663/// @tparam TAppendable The appendable type.
664/// @param stream The \c std::ostream object to write the given String into.
665/// @param appendable The object whose contents is to be written into the given \p{stream}.
666/// @returns The ostream to allow concatenated operations.
667//==================================================================================================
669template<typename TAppendable>
672std::wostream& operator<<( std::wostream& stream, const TAppendable& appendable )
673{
674 #if ALIB_CHARACTERS_NATIVE_WCHAR
676 #else
678 #endif
680
681 if ( buf._(appendable).IsNotEmpty() )
682 stream.write( buf.Buffer(), buf.Length() );
683 return stream;
684}
685
686//==================================================================================================
687/// Copies the contents of the given \alib{strings;AppendableTraits;appendable type} the \c std::ostream
688/// given as pointer.
689///
690/// \note Unlike this documentation indicates, this operator is defined in the global namespace.
691///
692/// @tparam TAppendable The appendable type.
693/// @tparam TAllocator The allocator type, as prototyped with \alib{lang;Allocator}.
694/// @param stream The \c std::ostream object to write the given String into.
695/// @param appendable The object whose contents is to be written into the given \p{stream}.
696/// @returns The ostream to allow concatenated operations.
697//==================================================================================================
699template<typename TAppendable, typename TAllocator>
702std::wostream* operator<<( std::wostream* stream, const TAppendable& appendable )
703{
704 if (stream != nullptr)
705 operator<<( * stream, appendable );
706 return stream;
707}
708
709
710
711#if DOXYGEN
712 }} namespace APPENDABLES {
713#else
715namespace alib { namespace strings { // the real namespace
716#endif
717
718
720 ::operator()( TAString<char , lang::HeapAllocator>& target, const strings::compatibility::std::TISReadLine<char >& reader );
721
723 ::operator()( TAString<wchar_t, lang::HeapAllocator>& target, const strings::compatibility::std::TISReadLine<wchar_t>& reader );
724
725#if DOXYGEN
726 }} // namespace alib[::strings::APPENDABLES]
727#else
728 } // namespace alib[::strings]
729#endif
730
731} // namespace [alib]
732#include "ALib.Lang.CIMethods.H"
733
739
745
746
747
TAString & _(const TAppendable &src)
void DbgDisableBufferReplacementWarning()
Definition tastring.inl:245
constexpr integer Length() const
Definition string.inl:318
constexpr bool IsNotEmpty() const
Definition string.inl:371
constexpr const TChar * Buffer() const
Definition string.inl:313
compatibility::std::TISReadLine< nchar > readOp
NAString converter
The string buffer used for conversion.
StringReader()
Constructor.Invokes SetStream passing std::cin.
NAString converter
The string buffer used for conversion.
ALIB_DLL integer WriteAndGetWideLength(const NString &src)
ALIB_DLL integer WriteAndGetWideLength(const WString &src)
ALIB_DLL void Write(const WString &src)
ALIB_DLL void WriteChars(const nchar fillChar, integer count)
ALIB_DLL void Write(const NString &src)
#define ALIB_DLL
Definition alib.inl:496
#define ALIB_ASSERT_WARNING(cond, domain,...)
Definition alib.inl:1050
#define ALIB_STRINGS_SUPPRESS_STD_OSTREAM_OPERATOR(TYPE)
#define ALIB_EXPORT
Definition alib.inl:488
@ Keep
Chooses not no clear existing data.
@ Clear
Chooses to clear existing data.
ALIB_EXPORT std::istream & operator>>(std::istream &stream, alib::NAString &string)
ALIB_EXPORT std::ostream & operator<<(std::ostream &stream, const alib::NString &string)
strings::TAString< wchar, lang::HeapAllocator > WAString
Type alias in namespace alib.
strings::compatibility::std::TISReadLine< wchar_t > ISReadLineW
Type alias in namespace alib.
strings::compatibility::std::TISReadLine< char > ISReadLineN
Type alias in namespace alib.
strings::compatibility::std::TISReadLine< character > ISReadLine
Type alias in namespace alib.
lang::integer integer
Type alias in namespace alib.
Definition integers.inl:149
strings::TString< nchar > NString
Type alias in namespace alib.
Definition string.inl:2390
strings::TAString< nchar, lang::HeapAllocator > NAString
Type alias in namespace alib.
strings::TString< wchar > WString
Type alias in namespace alib.
Definition string.inl:2393
characters::nchar nchar
Type alias in namespace alib.
strings::TLocalString< xchar, TCapacity, lang::HeapAllocator > XLocalString
Type alias in namespace alib.
strings::compatibility::std::StringWriter StringWriter
Type alias in namespace alib.
strings::compatibility::std::StringReader StringReader
Type alias in namespace alib.
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256>.
strings::TLocalString< wchar, TCapacity, lang::HeapAllocator > WLocalString
Type alias in namespace alib.
void operator()(TAString< TChar, lang::HeapAllocator > &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)