SourcePro® API Reference Guide

 
Loading...
Searching...
No Matches

Provides read-write access to a range of code units within a referenced RWUString. More...

#include <rw/i18n/RWUSubString.h>

Public Member Functions

 RWUSubString (const RWUSubString &source)
 
size_t boundsCheckIndex (size_t offset) const
 
const RWUChar16data () const
 
bool isNull () const
 
size_t length () const
 
RWUChar16operator() (size_t offset)
 
RWUChar16 operator() (size_t offset) const
 
RWUSubStringoperator= (const RWBasicUString &source)
 
RWUSubStringoperator= (const RWUChar16 *source)
 
RWUSubStringoperator= (const RWUChar32 *source)
 
RWUSubStringoperator= (const RWUConstSubString &source)
 
RWUSubStringoperator= (const RWUSubString &source)
 
RWUSubStringoperator= (RWUChar16 codeUnit)
 
RWUSubStringoperator= (RWUChar32 codeUnit)
 
RWUChar16operator[] (size_t offset)
 
RWUChar16 operator[] (size_t offset) const
 
size_t start () const
 

Friends

class RWUString
 

Related Symbols

(Note that these are not member symbols.)

bool operator!= (const RWBasicUString &lhs, const RWUSubString &rhs)
 
bool operator!= (const RWUChar16 *lhs, const RWUSubString &rhs)
 
bool operator!= (const RWUChar32 *lhs, const RWUSubString &rhs)
 
bool operator!= (const RWUSubString &lhs, const RWBasicUString &rhs)
 
bool operator!= (const RWUSubString &lhs, const RWUChar16 *rhs)
 
bool operator!= (const RWUSubString &lhs, const RWUChar32 *rhs)
 
bool operator!= (const RWUSubString &lhs, const RWUSubString &rhs)
 
bool operator< (const RWBasicUString &lhs, const RWUSubString &rhs)
 
bool operator< (const RWUChar16 *lhs, const RWUSubString &rhs)
 
bool operator< (const RWUChar32 *lhs, const RWUSubString &rhs)
 
bool operator< (const RWUSubString &lhs, const RWBasicUString &rhs)
 
bool operator< (const RWUSubString &lhs, const RWUChar16 *rhs)
 
bool operator< (const RWUSubString &lhs, const RWUChar32 *rhs)
 
bool operator< (const RWUSubString &lhs, const RWUSubString &rhs)
 
std::ostream & operator<< (std::ostream &os, const RWUSubString &ustr)
 
bool operator<= (const RWBasicUString &lhs, const RWUSubString &rhs)
 
bool operator<= (const RWUChar16 *lhs, const RWUSubString &rhs)
 
bool operator<= (const RWUChar32 *lhs, const RWUSubString &rhs)
 
bool operator<= (const RWUSubString &lhs, const RWBasicUString &rhs)
 
bool operator<= (const RWUSubString &lhs, const RWUChar16 *rhs)
 
bool operator<= (const RWUSubString &lhs, const RWUChar32 *rhs)
 
bool operator<= (const RWUSubString &lhs, const RWUSubString &rhs)
 
bool operator== (const RWBasicUString &lhs, const RWUSubString &rhs)
 
bool operator== (const RWUChar16 *lhs, const RWUSubString &rhs)
 
bool operator== (const RWUChar32 *lhs, const RWUSubString &rhs)
 
bool operator== (const RWUSubString &lhs, const RWBasicUString &rhs)
 
bool operator== (const RWUSubString &lhs, const RWUChar16 *rhs)
 
bool operator== (const RWUSubString &lhs, const RWUChar32 *rhs)
 
bool operator== (const RWUSubString &lhs, const RWUSubString &rhs)
 
bool operator> (const RWBasicUString &lhs, const RWUSubString &rhs)
 
bool operator> (const RWUChar16 *lhs, const RWUSubString &rhs)
 
bool operator> (const RWUChar32 *lhs, const RWUSubString &rhs)
 
bool operator> (const RWUSubString &lhs, const RWBasicUString &rhs)
 
bool operator> (const RWUSubString &lhs, const RWUChar16 *rhs)
 
bool operator> (const RWUSubString &lhs, const RWUChar32 *rhs)
 
bool operator> (const RWUSubString &lhs, const RWUSubString &rhs)
 
bool operator>= (const RWBasicUString &lhs, const RWUSubString &rhs)
 
bool operator>= (const RWUChar16 *lhs, const RWUSubString &rhs)
 
bool operator>= (const RWUChar32 *lhs, const RWUSubString &rhs)
 
bool operator>= (const RWUSubString &lhs, const RWBasicUString &rhs)
 
bool operator>= (const RWUSubString &lhs, const RWUChar16 *rhs)
 
bool operator>= (const RWUSubString &lhs, const RWUChar32 *rhs)
 
bool operator>= (const RWUSubString &lhs, const RWUSubString &rhs)
 
std::istream & operator>> (std::istream &is, RWUSubString &ustr)
 

Detailed Description

RWUSubString allows read-write access to a range of code units within a referenced RWUString. The range is defined by a starting position and an length within the referenced string. For example, the 7th through the 11th elements, inclusive, would have a starting position of 7 and an extent of 5.

There are no public constructors. RWUSubString instances are constructed by various functions of the RWUString class. Typically, substrings are created and used anonymously, then destroyed immediately.

RWUSubString performs bounds checking in all methods that accept an offset value. These methods throw an RWBoundsErr exception if an offset exceeds the current bounds of the substring.

Example
#include <rw/i18n/RWUConversionContext.h>
#include <rw/i18n/RWUString.h>
#include <rw/i18n/RWUSubString.h>
#include <iostream>
using std::cout;
using std::endl;
int main() {
// Indicate that source and target strings are
// encoded as ISO8859-1.
RWUConversionContext context("ISO8859-1");
// Initialize a Unicode string.
RWUString str("Encoded as Latin-1");
// Modify a substring.
str(11, 5) = "ISO8859";
// Print the result.
cout << str << endl;
return 0;
}
Specifies the default character encoding scheme for conversions between narrow character strings and ...
Definition RWUConversionContext.h:101
Stores and manipulates Unicode character sequences encoded as UTF-16 code units.
Definition RWUString.h:187

Program Output:

Encoded as ISO8859-1

Constructor & Destructor Documentation

◆ RWUSubString()

RWUSubString::RWUSubString ( const RWUSubString & source)
inline

Constructs an RWUSubString from source.

Member Function Documentation

◆ boundsCheckIndex()

size_t RWUSubString::boundsCheckIndex ( size_t offset) const
inline

Returns offset if the value is in bounds.

Exceptions
RWBoundsErrThrown if self is a null substring or if offset is greater than or equal to length()

◆ data()

const RWUChar16 * RWUSubString::data ( ) const
inline

Returns a pointer to the string contents referenced by self.

The storage referenced by this pointer is owned by the RWUString associated with this substring. This storage may not be deleted or modified. The pointer becomes invalid if the RWUString is modified or destroyed.

Exceptions
RWBoundsErrThrown if self is a null substring.

◆ isNull()

bool RWUSubString::isNull ( ) const
inline

Returns true if the substring defined by self is null or empty; otherwise, false.

◆ length()

size_t RWUSubString::length ( ) const
inline

Returns the number of code units in the substring defined by self.

◆ operator()() [1/2]

RWUChar16 & RWUSubString::operator() ( size_t offset)
inline

Returns a reference object that provides read-write access to the code unit located at index offset within self. The result can be used as an RWUChar16 value, or as an l-value in an RWUChar16 assignment expression. The value of offset must be less than length().

Exceptions
RWBoundsErrThrown if self is a null substring, or if offset is greater than or equal to length().

◆ operator()() [2/2]

RWUChar16 RWUSubString::operator() ( size_t offset) const
inline

Returns the code unit located at index offset within self. The value of offset must be less than length().

Exceptions
RWBoundsErrThrown if self is a null substring, or if offset is greater than or equal to length().

◆ operator=() [1/7]

RWUSubString & RWUSubString::operator= ( const RWBasicUString & source)
inline

Replaces the substring defined by self with source.

◆ operator=() [2/7]

RWUSubString & RWUSubString::operator= ( const RWUChar16 * source)
inline

Replaces the substring defined by self with the null-terminated array source.

◆ operator=() [3/7]

RWUSubString & RWUSubString::operator= ( const RWUChar32 * source)
inline

Replaces the substring defined by self with the null-terminated array source.

◆ operator=() [4/7]

RWUSubString & RWUSubString::operator= ( const RWUConstSubString & source)
inline

Replaces the substring defined by self with source.

◆ operator=() [5/7]

RWUSubString & RWUSubString::operator= ( const RWUSubString & source)
inline

Replaces the substring defined by self with source.

◆ operator=() [6/7]

RWUSubString & RWUSubString::operator= ( RWUChar16 codeUnit)
inline

Replaces the substring defined by self with codeUnit.

◆ operator=() [7/7]

RWUSubString & RWUSubString::operator= ( RWUChar32 codeUnit)
inline

Replaces the substring defined by self with codeUnit.

◆ operator[]() [1/2]

RWUChar16 & RWUSubString::operator[] ( size_t offset)
inline

Returns a reference object that provides read-write access to the code unit located at index offset within self. The result can be used as an RWUChar16 value, or as an l-value in an RWUChar16 assignment expression. The value of offset must be less than length().

Exceptions
RWBoundsErrThrown if self is a null substring, or if offset is greater than or equal to length().

◆ operator[]() [2/2]

RWUChar16 RWUSubString::operator[] ( size_t offset) const
inline

Returns the code unit located at index offset within self. The value of offset must be less than length().

Exceptions
RWBoundsErrThrown if self is a null substring, or if offset is greater than or equal to length().

◆ start()

size_t RWUSubString::start ( ) const
inline

Returns the start position of the substring defined by self within the RWUString referenced by self. A return value of RW_NPOS indicates that self is a null substring.

Friends And Related Symbol Documentation

◆ operator!=() [1/7]

bool operator!= ( const RWBasicUString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs does not have the same length as, or lexicographically differs from, rhs; otherwise, false. This operator represents the logical negation of operator==.

◆ operator!=() [2/7]

bool operator!= ( const RWUChar16 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs does not have the same length as, or lexicographically differs from, rhs; otherwise, false. This operator represents the logical negation of operator==.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator!=() [3/7]

bool operator!= ( const RWUChar32 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs does not have the same length as, or lexicographically differs from, rhs; otherwise, false. This operator represents the logical negation of operator==.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator!=() [4/7]

bool operator!= ( const RWUSubString & lhs,
const RWBasicUString & rhs )
related

Returns true if lhs does not have the same length as, or lexicographically differs from, rhs; otherwise, false. This operator represents the logical negation of operator==.

◆ operator!=() [5/7]

bool operator!= ( const RWUSubString & lhs,
const RWUChar16 * rhs )
related

Returns true if lhs does not have the same length as, or lexicographically differs from, rhs; otherwise, false. This operator represents the logical negation of operator==.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator!=() [6/7]

bool operator!= ( const RWUSubString & lhs,
const RWUChar32 * rhs )
related

Returns true if lhs does not have the same length as, or lexicographically differs from, rhs; otherwise, false. This operator represents the logical negation of operator==.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator!=() [7/7]

bool operator!= ( const RWUSubString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs does not have the same length as, or lexicographically differs from, rhs; otherwise, false. Also returns false if both substrings are invalid. This operator represents the logical negation of operator==.

◆ operator<() [1/7]

bool operator< ( const RWBasicUString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically less than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

◆ operator<() [2/7]

bool operator< ( const RWUChar16 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically less than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator<() [3/7]

bool operator< ( const RWUChar32 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically less than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator<() [4/7]

bool operator< ( const RWUSubString & lhs,
const RWBasicUString & rhs )
related

Returns true if lhs is lexicographically less than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

◆ operator<() [5/7]

bool operator< ( const RWUSubString & lhs,
const RWUChar16 * rhs )
related

Returns true if lhs is lexicographically less than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator<() [6/7]

bool operator< ( const RWUSubString & lhs,
const RWUChar32 * rhs )
related

Returns true if lhs is lexicographically less than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator<() [7/7]

bool operator< ( const RWUSubString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically less than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
const RWUSubString & ustr )
related

Writes the sequence of bytes to std::ostream that are produced when the contents of ustr are converted into the character encoding scheme specified by the currently active target RWUFromUnicodeConversionContext.

If os.width() is greater than the number of code points contained in the source string, the output is padded using a single space fill character (U+0020). 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 std::ios_base::left format flag is set, or before if std::ios_base::right is set or if neither flag is set.

Exceptions
RWUExceptionThrown to report conversion errors.
std::ios_base::failureThrown to report any errors detected while performing stream operations.

◆ operator<=() [1/7]

bool operator<= ( const RWBasicUString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

◆ operator<=() [2/7]

bool operator<= ( const RWUChar16 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator<=() [3/7]

bool operator<= ( const RWUChar32 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator<=() [4/7]

bool operator<= ( const RWUSubString & lhs,
const RWBasicUString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

◆ operator<=() [5/7]

bool operator<= ( const RWUSubString & lhs,
const RWUChar16 * rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator<=() [6/7]

bool operator<= ( const RWUSubString & lhs,
const RWUChar32 * rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator<=() [7/7]

bool operator<= ( const RWUSubString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false. Returns true if both substrings are null. If the two strings are identical over the length of the shortest string, then the shorter string is considered less than the longer string.

◆ operator==() [1/7]

bool operator== ( const RWBasicUString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false.

◆ operator==() [2/7]

bool operator== ( const RWUChar16 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator==() [3/7]

bool operator== ( const RWUChar32 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator==() [4/7]

bool operator== ( const RWUSubString & lhs,
const RWBasicUString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false.

◆ operator==() [5/7]

bool operator== ( const RWUSubString & lhs,
const RWUChar16 * rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator==() [6/7]

bool operator== ( const RWUSubString & lhs,
const RWUChar32 * rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator==() [7/7]

bool operator== ( const RWUSubString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs has the same length and is lexicographically identical to rhs; otherwise, false.

◆ operator>() [1/7]

bool operator> ( const RWBasicUString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

◆ operator>() [2/7]

bool operator> ( const RWUChar16 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator>() [3/7]

bool operator> ( const RWUChar32 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator>() [4/7]

bool operator> ( const RWUSubString & lhs,
const RWBasicUString & rhs )
related

Returns true if lhs is lexicographically greater than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

◆ operator>() [5/7]

bool operator> ( const RWUSubString & lhs,
const RWUChar16 * rhs )
related

Returns true if lhs is lexicographically greater than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator>() [6/7]

bool operator> ( const RWUSubString & lhs,
const RWUChar32 * rhs )
related

Returns true if lhs is lexicographically greater than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator>() [7/7]

bool operator> ( const RWUSubString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

◆ operator>=() [1/7]

bool operator>= ( const RWBasicUString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than or equal to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

◆ operator>=() [2/7]

bool operator>= ( const RWUChar16 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than or equal to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator>=() [3/7]

bool operator>= ( const RWUChar32 * lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than or equal to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The lhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator>=() [4/7]

bool operator>= ( const RWUSubString & lhs,
const RWBasicUString & rhs )
related

Returns true if lhs is lexicographically greater than or equal to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

◆ operator>=() [5/7]

bool operator>= ( const RWUSubString & lhs,
const RWUChar16 * rhs )
related

Returns true if lhs is lexicographically greater than or equal to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodeUnits() in that case.

◆ operator>=() [6/7]

bool operator>= ( const RWUSubString & lhs,
const RWUChar32 * rhs )
related

Returns true if lhs is lexicographically greater than or equal to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

The rhs string must be null-terminated. This method cannot be used to compare strings containing embedded nulls; use RWBasicUString::compareCodePoints() in that case.

◆ operator>=() [7/7]

bool operator>= ( const RWUSubString & lhs,
const RWUSubString & rhs )
related

Returns true if lhs is lexicographically greater than or equal to rhs; otherwise, false. If the two strings are identical over the length of the shortest string, then the longer string is considered greater than the shorter string.

◆ operator>>()

std::istream & operator>> ( std::istream & is,
RWUSubString & ustr )
related

Reads an encoded byte stream from std::istream. The byte sequence is converted into UTF-16 using the currently active RWUToUnicodeConversionContext. Leading whitespace is always skipped before storing any code points, regardless of the std::ios::skipws format flag setting. Code points are then extracted until:

  • is.width() code points are read, if is.width() is greater than zero
  • a whitespace code point is read
  • the end of the input sequence is reached

The following Unicode characters are treated as whitespace delimiters:

  • U+0009 HORIZONTAL TABULATION
  • U+000A LINE FEED
  • U+000B VERTICAL TABULATION
  • U+000C FORM FEED
  • U+000D CARRIAGE RETURN
  • U+001C FILE SEPARATOR
  • U+001D GROUP SEPARATOR
  • U+001E RECORD SEPARATOR
  • U+001F UNIT SEPARATOR
  • U+0020 SPACE
  • U+0085 NEXT LINE
  • U+1680 OGHAM SPACE MARK
  • U+2000 EN QUAD
  • U+2001 EM QUAD
  • U+2002 EN SPACE
  • U+2003 EM SPACE
  • U+2004 THREE-PER-EM SPACE
  • U+2005 FOUR-PER-EM SPACE
  • U+2006 SIX-PER-EM SPACE
  • U+2007 FIGURE SPACE
  • U+2008 PUNCTUATION SPACE
  • U+2009 THIN SPACE
  • U+200A HAIR SPACE
  • U+200B ZERO WIDTH SPACE
  • U+2028 LINE SEPARATOR
  • U+2029 PARAGRAPH SEPARATOR
  • U+3000 IDEOGRAPHIC SPACE

Unlike standard extractors, this extractor must consume and discard the trailing whitespace delimiter. This behavior is due to the nature of the UTF-8 encoding scheme, which requires multiple bytes to encode some whitespace characters. For the same reason, this extractor cannot support the the noskipws condition where the std::ios_base::skipws formate flag has been cleared; each extraction will consume one whitespace character. A whitespace manipulator is not provided either, since such a manipulator would consume the first non-whitespace character following a sequence of whitespace characters.

Exceptions
RWUExceptionThrown to report conversion errors.
std::ios_base::failureThrown to report any errors detected while performing stream operations.

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