Ztring.h
Go to the documentation of this file.
/* Copyright (c) MediaArea.net SARL. All Rights Reserved.
*
* Use of this source code is governed by a zlib-style license that can
* be found in the License.txt file in the root of the source tree.
*/
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// More methods for std::(w)string
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef ZenLib_ZtringH
#define ZenLib_ZtringH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "ZenLib/Utils.h"
#include <string>
#include <sstream>
//---------------------------------------------------------------------------
namespace ZenLib
{
//---------------------------------------------------------------------------
typedef std::basic_string<Char, std::char_traits<Char>, std::allocator<Char> > tstring;
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
/// @brief Options for Ztring methods
enum ztring_t
{
Ztring_Nothing,
Ztring_Rounded = 1, ///< if >.5, upper, else lower
Ztring_CaseSensitive = 2, ///< Case sensitive ("A" and "a" are different)
Ztring_AddLastItem = 4, ///< if Begin is found and End is not found, return between Begin and end of string
Ztring_Recursive = 8, ///< Do all strings
Ztring_NoZero = 16 ///> Doesn't keep Zero in the float number
};
//---------------------------------------------------------------------------
//***************************************************************************
/// @brief String manipulation (based on std::(w)string)
//***************************************************************************
class Ztring : public tstring //for details about undocumented methods see http://www.sgi.com/tech/stl/basic_string.html
{
public :
//Constructor/destructor
Ztring () : tstring(){}
Ztring (const tstring& str) : tstring(str){}
Ztring (const tstring& str, size_type pos, size_type n=npos) : tstring(str, pos, n){}
Ztring (const Char* s, size_type n) : tstring(s, n){}
Ztring (const Char* s) : tstring(s){}
Ztring (size_type n, Char c) : tstring(n, c){}
#ifdef UNICODE
Ztring (const char* S) : tstring(){From_UTF8(S);}
Ztring (const char* S, size_type n) : tstring(){From_UTF8(S, 0, n);}
#endif //UNICODE
//Operators
///Same as [], but resize the string if Pos doesn't exist yet
Char &operator () (size_type Pos);
//Assign
bool Assign_FromFile (const Ztring &FileName);
//Conversions - From
#ifndef WSTRING_MISSING
/// @brief convert an Unicode encoded string into Ztring
Ztring& From_Unicode (const std::wstring &S) {return From_Unicode(S.c_str());}
#endif //WSTRING_MISSING
/// @brief convert an Unicode encoded wchar_t into Ztring
Ztring& From_Unicode (const wchar_t S);
/// @brief convert an Unicode encoded string into Ztring
Ztring& From_Unicode (const wchar_t *S);
/// @brief convert an Unicode encoded string into Ztring
Ztring& From_Unicode (const wchar_t *S, size_type Start, size_type Length);
/// @brief convert an Unicode encoded string into Ztring
Ztring& From_Unicode (const wchar_t *S, size_type Length) {return From_Unicode(S, 0, Length);}
/// @brief convert an UTF-8 encoded string into Ztring
Ztring& From_UTF8 (const std::string &S) {return From_UTF8(S.c_str());}
/// @brief convert an UTF-8 encoded string into Ztring
Ztring& From_UTF8 (const char *S);
/// @brief convert an UTF-8 encoded string into Ztring
Ztring& From_UTF8 (const char *S, size_type Start, size_type Length);
/// @brief convert an UTF-8 encoded string into Ztring
Ztring& From_UTF8 (const char *S, size_type Length) {return From_UTF8(S, 0, Length);}
/// @brief convert an UTF-16 encoded string into Ztring
Ztring& From_UTF16 (const char *S);
/// @brief convert an UTF-16 encoded string into Ztring
Ztring& From_UTF16 (const char *S, size_type Start, size_type Length);
/// @brief convert an UTF-16 encoded string into Ztring
Ztring& From_UTF16 (const char *S, size_type Length) {return From_UTF16(S, 0, Length);}
/// @brief convert an UTF-16BE encoded string into Ztring
Ztring& From_UTF16BE (const char *S);
/// @brief convert an UTF-16BE encoded string into Ztring
Ztring& From_UTF16BE (const char *S, size_type Start, size_type Length);
/// @brief convert an UTF-16BE encoded string into Ztring
Ztring& From_UTF16BE (const char *S, size_type Length) {return From_UTF16BE(S, 0, Length);}
/// @brief convert an UTF-16LE encoded string into Ztring
Ztring& From_UTF16LE (const char *S);
/// @brief convert an UTF-16LE encoded string into Ztring
Ztring& From_UTF16LE (const char *S, size_type Start, size_type Length);
/// @brief convert an UTF-16LE encoded string into Ztring
Ztring& From_UTF16LE (const char *S, size_type Length) {return From_UTF16LE(S, 0, Length);}
/// @brief convert an Locael encoded string into Ztring
Ztring& From_Local (const std::string &S) {return From_Local(S.c_str());}
/// @brief convert an Local encoded string into Ztring
Ztring& From_Local (const char *S);
/// @brief convert an Local encoded string into Ztring
Ztring& From_Local (const char *S, size_type Start, size_type Length);
/// @brief convert an Local encoded string into Ztring
Ztring& From_Local (const char *S, size_type Length) {return From_Local(S, 0, Length);}
/// @brief convert an ISO-8859-1 encoded string into Ztring
Ztring& From_ISO_8859_1 (const char *S);
/// @brief convert an ISO-8859-1 encoded string into Ztring
Ztring& From_ISO_8859_1 (const char *S, size_type Start, size_type Length);
/// @brief convert an ISO-8859-1 encoded string into Ztring
Ztring& From_ISO_8859_1 (const char *S, size_type Length) {return From_ISO_8859_1(S, 0, Length);}
/// @brief convert an ISO-8859-2 encoded string into Ztring
Ztring& From_ISO_8859_2 (const char *S);
/// @brief convert an ISO-8859-1 encoded string into Ztring
Ztring& From_ISO_8859_2 (const char *S, size_type Start, size_type Length);
/// @brief convert an ISO-8859-1 encoded string into Ztring
Ztring& From_ISO_8859_2 (const char *S, size_type Length) {return From_ISO_8859_2(S, 0, Length);}
/// @brief convert an 16 byte GUID into Ztring
Ztring& From_GUID (const int128u S);
/// @brief convert an 16 byte UUID into Ztring
Ztring& From_UUID (const int128u S);
/// @brief convert an 4 Character Code into Ztring
Ztring& From_CC4 (const char *S) {return From_Local(S, 0, 4);}
/// @brief convert an 4 Character Code into Ztring
Ztring& From_CC4 (const int8u *S) {return From_Local((const char*)S, 0, 4);}
/// @brief convert an 4 Character Code into Ztring
Ztring& From_CC4 (const int32u S);
/// @brief convert an 2 Character Code into Ztring
Ztring& From_CC3 (const char *S) {return From_Local(S, 0, 3);}
/// @brief convert an 4 Character Code into Ztring
Ztring& From_CC3 (const int8u *S) {return From_Local((const char*)S, 0, 3);}
/// @brief convert an 4 Character Code into Ztring
Ztring& From_CC3 (const int32u S);
/// @brief convert an 2 Character Code into Ztring
Ztring& From_CC2 (const char *S) {return From_CC2(ZenLib::CC2(S));}
/// @brief convert an 2 Character Code into Ztring
Ztring& From_CC2 (const int8u *S) {return From_CC2(ZenLib::CC2(S));}
/// @brief convert an 2 Character Code into Ztring
Ztring& From_CC2 (const int16u S);
/// @brief convert an 1 Character Code into Ztring
Ztring& From_CC1 (const char *S) {return From_CC1(ZenLib::CC1(S));}
/// @brief convert an 1 Character Code into Ztring
Ztring& From_CC1 (const int8u *S) {return From_CC1(ZenLib::CC1(S));}
/// @brief convert an 1 Character Code into Ztring
Ztring& From_CC1 (const int8u S);
/// @brief convert number into Ztring
Ztring& From_Number (const int8s, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int8u, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int16s, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int16u, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int32s, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int32u, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int64s, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int64u, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const int128u, int8u Radix=10);
/// @brief convert number into Ztring
Ztring& From_Number (const float32, int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
/// @brief convert number into Ztring
Ztring& From_Number (const float64, int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
/// @brief convert number into Ztring
Ztring& From_Number (const float80, int8u AfterComma=3, ztring_t Options=Ztring_Nothing);
#ifdef SIZE_T_IS_LONG
/// @brief convert number into Ztring
Ztring& From_Number (const size_t, int8u Radix=10);
#endif //SIZE_T_IS_LONG
/// @brief convert number (BCD coded) into Ztring
Ztring& From_BCD (const int8u);
/// @brief convert count of milliseconds into a readable and sortable string
Ztring& Duration_From_Milliseconds (const int64s Milliseconds);
/// @deprecated replaced by the int64s version
Ztring& Duration_From_Milliseconds (const int64u Milliseconds);
/// @brief convert count of seconds since 1601 into a readable and sortable string
Ztring& Date_From_Milliseconds_1601 (const int64u Milliseconds);
/// @brief convert count of seconds since 1601 into a readable and sortable string
Ztring& Date_From_Seconds_1601 (const int64u Seconds);
/// @brief convert count of seconds since 1900 into a readable and sortable string
Ztring& Date_From_Seconds_1900 (const int32u Seconds);
/// @brief convert count of seconds since 1900 into a readable and sortable string
Ztring& Date_From_Seconds_1900 (const int64s Seconds);
/// @brief convert count of seconds since 1904 into a readable and sortable string
Ztring& Date_From_Seconds_1904 (const int32u Seconds);
/// @brief convert count of seconds since 1904 into a readable and sortable string
Ztring& Date_From_Seconds_1904 (const int64u Seconds);
/// @brief convert count of seconds since 1904 into a readable and sortable string
Ztring& Date_From_Seconds_1904 (const int64s Seconds);
/// @brief convert count of seconds since 1970 into a readable and sortable string
Ztring& Date_From_Seconds_1970 (const int32u Seconds);
/// @brief convert count of seconds since 1970 into a readable and sortable string
Ztring& Date_From_Seconds_1970 (const int32s Seconds);
/// @brief convert count of seconds since 1970 into a readable and sortable string
Ztring& Date_From_Seconds_1970 (const int64s Seconds);
/// @brief convert count of seconds since 1970 into a readable and sortable string (in local time)
Ztring& Date_From_Seconds_1970_Local (const int32u Seconds);
/// @brief convert a free formated string into a readable and sortable string
Ztring& Date_From_String (const char* Date, size_type Value_Size=Error);
/// @brief convert numbers into a readable and sortable string
Ztring& Date_From_Numbers (const int8u Year, const int8u Month, const int8u Day, const int8u Hour, const int8u Minute, const int8u Second);
//Conversions - To
#ifndef WSTRING_MISSING
/// @brief Convert into Unicode chars
/// @return the string corresponding \n
std::wstring To_Unicode () const;
#endif //WSTRING_MISSING
/// @brief Convert into char* (UTF-8 encoded)
/// @return the string corresponding \n
std::string To_UTF8 () const;
/// @brief Convert into char* (Local encoded)
/// @return the string corresponding \n
std::string To_Local () const;
/// @brief Convert into 16 byte UUID number
/// @return the value corresponding \n
/// 0 if there is a problem
int128u To_UUID () const;
/// @brief Convert into a 4 Character Code
/// @return the value corresponding \n
/// 0 if there is a problem
int32u To_CC4 () const;
/// @brief Convert into Int (8 bits)
/// @return the value corresponding \n
/// 0 if there is a problem
int8s To_int8s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into unsigned Int (8 bits)
/// @return the value corresponding
/// 0 if there is a problem
int8u To_int8u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into Int (16 bits)
/// @return the value corresponding \n
/// 0 if there is a problem
int16s To_int16s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into unsigned Int (16 bits)
/// @return the value corresponding
/// 0 if there is a problem
int16u To_int16u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into Int (32 bits)
/// @return the value corresponding \n
/// 0 if there is a problem
int32s To_int32s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into unsigned Int (32 bits)
/// @return the value corresponding
/// 0 if there is a problem
int32u To_int32u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into Int (64 bits)
/// @return the value corresponding \n
/// 0 if there is a problem
int64s To_int64s (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into unsigned Int (64 bits)
/// @return the value corresponding \n
/// 0 if there is a problem
int64u To_int64u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into unsigned Int (64 bits)
/// @warning only hexadecimal and no rounding are currenlty supported \n
/// @return the value corresponding \n
/// 0 if there is a problem
int128u To_int128u (int8u Radix=10, ztring_t Options=Ztring_Rounded) const;
/// @brief Convert into float
/// @return the value corresponding \n
/// 0 if there is a problem
float32 To_float32 (ztring_t Options=Ztring_Nothing) const;
float64 To_float64 (ztring_t Options=Ztring_Nothing) const;
float80 To_float80 (ztring_t Options=Ztring_Nothing) const;
//Static versions
static Ztring ToZtring_From_Local(const std::string &S) {return Ztring().From_Local(S);}
static Ztring ToZtring_From_Local(const char *S) {return Ztring().From_Local(S);}
static Ztring ToZtring_From_Local(const char *S, size_type Start, size_type Length) {return Ztring().From_Local(S, Start, Length);}
static Ztring ToZtring_From_Local(const char *S, size_type Length) {return Ztring().From_Local(S, Length);}
static Ztring ToZtring_From_CC4 (const char *S) {return Ztring().From_CC4(S);}
static Ztring ToZtring_From_CC4 (const int8u *S) {return Ztring().From_CC4(S);}
static Ztring ToZtring_From_CC4 (const int32u S) {return Ztring().From_CC4(S);}
static Ztring ToZtring_From_CC3 (const char *S) {return Ztring().From_CC3(S);}
static Ztring ToZtring_From_CC3 (const int8u *S) {return Ztring().From_CC3(S);}
static Ztring ToZtring_From_CC3 (const int32u S) {return Ztring().From_CC3(S);}
static Ztring ToZtring_From_CC2 (const char *S) {return Ztring().From_CC2(S);}
static Ztring ToZtring_From_CC2 (const int8u *S) {return Ztring().From_CC2(S);}
static Ztring ToZtring_From_CC2 (const int16u S) {return Ztring().From_CC2(S);}
static Ztring ToZtring_From_CC1 (const char *S) {return Ztring().From_CC1(S);}
static Ztring ToZtring_From_CC1 (const int8u *S) {return Ztring().From_CC1(S);}
static Ztring ToZtring_From_CC1 (const int8u S) {return Ztring().From_CC1(S);}
static Ztring ToZtring (const int8s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int8u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int16s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int16u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int32s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int32u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int64s I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int64u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const int128u I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
static Ztring ToZtring (const float32 F, int8u AfterComma=3) {return Ztring().From_Number(F, AfterComma);}
static Ztring ToZtring (const float64 F, int8u AfterComma=3) {return Ztring().From_Number(F, AfterComma);}
static Ztring ToZtring (const float80 F, int8u AfterComma=3) {return Ztring().From_Number(F, AfterComma);}
#ifdef SIZE_T_IS_LONG
static Ztring ToZtring (const size_t I, int8u Radix=10) {return Ztring().From_Number(I, Radix);}
#endif //SIZE_T_IS_LONG
//Edition
/// @brief test if it is a number
bool IsNumber() const;
/// @brief convert into lowercase
Ztring &MakeLowerCase();
/// @brief convert into uppercase
Ztring &MakeUpperCase();
/// @brief Remove leading whitespaces from a string
Ztring &TrimLeft(Char ToTrim=__T(' '));
/// @brief Remove trailing whitespaces from a string
Ztring &TrimRight(Char ToTrim=__T(' '));
/// @brief Remove leading and trailing whitespaces from a string
Ztring &Trim(Char ToTrim=__T(' '));
/// @brief Quotes a string
Ztring &Quote(Char ToTrim=__T('\"'));
/// @brief return a string between two strings
/// @param Begin First string
/// @param End Second string
/// @param Pos Position to begin to scan string
/// @param Options Options for searching \n
/// Available : Ztring_CaseSensitive
/// @return The substring \n
/// "" if not found
Ztring SubString (const tstring &Begin, const tstring &End, size_type Pos=0, ztring_t Options=Ztring_Nothing) const;
/// @brief replace a string by another one
/// @param ToFind string to find
/// @param ReplaceBy string wich replace the string found
/// @param Pos Position to begin to scan string
/// @param Options Options for searching \n
/// Available : Ztring_CaseSensitive, Ztring_Recursive
/// @return The count of replacements
size_type FindAndReplace (const tstring &ToFind, const tstring &ReplaceBy, size_type Pos=0, ztring_t Options=Ztring_Nothing); //Remplace une chaine par une autre
/// @brief Count the number of occurencies of a string in the string
/// @param ToCount string to count
/// @param Options Options for count \n
/// Available : Ztring_CaseSensitive
/// @return the count
//Information
size_type Count (const Ztring &ToCount, ztring_t Options=Ztring_Nothing) const;
/// @brief compare with another string
/// @param ToCompare string to compare with
/// @param Options Options for comaparing \n
/// Available : Ztring_CaseSensitive
/// @return The result of comparasion
bool Compare (const Ztring &ToCompare, const Ztring &Comparator=__T("=="), ztring_t Options=Ztring_Nothing) const;
};
} //NameSpace
#endif
__T
#define __T(__x)
Definition Conf.h:227
Utils.h
ZenLib::FileName
File name manipulation.
Definition FileName.h:30
ZenLib::Ztring
String manipulation (based on std::(w)string).
Definition Ztring.h:50
ZenLib::Ztring::To_float32
float32 To_float32(ztring_t Options=Ztring_Nothing) const
Convert into float.
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int8s I, int8u Radix=10)
Definition Ztring.h:303
ZenLib::Ztring::SubString
Ztring SubString(const tstring &Begin, const tstring &End, size_type Pos=0, ztring_t Options=Ztring_Nothing) const
return a string between two strings
ZenLib::Ztring::ToZtring_From_CC1
static Ztring ToZtring_From_CC1(const int8u S)
Definition Ztring.h:302
ZenLib::Ztring::From_CC2
Ztring & From_CC2(const char *S)
convert an 2 Character Code into Ztring
Definition Ztring.h:150
ZenLib::Ztring::To_int16s
int16s To_int16s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (16 bits).
ZenLib::Ztring::Trim
Ztring & Trim(Char ToTrim=__T(' '))
Remove leading and trailing whitespaces from a string.
ZenLib::Ztring::Ztring
Ztring(const Char *s)
Definition Ztring.h:57
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int64u I, int8u Radix=10)
Definition Ztring.h:310
ZenLib::Ztring::operator()
Char & operator()(size_type Pos)
Same as [], but resize the string if Pos doesn't exist yet.
ZenLib::Ztring::ToZtring_From_CC2
static Ztring ToZtring_From_CC2(const int8u *S)
Definition Ztring.h:298
ZenLib::Ztring::ToZtring_From_CC1
static Ztring ToZtring_From_CC1(const int8u *S)
Definition Ztring.h:301
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const char *S, size_type Length)
Definition Ztring.h:290
ZenLib::Ztring::From_CC1
Ztring & From_CC1(const int8u S)
convert an 1 Character Code into Ztring
ZenLib::Ztring::Ztring
Ztring()
Definition Ztring.h:53
ZenLib::Ztring::From_UTF16LE
Ztring & From_UTF16LE(const char *S, size_type Start, size_type Length)
convert an UTF-16LE encoded string into Ztring
ZenLib::Ztring::To_int32s
int32s To_int32s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (32 bits).
ZenLib::Ztring::MakeLowerCase
Ztring & MakeLowerCase()
convert into lowercase
ZenLib::Ztring::ToZtring_From_CC3
static Ztring ToZtring_From_CC3(const int8u *S)
Definition Ztring.h:295
ZenLib::Ztring::ToZtring_From_CC2
static Ztring ToZtring_From_CC2(const int16u S)
Definition Ztring.h:299
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const std::string &S)
Definition Ztring.h:287
ZenLib::Ztring::From_CC4
Ztring & From_CC4(const int8u *S)
convert an 4 Character Code into Ztring
Definition Ztring.h:140
ZenLib::Ztring::Date_From_Seconds_1970
Ztring & Date_From_Seconds_1970(const int64s Seconds)
convert count of seconds since 1970 into a readable and sortable string
ZenLib::Ztring::From_UTF8
Ztring & From_UTF8(const char *S, size_type Length)
convert an UTF-8 encoded string into Ztring
Definition Ztring.h:91
ZenLib::Ztring::Date_From_Seconds_1970
Ztring & Date_From_Seconds_1970(const int32s Seconds)
convert count of seconds since 1970 into a readable and sortable string
ZenLib::Ztring::From_UTF16LE
Ztring & From_UTF16LE(const char *S, size_type Length)
convert an UTF-16LE encoded string into Ztring
Definition Ztring.h:109
ZenLib::Ztring::To_int128u
int128u To_int128u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (64 bits).
ZenLib::Ztring::Date_From_Seconds_1970_Local
Ztring & Date_From_Seconds_1970_Local(const int32u Seconds)
convert count of seconds since 1970 into a readable and sortable string (in local time)
ZenLib::Ztring::IsNumber
bool IsNumber() const
test if it is a number
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int64s I, int8u Radix=10)
Definition Ztring.h:309
ZenLib::Ztring::From_CC3
Ztring & From_CC3(const char *S)
convert an 2 Character Code into Ztring
Definition Ztring.h:144
ZenLib::Ztring::From_Local
Ztring & From_Local(const char *S, size_type Length)
convert an Local encoded string into Ztring
Definition Ztring.h:117
ZenLib::Ztring::From_Number
Ztring & From_Number(const int16s, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::TrimLeft
Ztring & TrimLeft(Char ToTrim=__T(' '))
Remove leading whitespaces from a string.
ZenLib::Ztring::From_Number
Ztring & From_Number(const int8s, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::To_int8s
int8s To_int8s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (8 bits).
ZenLib::Ztring::From_UTF16
Ztring & From_UTF16(const char *S)
convert an UTF-16 encoded string into Ztring
ZenLib::Ztring::From_UTF16BE
Ztring & From_UTF16BE(const char *S, size_type Start, size_type Length)
convert an UTF-16BE encoded string into Ztring
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const char *S)
Definition Ztring.h:288
ZenLib::Ztring::Date_From_String
Ztring & Date_From_String(const char *Date, size_type Value_Size=Error)
convert a free formated string into a readable and sortable string
ZenLib::Ztring::To_float64
float64 To_float64(ztring_t Options=Ztring_Nothing) const
ZenLib::Ztring::From_ISO_8859_1
Ztring & From_ISO_8859_1(const char *S, size_type Length)
convert an ISO-8859-1 encoded string into Ztring
Definition Ztring.h:124
ZenLib::Ztring::From_Local
Ztring & From_Local(const char *S)
convert an Local encoded string into Ztring
ZenLib::Ztring::Date_From_Seconds_1601
Ztring & Date_From_Seconds_1601(const int64u Seconds)
convert count of seconds since 1601 into a readable and sortable string
ZenLib::Ztring::From_GUID
Ztring & From_GUID(const int128u S)
convert an 16 byte GUID into Ztring
ZenLib::Ztring::From_Unicode
Ztring & From_Unicode(const std::wstring &S)
convert an Unicode encoded string into Ztring
Definition Ztring.h:74
ZenLib::Ztring::From_UTF16BE
Ztring & From_UTF16BE(const char *S, size_type Length)
convert an UTF-16BE encoded string into Ztring
Definition Ztring.h:103
ZenLib::Ztring::From_Number
Ztring & From_Number(const int16u, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::From_Number
Ztring & From_Number(const int64s, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::Date_From_Seconds_1904
Ztring & Date_From_Seconds_1904(const int64s Seconds)
convert count of seconds since 1904 into a readable and sortable string
ZenLib::Ztring::To_int32u
int32u To_int32u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (32 bits).
ZenLib::Ztring::Duration_From_Milliseconds
Ztring & Duration_From_Milliseconds(const int64u Milliseconds)
ZenLib::Ztring::ToZtring_From_CC2
static Ztring ToZtring_From_CC2(const char *S)
Definition Ztring.h:297
ZenLib::Ztring::From_Unicode
Ztring & From_Unicode(const wchar_t *S, size_type Start, size_type Length)
convert an Unicode encoded string into Ztring
ZenLib::Ztring::To_float80
float80 To_float80(ztring_t Options=Ztring_Nothing) const
ZenLib::Ztring::Date_From_Milliseconds_1601
Ztring & Date_From_Milliseconds_1601(const int64u Milliseconds)
convert count of seconds since 1601 into a readable and sortable string
ZenLib::Ztring::From_CC4
Ztring & From_CC4(const int32u S)
convert an 4 Character Code into Ztring
ZenLib::Ztring::From_UTF16BE
Ztring & From_UTF16BE(const char *S)
convert an UTF-16BE encoded string into Ztring
ZenLib::Ztring::From_CC4
Ztring & From_CC4(const char *S)
convert an 4 Character Code into Ztring
Definition Ztring.h:138
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int8u I, int8u Radix=10)
Definition Ztring.h:304
ZenLib::Ztring::Date_From_Seconds_1900
Ztring & Date_From_Seconds_1900(const int32u Seconds)
convert count of seconds since 1900 into a readable and sortable string
ZenLib::Ztring::From_CC1
Ztring & From_CC1(const char *S)
convert an 1 Character Code into Ztring
Definition Ztring.h:156
ZenLib::Ztring::ToZtring_From_CC4
static Ztring ToZtring_From_CC4(const int32u S)
Definition Ztring.h:293
ZenLib::Ztring::Quote
Ztring & Quote(Char ToTrim=__T('\"'))
Quotes a string.
ZenLib::Ztring::From_UTF8
Ztring & From_UTF8(const std::string &S)
convert an UTF-8 encoded string into Ztring
Definition Ztring.h:85
ZenLib::Ztring::Date_From_Seconds_1904
Ztring & Date_From_Seconds_1904(const int64u Seconds)
convert count of seconds since 1904 into a readable and sortable string
ZenLib::Ztring::ToZtring_From_CC1
static Ztring ToZtring_From_CC1(const char *S)
Definition Ztring.h:300
ZenLib::Ztring::From_CC1
Ztring & From_CC1(const int8u *S)
convert an 1 Character Code into Ztring
Definition Ztring.h:158
ZenLib::Ztring::To_int8u
int8u To_int8u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (8 bits).
ZenLib::Ztring::From_ISO_8859_1
Ztring & From_ISO_8859_1(const char *S)
convert an ISO-8859-1 encoded string into Ztring
ZenLib::Ztring::ToZtring_From_CC4
static Ztring ToZtring_From_CC4(const char *S)
Definition Ztring.h:291
ZenLib::Ztring::To_UUID
int128u To_UUID() const
Convert into 16 byte UUID number.
ZenLib::Ztring::From_ISO_8859_2
Ztring & From_ISO_8859_2(const char *S, size_type Length)
convert an ISO-8859-1 encoded string into Ztring
Definition Ztring.h:131
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int128u I, int8u Radix=10)
Definition Ztring.h:311
ZenLib::Ztring::From_ISO_8859_2
Ztring & From_ISO_8859_2(const char *S, size_type Start, size_type Length)
convert an ISO-8859-1 encoded string into Ztring
ZenLib::Ztring::To_CC4
int32u To_CC4() const
Convert into a 4 Character Code.
ZenLib::Ztring::ToZtring_From_CC4
static Ztring ToZtring_From_CC4(const int8u *S)
Definition Ztring.h:292
ZenLib::Ztring::To_Local
std::string To_Local() const
Convert into char* (Local encoded).
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const float80 F, int8u AfterComma=3)
Definition Ztring.h:314
ZenLib::Ztring::From_Number
Ztring & From_Number(const int8u, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::To_int64u
int64u To_int64u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (64 bits).
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int32s I, int8u Radix=10)
Definition Ztring.h:307
ZenLib::Ztring::From_UTF16LE
Ztring & From_UTF16LE(const char *S)
convert an UTF-16LE encoded string into Ztring
ZenLib::Ztring::From_ISO_8859_1
Ztring & From_ISO_8859_1(const char *S, size_type Start, size_type Length)
convert an ISO-8859-1 encoded string into Ztring
ZenLib::Ztring::Count
size_type Count(const Ztring &ToCount, ztring_t Options=Ztring_Nothing) const
Count the number of occurencies of a string in the string.
ZenLib::Ztring::FindAndReplace
size_type FindAndReplace(const tstring &ToFind, const tstring &ReplaceBy, size_type Pos=0, ztring_t Options=Ztring_Nothing)
replace a string by another one
ZenLib::Ztring::From_Number
Ztring & From_Number(const int32u, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::From_Number
Ztring & From_Number(const float32, int8u AfterComma=3, ztring_t Options=Ztring_Nothing)
convert number into Ztring
ZenLib::Ztring::From_CC2
Ztring & From_CC2(const int16u S)
convert an 2 Character Code into Ztring
ZenLib::Ztring::From_Number
Ztring & From_Number(const int64u, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::From_CC3
Ztring & From_CC3(const int8u *S)
convert an 4 Character Code into Ztring
Definition Ztring.h:146
ZenLib::Ztring::ToZtring_From_Local
static Ztring ToZtring_From_Local(const char *S, size_type Start, size_type Length)
Definition Ztring.h:289
ZenLib::Ztring::From_Number
Ztring & From_Number(const float64, int8u AfterComma=3, ztring_t Options=Ztring_Nothing)
convert number into Ztring
ZenLib::Ztring::From_UTF8
Ztring & From_UTF8(const char *S, size_type Start, size_type Length)
convert an UTF-8 encoded string into Ztring
ZenLib::Ztring::From_Unicode
Ztring & From_Unicode(const wchar_t *S, size_type Length)
convert an Unicode encoded string into Ztring
Definition Ztring.h:83
ZenLib::Ztring::From_UTF16
Ztring & From_UTF16(const char *S, size_type Start, size_type Length)
convert an UTF-16 encoded string into Ztring
ZenLib::Ztring::Ztring
Ztring(size_type n, Char c)
Definition Ztring.h:58
ZenLib::Ztring::From_UTF16
Ztring & From_UTF16(const char *S, size_type Length)
convert an UTF-16 encoded string into Ztring
Definition Ztring.h:97
ZenLib::Ztring::Ztring
Ztring(const tstring &str)
Definition Ztring.h:54
ZenLib::Ztring::From_Local
Ztring & From_Local(const char *S, size_type Start, size_type Length)
convert an Local encoded string into Ztring
ZenLib::Ztring::Assign_FromFile
bool Assign_FromFile(const Ztring &FileName)
ZenLib::Ztring::TrimRight
Ztring & TrimRight(Char ToTrim=__T(' '))
Remove trailing whitespaces from a string.
ZenLib::Ztring::ToZtring_From_CC3
static Ztring ToZtring_From_CC3(const int32u S)
Definition Ztring.h:296
ZenLib::Ztring::To_Unicode
std::wstring To_Unicode() const
Convert into Unicode chars.
ZenLib::Ztring::From_Number
Ztring & From_Number(const int32s, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::Date_From_Numbers
Ztring & Date_From_Numbers(const int8u Year, const int8u Month, const int8u Day, const int8u Hour, const int8u Minute, const int8u Second)
convert numbers into a readable and sortable string
ZenLib::Ztring::Date_From_Seconds_1900
Ztring & Date_From_Seconds_1900(const int64s Seconds)
convert count of seconds since 1900 into a readable and sortable string
ZenLib::Ztring::From_CC3
Ztring & From_CC3(const int32u S)
convert an 4 Character Code into Ztring
ZenLib::Ztring::From_CC2
Ztring & From_CC2(const int8u *S)
convert an 2 Character Code into Ztring
Definition Ztring.h:152
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int16u I, int8u Radix=10)
Definition Ztring.h:306
ZenLib::Ztring::Ztring
Ztring(const tstring &str, size_type pos, size_type n=npos)
Definition Ztring.h:55
ZenLib::Ztring::ToZtring_From_CC3
static Ztring ToZtring_From_CC3(const char *S)
Definition Ztring.h:294
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int32u I, int8u Radix=10)
Definition Ztring.h:308
ZenLib::Ztring::Ztring
Ztring(const Char *s, size_type n)
Definition Ztring.h:56
ZenLib::Ztring::Compare
bool Compare(const Ztring &ToCompare, const Ztring &Comparator=__T("=="), ztring_t Options=Ztring_Nothing) const
compare with another string
ZenLib::Ztring::Date_From_Seconds_1970
Ztring & Date_From_Seconds_1970(const int32u Seconds)
convert count of seconds since 1970 into a readable and sortable string
ZenLib::Ztring::MakeUpperCase
Ztring & MakeUpperCase()
convert into uppercase
ZenLib::Ztring::From_Number
Ztring & From_Number(const float80, int8u AfterComma=3, ztring_t Options=Ztring_Nothing)
convert number into Ztring
ZenLib::Ztring::From_UTF8
Ztring & From_UTF8(const char *S)
convert an UTF-8 encoded string into Ztring
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const float32 F, int8u AfterComma=3)
Definition Ztring.h:312
ZenLib::Ztring::To_int16u
int16u To_int16u(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into unsigned Int (16 bits).
ZenLib::Ztring::From_UUID
Ztring & From_UUID(const int128u S)
convert an 16 byte UUID into Ztring
ZenLib::Ztring::From_Unicode
Ztring & From_Unicode(const wchar_t *S)
convert an Unicode encoded string into Ztring
ZenLib::Ztring::From_Number
Ztring & From_Number(const int128u, int8u Radix=10)
convert number into Ztring
ZenLib::Ztring::From_ISO_8859_2
Ztring & From_ISO_8859_2(const char *S)
convert an ISO-8859-2 encoded string into Ztring
ZenLib::Ztring::Duration_From_Milliseconds
Ztring & Duration_From_Milliseconds(const int64s Milliseconds)
convert count of milliseconds into a readable and sortable string
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const int16s I, int8u Radix=10)
Definition Ztring.h:305
ZenLib::Ztring::ToZtring
static Ztring ToZtring(const float64 F, int8u AfterComma=3)
Definition Ztring.h:313
ZenLib::Ztring::Date_From_Seconds_1904
Ztring & Date_From_Seconds_1904(const int32u Seconds)
convert count of seconds since 1904 into a readable and sortable string
ZenLib::Ztring::To_int64s
int64s To_int64s(int8u Radix=10, ztring_t Options=Ztring_Rounded) const
Convert into Int (64 bits).
ZenLib::Ztring::From_Local
Ztring & From_Local(const std::string &S)
convert an Locael encoded string into Ztring
Definition Ztring.h:111
ZenLib
Definition BitStream.h:24
ZenLib::int128u
uint128 int128u
Definition int128u.h:183
ZenLib::Error
const std::size_t Error
Definition Conf.h:199
ZenLib::Char
char Char
Definition Conf.h:225
ZenLib::ztring_t
ztring_t
Options for Ztring methods.
Definition Ztring.h:34
ZenLib::Ztring_Recursive
@ Ztring_Recursive
Do all strings.
Definition Ztring.h:39
ZenLib::Ztring_Nothing
@ Ztring_Nothing
Definition Ztring.h:35
ZenLib::Ztring_AddLastItem
@ Ztring_AddLastItem
if Begin is found and End is not found, return between Begin and end of string
Definition Ztring.h:38
ZenLib::Ztring_CaseSensitive
@ Ztring_CaseSensitive
Case sensitive ("A" and "a" are different).
Definition Ztring.h:37
ZenLib::Ztring_Rounded
@ Ztring_Rounded
if >.5, upper, else lower
Definition Ztring.h:36
ZenLib::Ztring_NoZero
@ Ztring_NoZero
Definition Ztring.h:40
ZenLib::tstring
std::basic_string< Char, std::char_traits< Char >, std::allocator< Char > > tstring
Definition Ztring.h:28
ZenLib::CC2
int16u CC2(const char *C)
Definition Utils.h:262
ZenLib::CC1
int8u CC1(const char *C)
Definition Utils.h:263