Annotation of truecrypt/main/stringformatter.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  Copyright (c) 2008 TrueCrypt Foundation. All rights reserved.
                      3: 
                      4:  Governed by the TrueCrypt License 2.4 the full text of which is contained
                      5:  in the file License.txt included in TrueCrypt binary and source code
                      6:  distribution packages.
                      7: */
                      8: 
                      9: #ifndef TC_HEADER_Main_StringFormatter
                     10: #define TC_HEADER_Main_StringFormatter
                     11: 
                     12: #include "System.h"
                     13: #include "Main.h"
                     14: 
                     15: namespace TrueCrypt
                     16: {
                     17:        class StringFormatterArg
                     18:        {
                     19:        public:
                     20:                StringFormatterArg () : Empty (true) { }
                     21: 
                     22:                StringFormatterArg (const char c) :                     Empty (false) { string s; s += c; StringArg = StringConverter::ToWide (s); }
                     23:                StringFormatterArg (const wchar_t c) :          Empty (false), Referenced (false), StringArg (c) { }
                     24:                StringFormatterArg (const char *str) :          Empty (false), Referenced (false), StringArg (StringConverter::ToWide (str)) { }
                     25:                StringFormatterArg (const wchar_t *str) :       Empty (false), Referenced (false), StringArg (str) { }
                     26:                StringFormatterArg (const string &str) :        Empty (false), Referenced (false), StringArg (StringConverter::ToWide (str)) { }
                     27:                StringFormatterArg (const wstring &str) :       Empty (false), Referenced (false), StringArg (str) { }
                     28:                StringFormatterArg (const wxString &str) :      Empty (false), Referenced (false), StringArg (str) { }
                     29:                StringFormatterArg (int number) :                       Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
                     30:                StringFormatterArg (int64 number) :                     Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
                     31:                StringFormatterArg (long number) :                      Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
                     32:                StringFormatterArg (unsigned int number) :      Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
                     33:                StringFormatterArg (unsigned long number) :     Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
                     34:                StringFormatterArg (uint64 number) :            Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
                     35: 
                     36:                operator wxString () { Referenced = true; return StringArg; }
                     37: 
                     38:                bool IsEmpty () const { return Empty; }
                     39:                bool WasReferenced() const { return Referenced; }
                     40: 
                     41:        protected:
                     42:                bool Empty;
                     43:                bool Referenced;
                     44:                wxString StringArg;
                     45:        };
                     46: 
                     47:        class StringFormatter
                     48:        {
                     49:        public:
                     50:                StringFormatter (const wxString &format, StringFormatterArg arg0 = StringFormatterArg(), StringFormatterArg arg1 = StringFormatterArg(), StringFormatterArg arg2 = StringFormatterArg(), StringFormatterArg arg3 = StringFormatterArg(), StringFormatterArg arg4 = StringFormatterArg(), StringFormatterArg arg5 = StringFormatterArg(), StringFormatterArg arg6 = StringFormatterArg(), StringFormatterArg arg7 = StringFormatterArg(), StringFormatterArg arg8 = StringFormatterArg(), StringFormatterArg arg9 = StringFormatterArg());
                     51:                virtual ~StringFormatter ();
                     52: 
                     53:                operator wstring () const { return wstring (FormattedString); }
                     54:                operator wxString () const { return FormattedString; }
                     55:                operator StringFormatterArg () const { return FormattedString; }
                     56: 
                     57:        protected:
                     58:                wxString FormattedString;
                     59: 
                     60:        private:
                     61:                StringFormatter (const StringFormatter &);
                     62:                StringFormatter &operator= (const StringFormatter &);
                     63:        };
                     64: }
                     65: 
                     66: #endif // TC_HEADER_Main_StringFormatter

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.