BasicCharTraits.h++

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002    commonc++ - A C++ Common Class Library
00003    Copyright (C) 2005-2012  Mark A Lindner
00004 
00005    This file is part of commonc++.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public
00018    License along with this library; if not, write to the Free
00019    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020    ---------------------------------------------------------------------------
00021 */
00022 
00023 #ifndef __ccxx_BasicCharTraits_hxx
00024 #define __ccxx_BasicCharTraits_hxx
00025 
00026 #include <commonc++/Common.h++>
00027 
00028 #include <cstring>
00029 #include <cctype>
00030 #include <cwchar>
00031 #include <cwctype>
00032 #include <cstdarg>
00033 #include <cstdio>
00034 
00035 namespace ccxx {
00036 
00044 template<typename T> struct BasicCharTraits
00045 {
00051   static size_t length(const T *str) throw();
00052 
00060   static T *copy(T *dest, const T *src, size_t n) throw();
00061 
00071   static T *rawCopy(T *dest, const T *src, size_t n) throw();
00072 
00080   static T *concat(T *dest, const T *src, size_t n) throw();
00081 
00089   static T *move(T *dest, T *src, size_t n) throw();
00090 
00101   static int compare(const T *str1, const T *str2, bool ignoreCase = false)
00102     throw();
00103 
00115   static int rawCompare(const T *str1, const T *str2, size_t n) throw();
00116 
00126   static int collate(const T *str1, const T *str2) throw();
00127 
00139   static int compare(const T *str1, const T *str2, size_t n,
00140                      bool ignoreCase = false) throw();
00141 
00152   static int compare(T c1, T c2, bool ignoreCase = false) throw();
00153 
00161   static size_t span(const T *str, const T *accept) throw();
00162 
00171   static int32_t toLong(const T *str, T **endptr = NULL, int base = 10)
00172     throw();
00173 
00182   static uint32_t toULong(const T *str, T **endptr = NULL, int base = 10)
00183     throw();
00184 
00193   static int64_t toLongLong(const T *str, T **endptr = NULL, int base = 10)
00194     throw();
00195 
00204   static uint64_t toULongLong(const T *str, T **endptr = NULL, int base = 10)
00205     throw();
00206 
00214   static float toFloat(const T *str, T **endptr = NULL) throw();
00215 
00223   static double toDouble(const T *str, T **endptr = NULL) throw();
00224 
00234   static T *find(T *str, T c, size_t len = 0) throw();
00235 
00245   static const T *find(const T *str, T c, size_t len = 0) throw();
00246 
00255   static T *findLast(T *str, T c, uint_t fromIndex = END) throw();
00256 
00265   static const T *findLast(const T *str, T c, uint_t fromIndex = END) throw();
00266 
00274   static T *find(T *str, const T *s) throw();
00275 
00283   static const T *find(const T *str, const T *s) throw();
00284 
00293   static T *findLast(T *str, const T *s, uint_t fromIndex = END) throw();
00294 
00303   static const T *findLast(const T *str, const T *s, uint_t fromIndex = END)
00304     throw();
00305 
00314   static int printf(T *str, size_t len, const T *format, ...) throw();
00315 
00325   static int vprintf(T *str, size_t len, const T *format, va_list vp)
00326     throw();
00327 
00329   static T nul() throw();
00330 
00332   static T plus() throw();
00333 
00335   static T minus() throw();
00336 
00338   static const T *null() throw();
00339 
00341   static const T *empty() throw();
00342 
00344   static const T *whitespace() throw();
00345 
00349   static const T *digits() throw();
00350 
00354   static const T *nullRep() throw();
00355 
00359   static const T *trueRep() throw();
00360 
00364   static const T *falseRep() throw();
00365 
00367   static const T *intFormat() throw();
00368 
00372   static const T *uintFormat() throw();
00373 
00375   static const T *int64Format() throw();
00376 
00380   static const T *uint64Format() throw();
00381 
00385   static const T *doubleFormat() throw();
00386 
00388   static bool isAlpha(T c) throw();
00389 
00391   static bool isAlphaNumeric(T c) throw();
00392 
00394   static bool isWhitespace(T c) throw();
00395 
00397   static bool isPrintable(T c) throw();
00398 
00400   static bool isGraphical(T c) throw();
00401 
00403   static bool isNul(T c) throw();
00404 
00406   static bool isControl(T c) throw();
00407 
00409   static bool isDigit(T c) throw();
00410 
00412   static bool isSign(T c) throw();
00413 
00415   static bool isHexDigit(T c) throw();
00416 
00418   static bool isLowerCase(T c) throw();
00419 
00421   static bool isUpperCase(T c) throw();
00422 
00424   static T toUpperCase(T c) throw();
00425 
00427   static T toLowerCase(T c) throw();
00428 
00433   static T fromInt(int v) throw();
00434 
00439   static int toInt(T c) throw();
00440 
00444   static const char *encoding() throw();
00445 
00447   static const uint_t END = 0xFFFFFFFF;
00448 };
00449 
00450 typedef BasicCharTraits<char> CharTraits;
00451 typedef BasicCharTraits<wchar_t> WCharTraits;
00452 
00453 }; // namespace ccxx
00454 
00455 #endif // __ccxx_BasicCharTraits_hxx
00456 
00457 /* end of header file */
Generated on Sat Nov 26 16:49:07 2011 for libcommonc++ by  doxygen 1.6.3