rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

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

List of all members.

Public Member Functions

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

Public Attributes

const RWUChar16data_
size_t length_
RWUChar32 codePoint_

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:
RWConversionErr Thrown to report conversion errors.
std::ios_base::failure Thrown to report any errors detected while performing stream operations.
See also:
RWBasicUString::Pad

Member Data Documentation

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

The string to pad.

The code unit length of the array referenced by data_.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.