ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
Spaces Class Reference

Description:


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 StringGet (integer minLength=128)
 
static ALIB_API NStringGetN (integer minLength=128)
 
static ALIB_API WStringGetW (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)
 

Method Details:

◆ Get()

static String & Get ( integer minLength = 128)
inlinestatic

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.

Parameters
minLengthThe minimum length. Defaults to 128.
Returns
A static string filled with spaces.

Definition at line 58 of file spaces.hpp.

Here is the call graph for this function:

◆ GetN()

NString & GetN ( integer minLength = 128)
static

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.

Parameters
minLengthThe minimum length. Defaults to 128.
Returns
A static string filled with spaces.

Definition at line 31 of file spaces.cpp.

Here is the call graph for this function:

◆ GetW()

WString & GetW ( integer minLength = 128)
static

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.

Parameters
minLengthThe minimum length. Defaults to 128.
Returns
A static string filled with spaces.

Definition at line 39 of file spaces.cpp.

Here is the call graph for this function:

◆ Write() [1/2]

void Write ( std::basic_ostream< char > & os,
integer qty )
static

Write the given number of spaces to the narrow-character ostream.

Parameters
osThe output stream to write to.
qtyThe quantity of spaces to write.

Definition at line 49 of file spaces.cpp.

Here is the call graph for this function:

◆ Write() [2/2]

static ALIB_API void Write ( std::basic_ostream< wchar_t > & os,
integer qty )
static

Write the given number of spaces to the ostream of type wchar_t.

Availability
This method is available only if compiler symbol ALIB_CHARACTERS_NATIVE_WCHAR evaluates to 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.
Consequently, this method must not be used (and replaced by a custom implementation) in the case that a software is supposed to compile successfully with a non-default setting of compiler symbol ALIB_CHARACTERS_SIZEOF_WCHAR.
Parameters
osThe output stream to write to.
qtyThe quantity of spaces to write.

The documentation for this class was generated from the following files: