PCL
CharTraits.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.4.0
6 // ----------------------------------------------------------------------------
7 // pcl/CharTraits.h - Released 2020-07-31T19:33:04Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2020 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (http://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_CharTraits_h
53 #define __PCL_CharTraits_h
54 
56 
57 #include <pcl/Defs.h>
58 #include <pcl/Diagnostics.h>
59 
60 #include <pcl/Utility.h>
61 
62 #include <ctype.h>
63 #include <memory.h>
64 #include <string.h>
65 
66 #ifdef __PCL_WINDOWS
67 # include <windows.h>
68 #else // POSIX
69 # include <wchar.h>
70 # include <wctype.h>
71 #endif // !__PCL_WINDOWS
72 
73 namespace pcl
74 {
75 
76 // ----------------------------------------------------------------------------
77 
78 char16_type PCL_FUNC PCL_ToCaseFolded( char16_type );
79 char16_type PCL_FUNC PCL_ToLowercase( char16_type );
80 char16_type PCL_FUNC PCL_ToUppercase( char16_type );
81 
82 extern const uint8* PCL_DATA PCL_toLowercaseLatin1;
83 extern const uint8* PCL_DATA PCL_toUppercaseLatin1;
84 
85 // ----------------------------------------------------------------------------
86 
98 // ----------------------------------------------------------------------------
99 
100 #define PCL_COMPARE_CODE_POINTS() \
101  PCL_PRECONDITION( n1 == 0 || n2 == 0 || s1 != nullptr && s2 != nullptr ) \
102  if ( caseSensitive ) \
103  { \
104  for ( size_type n = pcl::Min( n1, n2 ); n > 0; --n, ++s1, ++s2 ) \
105  if ( *s1 != *s2 ) \
106  return (*s1 < *s2) ? -1 : +1; \
107  } \
108  else \
109  { \
110  for ( size_type n = pcl::Min( n1, n2 ); n > 0; --n, ++s1, ++s2 ) \
111  { \
112  char_type c1 = ToCaseFolded( *s1 ), c2 = ToCaseFolded( *s2 ); \
113  if ( c1 != c2 ) \
114  return (c1 < c2) ? -1 : +1; \
115  } \
116  } \
117  return (n1 == n2) ? 0 : ((n1 < n2) ? -1 : +1)
118 
119 // ----------------------------------------------------------------------------
120 
121 /*
122  * Wildcard string matching algorithm adapted from:
123  *
124  * Kirk J. Krauss (2014): Matching Wildcards: An Empirical Way to Tame an
125  * Algorithm, Dr. Dobb's Magazine, October 7, 2014.
126  *
127  * http://www.drdobbs.com/architecture-and-design/matching-wildcards-an-empirical-way-to-t/240169123
128  */
129 
130 template <typename Tt, typename Tp> inline
131 bool WildMatch( const Tt* t, size_type nt, const Tp* p, size_type np )
132 {
133  PCL_PRECONDITION( nt == 0 || np == 0 || t != nullptr && p != nullptr )
134 
135  if ( nt == 0 || np == 0 )
136  return false;
137 
138  const Tt* et = t + nt;
139  const Tp* ep = p + np;
140  const Tt* bt = nullptr;
141  const Tp* bp = nullptr;
142 
143  for ( ;; )
144  {
145  Tp c = *p;
146 
147  if ( c == Tp( '*' ) )
148  {
149  do
150  if ( ++p == ep )
151  return true;
152  while ( (c = *p) == Tp( '*' ) );
153 
154  if ( c != Tp( '?' ) )
155  while ( Tt( c ) != *t )
156  if ( ++t == et )
157  return false;
158 
159  bp = p;
160  bt = t;
161  }
162  else if ( Tt( c ) != *t && c != Tp( '?' ) )
163  {
164  if ( bp != nullptr )
165  {
166  if ( p != bp )
167  {
168  p = bp;
169 
170  if ( Tt( *p ) != *t )
171  {
172  t = ++bt;
173  continue;
174  }
175 
176  ++p;
177  }
178 
179  if ( t < et )
180  {
181  ++t;
182  continue;
183  }
184  }
185 
186  return false;
187  }
188 
189  ++t;
190  ++p;
191 
192  if ( t == et )
193  {
194  if ( p == ep )
195  return true;
196 
197  while ( *p == Tp( '*' ) )
198  if ( ++p == ep )
199  return true;
200 
201  return false;
202  }
203  }
204 }
205 
206 template <typename Tt, typename Tp, class Ut, class Up> inline
207 bool WildMatchIC( const Tt* t, size_type nt, const Tp* p, size_type np, Ut ut, Up up )
208 {
209  PCL_PRECONDITION( nt == 0 || np == 0 || t != nullptr && p != nullptr && ut != nullptr && up != nullptr )
210 
211  if ( nt == 0 || np == 0 )
212  return false;
213 
214  const Tt* et = t + nt;
215  const Tp* ep = p + np;
216  const Tt* bt = nullptr;
217  const Tp* bp = nullptr;
218 
219  for ( ;; )
220  {
221  Tp c = *p;
222 
223  if ( c == Tp( '*' ) )
224  {
225  do
226  if ( ++p == ep )
227  return true;
228  while ( (c = *p) == Tp( '*' ) );
229 
230  if ( c != Tp( '?' ) )
231  {
232  c = up( c );
233  while ( Tt( c ) != ut( *t ) )
234  if ( ++t == et )
235  return false;
236  }
237 
238  bp = p;
239  bt = t;
240  }
241  else if ( c != Tp( '?' ) )
242  {
243  Tt ft = ut( *t );
244 
245  if ( Tt( up( c ) ) != ft )
246  {
247  if ( bp != nullptr )
248  {
249  if ( p != bp )
250  {
251  p = bp;
252 
253  if ( Tt( up( *p ) ) != ft )
254  {
255  t = ++bt;
256  continue;
257  }
258 
259  ++p;
260  }
261 
262  if ( t < et )
263  {
264  ++t;
265  continue;
266  }
267  }
268 
269  return false;
270  }
271  }
272 
273  ++t;
274  ++p;
275 
276  if ( t == et )
277  {
278  if ( p == ep )
279  return true;
280 
281  while ( *p == Tp( '*' ) )
282  if ( ++p == ep )
283  return true;
284 
285  return false;
286  }
287  }
288 }
289 
290 // ----------------------------------------------------------------------------
291 
314 template <typename T>
315 class PCL_CLASS GenericCharTraits
316 {
317 public:
318 
322  typedef T char_type;
323 
327  static constexpr size_type BytesPerChar()
328  {
329  return sizeof( char_type );
330  }
331 
339  static size_type Length( const char_type* s )
340  {
341  const char_type* t = s;
342  if ( s != nullptr )
343  for ( ; *t != Null(); ++t ) {}
344  return size_type( t - s );
345  }
346 
354  static void Fill( char_type* s, char_type c, size_type n )
355  {
356  PCL_PRECONDITION( n == 0 || s != nullptr )
357  for ( ; n > 0; --n )
358  *s++ = c;
359  }
360 
372  static void Copy( char_type* dst, const char_type* src, size_type n )
373  {
374  PCL_PRECONDITION( n == 0 || dst != nullptr && src != nullptr )
375  ::memcpy( dst, src, n*sizeof( char_type ) );
376  }
377 
386  static void CopyOverlapped( char_type* dst, const char_type* src, size_type n )
387  {
388  PCL_PRECONDITION( n == 0 || dst != nullptr && src != nullptr )
389  ::memmove( dst, src, n*sizeof( char_type ) );
390  }
391 
418  static int CompareCodePoints( const char_type* s1, size_type n1,
419  const char_type* s2, size_type n2, bool caseSensitive = true )
420  {
421  PCL_COMPARE_CODE_POINTS();
422  }
423 
456  static int Compare( const char_type* s1, size_type n1,
457  const char_type* s2, size_type n2, bool caseSensitive = true, bool localeAware = true )
458  {
459  return CompareCodePoints( s1, n1, s2, n2, caseSensitive );
460  }
461 
484  static bool WildMatch( const char_type* t, size_type nt,
485  const char_type* p, size_type np, bool caseSensitive = true )
486  {
487  if ( caseSensitive )
488  return pcl::WildMatch( t, nt, p, np );
489  return pcl::WildMatchIC( t, nt, p, np, ToCaseFolded, ToCaseFolded );
490  }
491 
503  static char_type ToCaseFolded( char_type c )
504  {
505  return ToLowercase( c );
506  }
507 
515  static constexpr char_type ToLowercase( char_type c )
516  {
517  return (c >= char_type( 65 ) && c <= char_type( 90 )
518  || c >= char_type( 192 ) && c <= char_type( 214 )
519  || c >= char_type( 216 ) && c <= char_type( 222 )) ? c + 32 : c;
520  }
521 
529  static constexpr char_type ToUppercase( char_type c )
530  {
531  return (c >= char_type( 97 ) && c <= char_type( 122 )
532  || c >= char_type( 224 ) && c <= char_type( 246 )
533  || c >= char_type( 248 ) && c <= char_type( 254 )) ? c - 32 : c;
534  }
535 
543  static void ToLowercase( char_type* s, size_type n )
544  {
545  PCL_PRECONDITION( n == 0 || s != nullptr )
546  for ( ; n > 0; --n, ++s )
547  *s = ToLowercase( *s );
548  }
549 
557  static void ToUppercase( char_type* s, size_type n )
558  {
559  PCL_PRECONDITION( n == 0 || s != nullptr )
560  for ( ; n > 0; --n, ++s )
561  *s = ToUppercase( *s );
562  }
563 
567  static constexpr char_type Null()
568  {
569  return char_type( 0 );
570  }
571 
575  static constexpr char_type Blank()
576  {
577  return char_type( ' ' );
578  }
579 
583  static constexpr char_type Tab()
584  {
585  return char_type( '\t' );
586  }
587 
591  static constexpr char_type CR()
592  {
593  return char_type( '\r' );
594  }
595 
599  static constexpr char_type LF()
600  {
601  return char_type( '\n' );
602  }
603 
607  static constexpr char_type Comma()
608  {
609  return char_type( ',' );
610  }
611 
615  static constexpr char_type Colon()
616  {
617  return char_type( ':' );
618  }
619 
623  static constexpr char_type Semicolon()
624  {
625  return char_type( ';' );
626  }
627 
631  static constexpr char_type Hyphen()
632  {
633  return char_type( '-' );
634  }
635 
639  static constexpr char_type PlusSign()
640  {
641  return char_type( '+' );
642  }
643 
647  static constexpr char_type MinusSign()
648  {
649  return char_type( '-' );
650  }
651 
655  static constexpr char_type DecimalSeparator()
656  {
657  return char_type( '.' );
658  }
659 
663  static constexpr char_type ExponentDelimiter()
664  {
665  return char_type( 'e' );
666  }
667 
671  static constexpr char_type Underscore()
672  {
673  return char_type( '_' );
674  }
675 
679  static constexpr char_type SingleQuote()
680  {
681  return char_type( '\'' );
682  }
683 
687  static constexpr char_type DoubleQuote()
688  {
689  return char_type( '\"' );
690  }
691 
695  static constexpr bool IsNull( char_type c )
696  {
697  return c == Null();
698  }
699 
703  static constexpr bool IsSpace( char_type c )
704  {
705  return c == Blank() || c == Tab() || c == CR() || c == LF();
706  }
707 
712  static constexpr bool IsTrimable( char_type c )
713  {
714  return IsSpace( c );
715  }
716 
721  static constexpr bool IsDigit( char_type c )
722  {
723  return c >= char_type( '0' ) && c <= char_type( '9' );
724  }
725 
730  static constexpr bool IsHexDigit( char_type c )
731  {
732  return IsDigit( c ) || c >= char_type( 'A' ) && c <= char_type( 'F' ) ||
733  c >= char_type( 'a' ) && c <= char_type( 'f' );
734  }
735 
739  static constexpr bool IsAlpha( char_type c )
740  {
741  return IsLowercaseAlpha( c ) || IsUppercaseAlpha( c );
742  }
743 
747  static constexpr bool IsLowercaseAlpha( char_type c )
748  {
749  return c >= char_type( 'a' ) && c <= char_type( 'z' );
750  }
751 
755  static constexpr bool IsUppercaseAlpha( char_type c )
756  {
757  return c >= char_type( 'A' ) && c <= char_type( 'Z' );
758  }
759 
763  static constexpr bool IsUnderscore( char_type c )
764  {
765  return c == Underscore();
766  }
767 
772  static constexpr bool IsSymbolDigit( char_type c )
773  {
774  return IsAlpha( c ) || IsDigit( c ) || IsUnderscore( c );
775  }
776 
781  static constexpr bool IsStartingSymbolDigit( char_type c )
782  {
783  return IsAlpha( c ) || IsUnderscore( c );
784  }
785 
789  static constexpr bool IsSign( char_type c )
790  {
791  return c == MinusSign() || c == PlusSign();
792  }
793 
797  static constexpr bool IsDecimalSeparator( char_type c )
798  {
799  return c == DecimalSeparator();
800  }
801 
807  static constexpr bool IsExponentDelimiter( char_type c )
808  {
809  return c == char_type( 'e' ) || c == char_type( 'E' ) || c == char_type( 'd' ) || c == char_type( 'D' );
810  }
811 
816  static constexpr bool IsWildcard( char_type c )
817  {
818  return c == char_type( '*' ) || c == char_type( '?' );
819  }
820 
825  template <typename Ptr1, typename Ptr2>
826  static Ptr1 SearchTrimLeft( Ptr1 i, Ptr2 j )
827  {
828  for ( ; i < j && IsTrimable( *i ); ++i ) {}
829  return i;
830  }
831 
840  template <typename Ptr1, typename Ptr2>
841  static Ptr2 SearchTrimRight( Ptr1 i, Ptr2 j )
842  {
843  for ( ; i < j && IsTrimable( *(j-1) ); --j ) {}
844  return j;
845  }
846 };
847 
848 // ----------------------------------------------------------------------------
849 
858 class PCL_CLASS IsoCharTraits : public GenericCharTraits<char>
859 {
860 public:
861 
866 
871 
879  static constexpr size_type Length( const char_type* s )
880  {
881  return (s != nullptr) ? ::strlen( s ) : 0;
882  }
883 
891  static void Fill( char_type* s, char_type c, size_type n )
892  {
893  PCL_PRECONDITION( n == 0 || s != nullptr )
894  ::memset( s, c, n );
895  }
896 
908  static void Copy( char_type* dst, const char_type* src, size_type n )
909  {
910  PCL_PRECONDITION( n == 0 || dst != nullptr && src != nullptr )
911  ::memcpy( dst, src, n );
912  }
913 
922  static void CopyOverlapped( char_type* dst, const char_type* src, size_type n )
923  {
924  PCL_PRECONDITION( n == 0 || dst != nullptr && src != nullptr )
925  ::memmove( dst, src, n );
926  }
927 
948  static int CompareCodePoints( const char_type* s1, size_type n1,
949  const char_type* s2, size_type n2, bool caseSensitive = true )
950  {
951  PCL_COMPARE_CODE_POINTS();
952  }
953 
1009  static int Compare( const char_type* s1, size_type n1,
1010  const char_type* s2, size_type n2, bool caseSensitive = true, bool localeAware = true );
1011 
1034  static bool WildMatch( const char_type* t, size_type nt,
1035  const char_type* p, size_type np, bool caseSensitive = true )
1036  {
1037  if ( caseSensitive )
1038  return pcl::WildMatch( t, nt, p, np );
1039  return pcl::WildMatchIC( t, nt, p, np,
1040  []( char_type c ) { return ToCaseFolded( c ); },
1041  []( char_type c ) { return ToCaseFolded( c ); } );
1042  }
1043 
1054  static char_type ToCaseFolded( char_type c )
1055  {
1056  return ToLowercase( c );
1057  }
1058 
1063  static char_type ToLowercase( char_type c )
1064  {
1065  return char_type( PCL_toLowercaseLatin1[uint8( c )] );
1066  }
1067 
1072  static char_type ToUppercase( char_type c )
1073  {
1074  return char_type( PCL_toUppercaseLatin1[uint8( c )] );
1075  }
1076 
1080  static void ToCaseFolded( char_type* s, size_type n )
1081  {
1082  PCL_PRECONDITION( n == 0 || s != nullptr )
1083  for ( ; n > 0; --n, ++s )
1084  *s = ToCaseFolded( *s );
1085  }
1086 
1090  static void ToLowercase( char_type* s, size_type n )
1091  {
1092  PCL_PRECONDITION( n == 0 || s != nullptr )
1093  for ( ; n > 0; --n, ++s )
1094  *s = ToLowercase( *s );
1095  }
1096 
1100  static void ToUppercase( char_type* s, size_type n )
1101  {
1102  PCL_PRECONDITION( n == 0 || s != nullptr )
1103  for ( ; n > 0; --n, ++s )
1104  *s = ToUppercase( *s );
1105  }
1106 };
1107 
1108 // ----------------------------------------------------------------------------
1109 
1118 class PCL_CLASS CharTraits : public GenericCharTraits<char16_type>
1119 {
1120 public:
1121 
1126 
1131 
1139  static size_type Length( const char_type* s )
1140  {
1141 #ifdef __PCL_WINDOWS
1142  return (s != nullptr) ? ::wcslen( reinterpret_cast<const wchar_t*>( s ) ) : 0;
1143 #else
1144  return traits_base::Length( s );
1145 #endif
1146  }
1147 
1159  static void Copy( char_type* dst, const char_type* src, size_type n )
1160  {
1161  PCL_PRECONDITION( n == 0 || dst != nullptr && src != nullptr )
1162  ::memcpy( dst, src, n << 1 );
1163  }
1164 
1173  static void CopyOverlapped( char_type* dst, const char_type* src, size_type n )
1174  {
1175  PCL_PRECONDITION( n == 0 || dst != nullptr && src != nullptr )
1176  ::memmove( dst, src, n << 1 );
1177  }
1178 
1199  static int CompareCodePoints( const char_type* s1, size_type n1,
1200  const char_type* s2, size_type n2, bool caseSensitive = true )
1201  {
1202  PCL_COMPARE_CODE_POINTS();
1203  }
1204 
1260  static int Compare( const char_type* s1, size_type n1,
1261  const char_type* s2, size_type n2, bool caseSensitive = true, bool localeAware = true );
1262 
1285  static bool WildMatch( const char_type* t, size_type nt,
1286  const char_type* p, size_type np, bool caseSensitive = true )
1287  {
1288  if ( caseSensitive )
1289  return pcl::WildMatch( t, nt, p, np );
1290  return pcl::WildMatchIC( t, nt, p, np,
1291  []( char_type c ) { return ToCaseFolded( c ); },
1292  []( char_type c ) { return ToCaseFolded( c ); } );
1293  }
1294 
1299  static bool WildMatch( const char_type* t, size_type nt,
1300  const char* p, size_type np, bool caseSensitive = true )
1301  {
1302  if ( caseSensitive )
1303  return pcl::WildMatch( t, nt, p, np );
1304  return pcl::WildMatchIC( t, nt, p, np,
1305  []( char_type c ) { return ToCaseFolded( c ); },
1306  []( char c ) { return IsoCharTraits::ToCaseFolded( c ); } );
1307  }
1308 
1320  static char_type ToCaseFolded( char_type c )
1321  {
1322  if ( c < 256 )
1323  {
1324  if ( c >= 65 && c <= 90 || c >= 192 && c <= 214 || c >= 216 && c <= 222 )
1325  return c + 32;
1326  return c;
1327  }
1328  return PCL_ToCaseFolded( c );
1329  }
1330 
1335  static char_type ToLowercase( char_type c )
1336  {
1337  if ( c < 256 )
1338  {
1339  if ( c >= 65 && c <= 90 || c >= 192 && c <= 214 || c >= 216 && c <= 222 )
1340  return c + 32;
1341  return c;
1342  }
1343  return PCL_ToLowercase( c );
1344  }
1345 
1350  static char_type ToUppercase( char_type c )
1351  {
1352  if ( c < 256 )
1353  {
1354  if ( c >= 97 && c <= 122 || c >= 224 && c <= 246 || c >= 248 && c <= 254 )
1355  return c - 32;
1356  return c;
1357  }
1358  return PCL_ToUppercase( c );
1359  }
1360 
1364  static void ToCaseFolded( char_type* s, size_type n )
1365  {
1366  PCL_PRECONDITION( n == 0 || s != nullptr )
1367  for ( ; n > 0; --n, ++s )
1368  *s = ToCaseFolded( *s );
1369  }
1370 
1374  static void ToLowercase( char_type* s, size_type n )
1375  {
1376  PCL_PRECONDITION( n == 0 || s != nullptr )
1377  for ( ; n > 0; --n, ++s )
1378  *s = ToLowercase( *s );
1379  }
1380 
1384  static void ToUppercase( char_type* s, size_type n )
1385  {
1386  PCL_PRECONDITION( n == 0 || s != nullptr )
1387  for ( ; n > 0; --n, ++s )
1388  *s = ToUppercase( *s );
1389  }
1390 
1397  static constexpr bool IsHighSurrogate( char_type c16 )
1398  {
1399  return (c16 & 0xFC00) == 0xD800;
1400  }
1401 
1408  static constexpr char_type HighSurrogate( char32_type c32 )
1409  {
1410  return char_type( (c32 >> 10) + 0xD7C0 );
1411  }
1412 
1419  static constexpr bool IsLowSurrogate( char_type c16 )
1420  {
1421  return (c16 & 0xFC00) == 0xDC00;
1422  }
1423 
1430  static constexpr char_type LowSurrogate( char32_type c32 )
1431  {
1432  return char_type( (c32%0x400) + 0xDC00 );
1433  }
1434 
1440  static constexpr char32_type SurrogatePairToUTF32( char_type high, char_type low )
1441  {
1442  return (char32_type( high ) << 10) + low - 0x035FDC00;
1443  }
1444 };
1445 
1446 // ----------------------------------------------------------------------------
1447 
1448 } // pcl
1449 
1450 #endif // __PCL_CharTraits_h
1451 
1452 // ----------------------------------------------------------------------------
1453 // EOF pcl/CharTraits.h - Released 2020-07-31T19:33:04Z
traits_base::char_type char_type
Definition: CharTraits.h:870
static constexpr char_type CR()
Definition: CharTraits.h:591
static constexpr char_type Comma()
Definition: CharTraits.h:607
static char_type ToUppercase(char_type c)
Definition: CharTraits.h:1350
static void Fill(char_type *s, char_type c, size_type n)
Definition: CharTraits.h:354
static constexpr bool IsUnderscore(char_type c)
Definition: CharTraits.h:763
static int Compare(const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true, bool localeAware=true)
Definition: CharTraits.h:456
static bool WildMatch(const char_type *t, size_type nt, const char *p, size_type np, bool caseSensitive=true)
Definition: CharTraits.h:1299
static constexpr size_type BytesPerChar()
Definition: CharTraits.h:327
static constexpr bool IsNull(char_type c)
Definition: CharTraits.h:695
static char_type ToCaseFolded(char_type c)
Definition: CharTraits.h:1054
Generic base class of character traits classes.
Definition: CharTraits.h:315
static constexpr char_type ToUppercase(char_type c)
Definition: CharTraits.h:529
static void ToLowercase(char_type *s, size_type n)
Definition: CharTraits.h:1090
unsigned char uint8
Definition: Defs.h:576
static constexpr char_type MinusSign()
Definition: CharTraits.h:647
static constexpr bool IsAlpha(char_type c)
Definition: CharTraits.h:739
static constexpr bool IsExponentDelimiter(char_type c)
Definition: CharTraits.h:807
static constexpr char_type DecimalSeparator()
Definition: CharTraits.h:655
static constexpr char_type HighSurrogate(char32_type c32)
Definition: CharTraits.h:1408
static void ToLowercase(char_type *s, size_type n)
Definition: CharTraits.h:1374
static void CopyOverlapped(char_type *dst, const char_type *src, size_type n)
Definition: CharTraits.h:1173
static constexpr char_type Null()
Definition: CharTraits.h:567
int Compare(FI1 i1, FI1 j1, FI2 i2, FI2 j2)
Definition: Utility.h:639
static void ToCaseFolded(char_type *s, size_type n)
Definition: CharTraits.h:1080
PCL root namespace.
Definition: AbstractImage.h:76
uint16 char16_type
Definition: Defs.h:1075
static constexpr char_type SingleQuote()
Definition: CharTraits.h:679
static void Fill(char_type *s, char_type c, size_type n)
Definition: CharTraits.h:891
static Ptr2 SearchTrimRight(Ptr1 i, Ptr2 j)
Definition: CharTraits.h:841
uint32 char32_type
Definition: Defs.h:1081
A template instantiation of GenericCharTraits for the char type.
Definition: CharTraits.h:858
static constexpr bool IsUppercaseAlpha(char_type c)
Definition: CharTraits.h:755
static char_type ToUppercase(char_type c)
Definition: CharTraits.h:1072
static constexpr char_type PlusSign()
Definition: CharTraits.h:639
static constexpr bool IsWildcard(char_type c)
Definition: CharTraits.h:816
static constexpr bool IsHexDigit(char_type c)
Definition: CharTraits.h:730
static constexpr size_type Length(const char_type *s)
Definition: CharTraits.h:879
static void CopyOverlapped(char_type *dst, const char_type *src, size_type n)
Definition: CharTraits.h:922
traits_base::char_type char_type
Definition: CharTraits.h:1130
static constexpr char_type Hyphen()
Definition: CharTraits.h:631
static void ToUppercase(char_type *s, size_type n)
Definition: CharTraits.h:557
static constexpr char_type ExponentDelimiter()
Definition: CharTraits.h:663
static constexpr bool IsDigit(char_type c)
Definition: CharTraits.h:721
static void ToUppercase(char_type *s, size_type n)
Definition: CharTraits.h:1384
size_t size_type
Definition: Defs.h:543
static void ToUppercase(char_type *s, size_type n)
Definition: CharTraits.h:1100
static constexpr char_type Blank()
Definition: CharTraits.h:575
static constexpr char_type Semicolon()
Definition: CharTraits.h:623
static int CompareCodePoints(const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true)
Definition: CharTraits.h:1199
static constexpr bool IsSign(char_type c)
Definition: CharTraits.h:789
static void ToCaseFolded(char_type *s, size_type n)
Definition: CharTraits.h:1364
GenericCharTraits< char > traits_base
Definition: CharTraits.h:865
A template instantiation of GenericCharTraits for char16_type.
Definition: CharTraits.h:1118
GenericCharTraits< char16_type > traits_base
Definition: CharTraits.h:1125
static constexpr char_type Colon()
Definition: CharTraits.h:615
static constexpr bool IsLowercaseAlpha(char_type c)
Definition: CharTraits.h:747
static void CopyOverlapped(char_type *dst, const char_type *src, size_type n)
Definition: CharTraits.h:386
static constexpr char_type LowSurrogate(char32_type c32)
Definition: CharTraits.h:1430
static char_type ToCaseFolded(char_type c)
Definition: CharTraits.h:1320
static char_type ToLowercase(char_type c)
Definition: CharTraits.h:1335
static constexpr char_type ToLowercase(char_type c)
Definition: CharTraits.h:515
static constexpr bool IsSpace(char_type c)
Definition: CharTraits.h:703
static int CompareCodePoints(const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true)
Definition: CharTraits.h:948
static constexpr bool IsSymbolDigit(char_type c)
Definition: CharTraits.h:772
static constexpr bool IsDecimalSeparator(char_type c)
Definition: CharTraits.h:797
static size_type Length(const char_type *s)
Definition: CharTraits.h:1139
static bool WildMatch(const char_type *t, size_type nt, const char_type *p, size_type np, bool caseSensitive=true)
Definition: CharTraits.h:1034
static void Copy(char_type *dst, const char_type *src, size_type n)
Definition: CharTraits.h:908
static constexpr char32_type SurrogatePairToUTF32(char_type high, char_type low)
Definition: CharTraits.h:1440
static constexpr bool IsHighSurrogate(char_type c16)
Definition: CharTraits.h:1397
static void Copy(char_type *dst, const char_type *src, size_type n)
Definition: CharTraits.h:1159
static constexpr char_type Tab()
Definition: CharTraits.h:583
static char_type ToLowercase(char_type c)
Definition: CharTraits.h:1063
static constexpr char_type Underscore()
Definition: CharTraits.h:671
static char_type ToCaseFolded(char_type c)
Definition: CharTraits.h:503
static bool WildMatch(const char_type *t, size_type nt, const char_type *p, size_type np, bool caseSensitive=true)
Definition: CharTraits.h:1285
static Ptr1 SearchTrimLeft(Ptr1 i, Ptr2 j)
Definition: CharTraits.h:826
static constexpr bool IsLowSurrogate(char_type c16)
Definition: CharTraits.h:1419
static bool WildMatch(const char_type *t, size_type nt, const char_type *p, size_type np, bool caseSensitive=true)
Definition: CharTraits.h:484
static constexpr bool IsTrimable(char_type c)
Definition: CharTraits.h:712
static size_type Length(const char_type *s)
Definition: CharTraits.h:339
static constexpr char_type DoubleQuote()
Definition: CharTraits.h:687
static constexpr bool IsStartingSymbolDigit(char_type c)
Definition: CharTraits.h:781
static constexpr char_type LF()
Definition: CharTraits.h:599
static void Copy(char_type *dst, const char_type *src, size_type n)
Definition: CharTraits.h:372
static void ToLowercase(char_type *s, size_type n)
Definition: CharTraits.h:543
static int CompareCodePoints(const char_type *s1, size_type n1, const char_type *s2, size_type n2, bool caseSensitive=true)
Definition: CharTraits.h:418