PCL
pcl::CharTraits Class Reference

A template instantiation of GenericCharTraits for char16_type. More...

#include <CharTraits.h>

+ Inheritance diagram for pcl::CharTraits:

Public Types

typedef traits_base::char_type char_type
 
typedef GenericCharTraits< char16_typetraits_base
 
- Public Types inherited from pcl::GenericCharTraits< char16_type >
typedef char16_type char_type
 

Static Public Member Functions

static int Compare (const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true, bool localeAware=true)
 
static int CompareCodePoints (const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true)
 
static void Copy (char_type *dst, const char_type *src, size_type n)
 
static void CopyOverlapped (char_type *dst, const char_type *src, size_type n)
 
static constexpr char_type HighSurrogate (char32_type c32)
 
static constexpr bool IsHighSurrogate (char_type c16)
 
static constexpr bool IsLowSurrogate (char_type c16)
 
static size_type Length (const char_type *s)
 
static constexpr char_type LowSurrogate (char32_type c32)
 
static constexpr char32_type SurrogatePairToUTF32 (char_type high, char_type low)
 
static char_type ToCaseFolded (char_type c)
 
static void ToCaseFolded (char_type *s, size_type n)
 
static char_type ToLowercase (char_type c)
 
static void ToLowercase (char_type *s, size_type n)
 
static char_type ToUppercase (char_type c)
 
static void ToUppercase (char_type *s, size_type n)
 
static bool WildMatch (const char_type *t, size_type nt, const char_type *p, size_type np, bool caseSensitive=true)
 
static bool WildMatch (const char_type *t, size_type nt, const char *p, size_type np, bool caseSensitive=true)
 
- Static Public Member Functions inherited from pcl::GenericCharTraits< char16_type >
static constexpr char_type Blank ()
 
static constexpr size_type BytesPerChar ()
 
static constexpr char_type Colon ()
 
static constexpr char_type Comma ()
 
static int Compare (const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true, bool localeAware=true)
 
static int CompareCodePoints (const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true)
 
static void Copy (char_type *dst, const char_type *src, size_type n)
 
static void CopyOverlapped (char_type *dst, const char_type *src, size_type n)
 
static constexpr char_type CR ()
 
static constexpr char_type DecimalSeparator ()
 
static constexpr char_type DoubleQuote ()
 
static constexpr char_type ExponentDelimiter ()
 
static void Fill (char_type *s, char_type c, size_type n)
 
static constexpr char_type Hyphen ()
 
static constexpr bool IsAlpha (char_type c)
 
static constexpr bool IsDecimalSeparator (char_type c)
 
static constexpr bool IsDigit (char_type c)
 
static constexpr bool IsExponentDelimiter (char_type c)
 
static constexpr bool IsHexDigit (char_type c)
 
static constexpr bool IsLowercaseAlpha (char_type c)
 
static constexpr bool IsNull (char_type c)
 
static constexpr bool IsSign (char_type c)
 
static constexpr bool IsSpace (char_type c)
 
static constexpr bool IsStartingSymbolDigit (char_type c)
 
static constexpr bool IsSymbolDigit (char_type c)
 
static constexpr bool IsTrimable (char_type c)
 
static constexpr bool IsUnderscore (char_type c)
 
static constexpr bool IsUppercaseAlpha (char_type c)
 
static constexpr bool IsWildcard (char_type c)
 
static size_type Length (const char_type *s)
 
static constexpr char_type LF ()
 
static constexpr char_type MinusSign ()
 
static constexpr char_type Null ()
 
static constexpr char_type PlusSign ()
 
static Ptr1 SearchTrimLeft (Ptr1 i, Ptr2 j)
 
static Ptr2 SearchTrimRight (Ptr1 i, Ptr2 j)
 
static constexpr char_type Semicolon ()
 
static constexpr char_type SingleQuote ()
 
static constexpr char_type Tab ()
 
static char_type ToCaseFolded (char_type c)
 
static constexpr char_type ToLowercase (char_type c)
 
static void ToLowercase (char_type *s, size_type n)
 
static constexpr char_type ToUppercase (char_type c)
 
static void ToUppercase (char_type *s, size_type n)
 
static constexpr char_type Underscore ()
 
static bool WildMatch (const char_type *t, size_type nt, const char_type *p, size_type np, bool caseSensitive=true)
 

Detailed Description

CharTraits is the char traits class used by String.

Definition at line 1118 of file CharTraits.h.

Member Typedef Documentation

◆ char_type

Represents the character data type used by this traits class.

Definition at line 1130 of file CharTraits.h.

◆ traits_base

Base class of this char traits class.

Definition at line 1125 of file CharTraits.h.

Member Function Documentation

◆ Compare()

static int pcl::CharTraits::Compare ( const char_type s1,
size_type  n1,
const char_type s2,
size_type  n2,
bool  caseSensitive = true,
bool  localeAware = true 
)
static

Lexicographical comparison between two Unicode strings.

Parameters
s1First string.
n1Length of the first string in characters.
s2Second string.
n2Length of the second string in characters.
caseSensitiveWhen true, a case-sensitive comparison is performed; otherwise the comparison does not distinguish between lowercase and uppercase characters (as defined by the selected locale). The default value of this parameter is true.
localeAwareWhen true, a locale-aware comparison is performed which takes into account the currently selected user locale (language and variants). When false, an invariant comparison is carried out by comparing Unicode code points (which may be faster). The default value is true.

Returns an integer code representing the comparison result:

  • 0 if s1 and s2 are equal
  • -1 if s1 is less than s2
  • +1 if s1 is greater than s2

On OS X and Windows platforms this function invokes system API routines to perform locale-aware string comparisons.

On X11 (FreeBSD and Linux platforms), when the localeAware parameter is true, the comparison uses the current locale as reported by calling the setlocale POSIX function:

setlocale( LC_COLLATE, 0 );

In PixInsight on X11 platforms, the default user collation and case comparison locales are used. A module can change them temporarily to a custom locale by calling:

setlocale( LC_COLLATE, "<custom-locale>" );
setlocale( LC_CTYPE, "<custom-locale>" );

and then, after the necessary work has been done with the custom locales, restore the default settings:

setlocale( LC_COLLATE, "" );
setlocale( LC_CTYPE, "" );

◆ CompareCodePoints()

static int pcl::CharTraits::CompareCodePoints ( const char_type s1,
size_type  n1,
const char_type s2,
size_type  n2,
bool  caseSensitive = true 
)
inlinestatic

Compares numeric character values between two Unicode strings.

Parameters
s1First string.
n1Length of the first string in characters.
s2Second string.
n2Length of the second string in characters.
caseSensitiveWhen true, a case-sensitive comparison is performed; otherwise the comparison does not distinguish between lowercase and uppercase characters. The default value of this parameter is true.

Returns an integer code representing the comparison result:

  • 0 if s1 and s2 are equal
  • -1 if s1 is less than s2
  • +1 if s1 is greater than s2

Definition at line 1199 of file CharTraits.h.

◆ Copy()

static void pcl::CharTraits::Copy ( char_type dst,
const char_type src,
size_type  n 
)
inlinestatic

Copies a contiguous sequence of characters to a specified location. The source and destination regions do not overlap.

Parameters
dstDestination location where characters will be copied.
srcInitial address of the sequence of source characters.
nNumber of characters to copy.

If the source and destination regions overlap, this routine will produce an unpredictable result. CopyOverlapped() should be used in these cases.

Definition at line 1159 of file CharTraits.h.

◆ CopyOverlapped()

static void pcl::CharTraits::CopyOverlapped ( char_type dst,
const char_type src,
size_type  n 
)
inlinestatic

Copies a contiguous sequence of characters to a specified location. The source and destination regions may safely overlap.

Parameters
dstDestination location where characters will be copied.
srcInitial address of the sequence of source characters.
nNumber of characters to copy.

Definition at line 1173 of file CharTraits.h.

◆ HighSurrogate()

static constexpr char_type pcl::CharTraits::HighSurrogate ( char32_type  c32)
inlinestatic

Returns the high surrogate word of a UTF-32 code point. The specified UTF-32 code must be in the range from 0x010000 to 0x10FFFF, since surrogates only exist outside the Basic Multilingual Plane of Unicode.

Definition at line 1408 of file CharTraits.h.

◆ IsHighSurrogate()

static constexpr bool pcl::CharTraits::IsHighSurrogate ( char_type  c16)
inlinestatic

Returns true iff the specified UTF-16 character is a high surrogate (the most significant word of a surrogate pair forming a UTF-32 code point). High surrogates have values between 0xD800 and 0xDBFF.

Definition at line 1397 of file CharTraits.h.

◆ IsLowSurrogate()

static constexpr bool pcl::CharTraits::IsLowSurrogate ( char_type  c16)
inlinestatic

Returns true iff the specified UTF-16 character is a low surrogate (the least significant word of a surrogate pair forming a UTF-32 code point). Low surrogates have values between 0xDC00 and 0xDFFF.

Definition at line 1419 of file CharTraits.h.

◆ Length()

static size_type pcl::CharTraits::Length ( const char_type s)
inlinestatic

Returns the length of a null-terminated UTF-16 string in characters (not bytes).

The returned value is the length of the initial contiguous sequence of characters that are not equal to Null().

Definition at line 1139 of file CharTraits.h.

Referenced by pcl::IsoString::IsoString(), pcl::IsoString::operator=(), pcl::File::OutText(), and pcl::File::Write().

◆ LowSurrogate()

static constexpr char_type pcl::CharTraits::LowSurrogate ( char32_type  c32)
inlinestatic

Returns the low surrogate word of a UTF-32 code point. The specified UTF-32 code must be in the range from 0x010000 to 0x10FFFF, since surrogates only exist outside the Basic Multilingual Plane of Unicode.

Definition at line 1430 of file CharTraits.h.

◆ SurrogatePairToUTF32()

static constexpr char32_type pcl::CharTraits::SurrogatePairToUTF32 ( char_type  high,
char_type  low 
)
inlinestatic

Returns a UTF-32 code point from its surrogate pair. The specified surrogate words must pertain to a valid Unicode code point outside the Basic Multilingual Plane (from 0x010000 to 0x10FFFF).

Definition at line 1440 of file CharTraits.h.

◆ ToCaseFolded() [1/2]

static char_type pcl::CharTraits::ToCaseFolded ( char_type  c)
inlinestatic

Returns the case folded equivalent character for the specified UTF-16 code point c.

Case folding elimitates case differences, which is useful for case-insensitive string comparisons.

We implement the simple case folding Unicode algorithm exclusively. For more information on case folding, see Section 3.13 Default Case Algorithms in The Unicode Standard.

Definition at line 1320 of file CharTraits.h.

◆ ToCaseFolded() [2/2]

static void pcl::CharTraits::ToCaseFolded ( char_type s,
size_type  n 
)
inlinestatic

Transforms a string to case folded.

Definition at line 1364 of file CharTraits.h.

◆ ToLowercase() [1/2]

static char_type pcl::CharTraits::ToLowercase ( char_type  c)
inlinestatic

Returns the lowercase equivalent character for the specified UTF-16 code point c.

Definition at line 1335 of file CharTraits.h.

◆ ToLowercase() [2/2]

static void pcl::CharTraits::ToLowercase ( char_type s,
size_type  n 
)
inlinestatic

Transforms a string to lowercase.

Definition at line 1374 of file CharTraits.h.

◆ ToUppercase() [1/2]

static char_type pcl::CharTraits::ToUppercase ( char_type  c)
inlinestatic

Returns the uppercase equivalent character for the specified UTF-16 code point c.

Definition at line 1350 of file CharTraits.h.

◆ ToUppercase() [2/2]

static void pcl::CharTraits::ToUppercase ( char_type s,
size_type  n 
)
inlinestatic

Transforms a string to uppercase.

Definition at line 1384 of file CharTraits.h.

◆ WildMatch() [1/2]

static bool pcl::CharTraits::WildMatch ( const char_type t,
size_type  nt,
const char_type p,
size_type  np,
bool  caseSensitive = true 
)
inlinestatic

Wildcard string matching algorithm.

Parameters
tThe string to be matched.
ntLength of the string to be matched in characters.
pThe pattern string. May contain multiple instances of the wildcard characters '*' and '?'.
npLength of the pattern string in characters.
caseSensitiveWhen true, a case-sensitive comparison is performed; otherwise the comparison does not distinguish between lowercase and uppercase characters. The default value of this parameter is true.

Returns true iff the string t matches the specified pattern p. If one of the strings is empty, this function always returns false conventionally, even if the pattern is a single asterisk '*'.

Definition at line 1285 of file CharTraits.h.

◆ WildMatch() [2/2]

static bool pcl::CharTraits::WildMatch ( const char_type t,
size_type  nt,
const char *  p,
size_type  np,
bool  caseSensitive = true 
)
inlinestatic

Wildcard string matching algorithm - overloaded version with 8-bit pattern string.

Definition at line 1299 of file CharTraits.h.

References pcl::IsoCharTraits::ToCaseFolded().


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