"Fossies" - the Fresh Open Source Software Archive

Member "src/Main/StringFormatter.h" (10 Oct 2018, 3206 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "StringFormatter.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  Derived from source code of TrueCrypt 7.1a, which is
    3  Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
    4  by the TrueCrypt License 3.0.
    5 
    6  Modifications and additions to the original source code (contained in this file)
    7  and all other portions of this file are Copyright (c) 2013-2017 IDRIX
    8  and are governed by the Apache License 2.0 the full text of which is
    9  contained in the file License.txt included in VeraCrypt binary and source
   10  code distribution packages.
   11 */
   12 
   13 #ifndef TC_HEADER_Main_StringFormatter
   14 #define TC_HEADER_Main_StringFormatter
   15 
   16 #include "System.h"
   17 #include "Main.h"
   18 
   19 namespace VeraCrypt
   20 {
   21     class StringFormatterArg
   22     {
   23     public:
   24         StringFormatterArg () : Empty (true) { }
   25 
   26         StringFormatterArg (const char c) :         Empty (false) { string s; s += c; StringArg = StringConverter::ToWide (s); }
   27         StringFormatterArg (const wchar_t c) :      Empty (false), Referenced (false), StringArg (c) { }
   28         StringFormatterArg (const char *str) :      Empty (false), Referenced (false), StringArg (StringConverter::ToWide (str)) { }
   29         StringFormatterArg (const wchar_t *str) :   Empty (false), Referenced (false), StringArg (str) { }
   30         StringFormatterArg (const string &str) :    Empty (false), Referenced (false), StringArg (StringConverter::ToWide (str)) { }
   31         StringFormatterArg (const wstring &str) :   Empty (false), Referenced (false), StringArg (str) { }
   32         StringFormatterArg (const wxString &str) :  Empty (false), Referenced (false), StringArg (str) { }
   33         StringFormatterArg (int32 number) :         Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
   34         StringFormatterArg (uint32 number) :        Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
   35         StringFormatterArg (int64 number) :         Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
   36         StringFormatterArg (uint64 number) :        Empty (false), Referenced (false), StringArg (StringConverter::FromNumber (number)) { }
   37 
   38         operator wxString () { Referenced = true; return StringArg; }
   39 
   40         bool IsEmpty () const { return Empty; }
   41         bool WasReferenced() const { return Referenced; }
   42 
   43     protected:
   44         bool Empty;
   45         bool Referenced;
   46         wxString StringArg;
   47     };
   48 
   49     class StringFormatter
   50     {
   51     public:
   52         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());
   53         virtual ~StringFormatter ();
   54 
   55         operator wstring () const { return wstring (FormattedString); }
   56         operator wxString () const { return FormattedString; }
   57         operator StringFormatterArg () const { return FormattedString; }
   58 
   59     protected:
   60         wxString FormattedString;
   61 
   62     private:
   63         StringFormatter (const StringFormatter &);
   64         StringFormatter &operator= (const StringFormatter &);
   65     };
   66 }
   67 
   68 #endif // TC_HEADER_Main_StringFormatter