Major POSIX overhaul

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6416 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-12-08 14:34:38 +00:00
parent 1e55e30ff4
commit be6c7e6a1d
35 changed files with 1718 additions and 1412 deletions

View file

@ -46,18 +46,20 @@ typedef std::ifstream tifstream;
// This is a helpful little function for converting exceptions or
// other system type things that come back ANSI and must be
// utilized as either ANSI or WCHAR depending on _UNICODE.
// utilized as either ANSI or wchar_t depending on _UNICODE.
class CtoTString
{
void Init(const char* str, UINT cp);
void Init(const char* str);
public:
CtoTString(const char* str);
CtoTString(const char* str, UINT cp);
CtoTString(const std::string& str);
CtoTString(const char* str) { Init(str); }
CtoTString(const char* str, UINT cp) { Init(str, cp); }
CtoTString(const std::string& str) { Init(str.c_str()); }
~CtoTString();
operator const wchar_t*() const;
inline const wchar_t*GetTStr() const;
operator const wchar_t*() const { return m_wStr; }
inline const wchar_t*GetTStr() const { return m_wStr; }
private:
wchar_t* m_wStr;
@ -67,17 +69,21 @@ private:
// may actually have Unicode strings.
class TtoCString
{
void Init(const wchar_t* str);
public:
TtoCString(const wchar_t* wStr);
TtoCString(const tstring& wStr);
TtoCString(const wchar_t* wStr) { Init(wStr); }
TtoCString(const tstring& wStr) { Init(wStr.c_str()); }
~TtoCString();
operator const char*() const;
operator const char*() const { return m_cStr; };
private:
char* m_cStr;
};
#endif // _UNICODE
#define PosixBug_CtoTString CtoTString
#define PosixBug_TtoCString TtoCString
#endif // NSIS_TSTRING___H__