This is a simple class that provides a string full of spaces. This string may be used to avoid repeated memory allocations/initializations and/or repeated method invocations when a software interfaces to libraries that either allow to write a string or a single character (i.e. std::ostream
).
Definition at line 25 of file spaces.hpp.
#include <spaces.hpp>
Public Static Method Index: | |
static String & | Get (integer minLength=128) |
static ALIB_API NString & | GetN (integer minLength=128) |
static ALIB_API WString & | GetW (integer minLength=128) |
static ALIB_API void | Write (std::basic_ostream< char > &os, integer qty) |
static ALIB_API void | Write (std::basic_ostream< wchar_t > &os, integer qty) |
Receives a narrow string full of spaces. Its length depends on previous calls and on parameter minLength
, which defaults to 128
and usually should not be specified much higher.
minLength | The minimum length. Defaults to 128 . |
Definition at line 58 of file spaces.hpp.
Receives a narrow string full of spaces. Its length depends on previous calls and on parameter minLength
, which defaults to 128
and usually should not be specified much higher.
minLength | The minimum length. Defaults to 128 . |
Definition at line 31 of file spaces.cpp.
Receives a narrow string full of spaces. Its length depends on previous calls and on parameter minLength
, which defaults to 128
and usually should not be specified much higher.
minLength | The minimum length. Defaults to 128 . |
Definition at line 39 of file spaces.cpp.
|
static |
Write the given number of spaces to the narrow-character ostream.
os | The output stream to write to. |
qty | The quantity of spaces to write. |
Definition at line 49 of file spaces.cpp.
Write the given number of spaces to the ostream of type wchar_t
.
true
(1). This is due to the fact that otherwise, the internal wide string buffer of spaces is either of type char16_t
or char32_t
, the one of both that is incompatible with output streams of character type wchar_t
.os | The output stream to write to. |
qty | The quantity of spaces to write. |