PRStringUtils.h

Go to the documentation of this file.
00001 
00010 #if !defined(__PRSTRINGUTILS_H__)
00011 #define __PRSTRINGUTILS_H__
00012 
00013 
00014 
00015 #include <wx/string.h>
00016 #include <wx/strconv.h>
00017 
00018 // Use when you need to get from char * to wxChar * (i.e. for wxString.Printf())
00019 #define WXCASTCHARS(s) wxString(s,wxConvUTF8).c_str()
00020 
00027 class wxASCIIHelper
00028 {
00029     public:
00030         wxASCIIHelper(const wxString & s)
00031         {
00032             m_wxstr = s;
00033 #if wxUSE_UNICODE
00034             m_str = s.mb_str();
00035 #else
00036             m_str = const_cast<wxWX2MBbuf>(s.mb_str());
00037 #endif
00038         }
00039         ~wxASCIIHelper()
00040         {
00041         }
00042         const char * to_chars()
00043         {
00044             const char * c = m_str;
00045             return c;
00046         }
00047         const unsigned char * to_bytes()
00048         {
00049             const char * c = m_str;
00050             return (const unsigned char *)(c);
00051         }
00052 
00053     private:
00054         wxString m_wxstr;
00055         wxWX2MBbuf m_str;
00056 };
00057 
00058 #endif //#if !defined(__PRSTRINGUTILS_H__)

Generated on Mon Nov 15 11:15:55 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6