SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Public Attributes | Related Functions
RWBasicUString::Pad Class Reference

Inserts the contents of a Unicode string into an output stream, padding it with a designated fill character. More...

#include <rw/tools/bustring.h>

Inheritance diagram for RWBasicUString::Pad:
RWUString::Pad

Public Member Functions

 Pad (const Pad &source)
 
 Pad (const RWBasicUString &ustr, RWUChar32 codePoint=RWBasicUString::DefaultFillCharacter)
 

Public Attributes

RWUChar32 codePoint_
 
const RWUChar16data_
 
size_t length_
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &os, const RWBasicUString::Pad &pad)
 

Detailed Description

Defines an iostream manipulator that can be used to insert the contents of a Unicode string into an output stream, padding the Unicode string with a specified fill character until the entire width() of the output stream has been filled with code points.

If the length of the Unicode string is greater than the width() of the output stream, or if the width() of the output stream is zero, the entire contents of the Unicode string is inserted into the stream and no padding occurs.

A Pad instance is only valid as long as the source string remains unchanged. Do not create persistent instances of this class. It should only be instantiated as a temporary in an insertion expression.

RWBasicUString ustr = ...;
std::cout << RWBasicUString::Pad(ustr,static_cast<RWUChar32>('.')) << std::endl;

Constructor & Destructor Documentation

RWBasicUString::Pad::Pad ( const Pad source)
inline

Constructs a copy of source.

RWBasicUString::Pad::Pad ( const RWBasicUString ustr,
RWUChar32  codePoint = RWBasicUString::DefaultFillCharacter 
)
inline

Constructs a manipulator instance. The default fill character, specified in the second parameter, is the Unicode space character.

Friends And Related Function Documentation

std::ostream & operator<< ( std::ostream &  os,
const RWBasicUString::Pad pad 
)
related

Writes the sequence of bytes that are produced when the contents of the RWBasicUString used to construct pad are converted into a UTF-8 representation.

If os.width() is greater than the number of code points contained in the source string, the output is padded using the code point specified as a parameter to pad. If os.width() is less than the number of code points contained the source string, the entire contents of the string are inserted into the output stream.

Any padding is inserted after the string if the ios_base::left format flag is set, or before if ios_base::right is set or neither flag is set.

Exceptions
RWConversionErrThrown to report conversion errors.
std::ios_base::failureThrown to report any errors detected while performing stream operations.
See also
RWBasicUString::Pad

Member Data Documentation

RWUChar32 RWBasicUString::Pad::codePoint_

The code point used to pad the string. The default code point is the Unicode space character.

const RWUChar16* RWBasicUString::Pad::data_

The string to pad.

size_t RWBasicUString::Pad::length_

The code unit length of the array referenced by data_.

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.