HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TfUtf8CodePoint Class Reference

#include <unicodeUtils.h>

Public Member Functions

constexpr TfUtf8CodePoint ()=default
 Construct a code point initialized to the replacement value. More...
 
constexpr TfUtf8CodePoint (uint32_t value)
 
constexpr uint32_t AsUInt32 () const
 

Static Public Attributes

static constexpr uint32_t ReplacementValue = 0xFFFD
 
static constexpr uint32_t MaximumValue = 0x10FFFF
 
static constexpr std::pair
< uint32_t, uint32_t > 
SurrogateRange = {0xD800, 0xDFFF}
 

Friends

constexpr bool operator== (const TfUtf8CodePoint left, const TfUtf8CodePoint right)
 
constexpr bool operator!= (const TfUtf8CodePoint left, const TfUtf8CodePoint right)
 

Detailed Description

Wrapper for a 32-bit code point value that can be encoded as UTF-8.

// Stream operator overload encodes each code point as UTF-8.
std::stringstream s;
s << TfUtf8CodePoint(8747) << " " << TfUtf8CodePoint(120);

A single TfUtf8CodePoint may be converted to a string using TfStringify as well.

Definition at line 53 of file unicodeUtils.h.

Constructor & Destructor Documentation

constexpr TfUtf8CodePoint::TfUtf8CodePoint ( )
default

Construct a code point initialized to the replacement value.

constexpr TfUtf8CodePoint::TfUtf8CodePoint ( uint32_t  value)
inlineexplicit

Construct a UTF-8 valued code point, constrained by the maximum value and surrogate range.

Definition at line 73 of file unicodeUtils.h.

Member Function Documentation

constexpr uint32_t TfUtf8CodePoint::AsUInt32 ( ) const
inline

Definition at line 79 of file unicodeUtils.h.

Friends And Related Function Documentation

constexpr bool operator!= ( const TfUtf8CodePoint  left,
const TfUtf8CodePoint  right 
)
friend

Definition at line 85 of file unicodeUtils.h.

constexpr bool operator== ( const TfUtf8CodePoint  left,
const TfUtf8CodePoint  right 
)
friend

Definition at line 81 of file unicodeUtils.h.

Member Data Documentation

constexpr uint32_t TfUtf8CodePoint::MaximumValue = 0x10FFFF
static

Values higher than this will be replaced with the replacement code point.

Definition at line 61 of file unicodeUtils.h.

constexpr TfUtf8CodePoint TfUtf8InvalidCodePoint TfUtf8CodePoint::ReplacementValue = 0xFFFD
static

Code points that cannot be decoded or are outside of the valid range will be replaced with this value.

The replacement code point can be used to signal that a code point could not be decoded and needed to be replaced.

Definition at line 57 of file unicodeUtils.h.

constexpr std::pair<uint32_t, uint32_t> TfUtf8CodePoint::SurrogateRange = {0xD800, 0xDFFF}
static

Values in this range (inclusive) cannot be constructed and will be replaced by the replacement code point.

Definition at line 66 of file unicodeUtils.h.


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