|
|
1.1 root 1: /*
2: Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
3:
1.1.1.5 ! root 4: Governed by the TrueCrypt License 2.7 the full text of which is contained
1.1 root 5: in the file License.txt included in TrueCrypt binary and source code
6: distribution packages.
7: */
8:
9: #ifndef TC_HEADER_Platform_StringConverter
10: #define TC_HEADER_Platform_StringConverter
11:
12: #include <stdlib.h>
13: #include "PlatformBase.h"
14:
15: namespace TrueCrypt
16: {
17: class StringConverter
18: {
19: public:
1.1.1.4 root 20: static void Erase (string &str);
21: static void Erase (wstring &str);
1.1 root 22: static wstring FromNumber (double number);
1.1.1.2 root 23: static wstring FromNumber (int32 number);
24: static wstring FromNumber (uint32 number);
1.1 root 25: static wstring FromNumber (int64 number);
26: static wstring FromNumber (uint64 number);
27: static string GetTrailingNumber (const string &str);
28: static string GetTypeName (const type_info &typeInfo);
29: static wstring QuoteSpaces (const wstring &str);
30: static vector <string> Split (const string &str, const string &separators = " \t\r\n", bool returnEmptyFields = false);
1.1.1.4 root 31: static string StripTrailingNumber (const string &str);
1.1 root 32: static wstring ToExceptionString (const exception &ex);
1.1.1.3 root 33: static string ToLower (const string &str);
1.1 root 34: static uint32 ToUInt32 (const string &str);
35: static uint32 ToUInt32 (const wstring &str);
36: static uint64 ToUInt64 (const string &str);
37: static uint64 ToUInt64 (const wstring &str);
1.1.1.3 root 38: static string ToSingle (double number) { return ToSingle (FromNumber (number)); }
39: static string ToSingle (int32 number) { return ToSingle (FromNumber (number)); }
40: static string ToSingle (uint32 number) { return ToSingle (FromNumber (number)); }
41: static string ToSingle (int64 number) { return ToSingle (FromNumber (number)); }
42: static string ToSingle (uint64 number) { return ToSingle (FromNumber (number)); }
1.1.1.4 root 43: static string ToSingle (const wstring &wstr, bool noThrow = false);
44: static void ToSingle (const wstring &wstr, string &str, bool noThrow = false);
1.1.1.3 root 45: static string ToUpper (const string &str);
46: static wstring ToWide (double number) { return FromNumber (number); }
47: static wstring ToWide (int32 number) { return FromNumber (number); }
48: static wstring ToWide (uint32 number) { return FromNumber (number); }
49: static wstring ToWide (int64 number) { return FromNumber (number); }
50: static wstring ToWide (uint64 number) { return FromNumber (number); }
1.1 root 51: static wstring ToWide (const string &str, bool noThrow = false);
52: static void ToWideBuffer (const wstring &str, wchar_t *buffer, size_t bufferSize);
53: static string Trim (const string &str);
54:
55: private:
56: StringConverter ();
57: };
58: }
59:
60: #endif // TC_HEADER_Platform_StringConverter
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.