| 1 |
#ifndef DUMMY_H |
| 2 |
#define DUMMY_H |
| 3 |
|
| 4 |
// [TODO] ĆĹŔˇé |
| 5 |
#include <ctime> |
| 6 |
#include <sstream> |
| 7 |
|
| 8 |
#include "tstring.h" |
| 9 |
|
| 10 |
Regnessem::tstring PtrToHex(const void* value); |
| 11 |
|
| 12 |
namespace dummy_private |
| 13 |
{ |
| 14 |
template <typename T> struct to_string_type; |
| 15 |
template <> struct to_string_type<int> { typedef long long cast_type; }; |
| 16 |
template <> struct to_string_type<long> { typedef long long cast_type; }; |
| 17 |
template <> struct to_string_type<long long> { typedef long long cast_type; }; |
| 18 |
template <> struct to_string_type<unsigned> { typedef unsigned long long cast_type; }; |
| 19 |
template <> struct to_string_type<unsigned long> { typedef unsigned long long cast_type; }; |
| 20 |
template <> struct to_string_type<unsigned long long> { typedef unsigned long long cast_type; }; |
| 21 |
} |
| 22 |
|
| 23 |
template <typename T> |
| 24 |
std::string ToStringA(T val) |
| 25 |
{ |
| 26 |
return std::to_string(static_cast<typename dummy_private::to_string_type<T>::cast_type>(val)); |
| 27 |
} |
| 28 |
|
| 29 |
template <typename T> |
| 30 |
std::wstring ToStringW(T val) |
| 31 |
{ |
| 32 |
return std::to_wstring(static_cast<typename dummy_private::to_string_type<T>::cast_type>(val)); |
| 33 |
} |
| 34 |
|
| 35 |
template <typename T> |
| 36 |
Regnessem::tstring ToString(T val) |
| 37 |
{ |
| 38 |
#ifdef UNICODE |
| 39 |
return ToStringW(val); |
| 40 |
#else |
| 41 |
return ToStringA(val); |
| 42 |
#endif |
| 43 |
} |
| 44 |
|
| 45 |
Regnessem::tstring TimeToStr(std::time_t t); |
| 46 |
|
| 47 |
Regnessem::tstring ExtractFileName(const Regnessem::tstring &fileName); |
| 48 |
Regnessem::tstring ExtractFilePath(const Regnessem::tstring &fileName); |
| 49 |
|
| 50 |
bool ForceDirectories(const Regnessem::tstring &dirPath); |
| 51 |
|
| 52 |
std:: string w2c(const std::wstring &src); |
| 53 |
std::wstring c2w(const std:: string &src); |
| 54 |
|
| 55 |
namespace dummy_private |
| 56 |
{ |
| 57 |
inline std:: string t2x(const std::wstring &str){return w2c(str);} |
| 58 |
inline std::wstring t2x(const std:: string &str){return c2w(str);} |
| 59 |
} |
| 60 |
|
| 61 |
template <typename T, typename U> |
| 62 |
std::basic_string<typename std::enable_if<std::is_same<T, U>::value, T>::type> ConvertString(const std::basic_string<U> &str) |
| 63 |
{ |
| 64 |
return str; |
| 65 |
} |
| 66 |
|
| 67 |
template <typename T, typename U> |
| 68 |
std::basic_string<typename std::enable_if<!std::is_same<T, U>::value, T>::type> ConvertString(const std::basic_string<U> &str) |
| 69 |
{ |
| 70 |
return dummy_private::t2x(str); |
| 71 |
} |
| 72 |
|
| 73 |
inline Regnessem::tstring w2t(const std::wstring &src){return ConvertString<Regnessem::tstring::value_type>(src);} |
| 74 |
inline Regnessem::tstring c2t(const std:: string &src){return ConvertString<Regnessem::tstring::value_type>(src);} |
| 75 |
inline std:: string t2c(const Regnessem::tstring &src){return ConvertString<char>(src);} |
| 76 |
inline std::wstring t2w(const Regnessem::tstring &src){return ConvertString<wchar_t>(src);} |
| 77 |
|
| 78 |
#if defined(WINCE) |
| 79 |
// compatibility |
| 80 |
#define GWLP_WNDPROC (-4) |
| 81 |
#define GWLP_HINSTANCE (-6) |
| 82 |
#define GWLP_HWNDPARENT (-8) |
| 83 |
#define GWLP_USERDATA (-21) |
| 84 |
#define GWLP_ID (-12) |
| 85 |
|
| 86 |
LONG_PTR GetWindowLongPtr( |
| 87 |
HWND hWnd, // EBhEĚnh |
| 88 |
int nIndex // 枡élĚItZbg |
| 89 |
); |
| 90 |
LONG_PTR SetWindowLongPtr( |
| 91 |
HWND hWnd, // EBhEĚnh |
| 92 |
int nIndex, // ĎXˇélĚItZbg |
| 93 |
LONG_PTR dwNewLong // Vľ˘l |
| 94 |
); |
| 95 |
#endif |
| 96 |
|
| 97 |
/* |
| 98 |
CĚsprintfĚČŐĹ |
| 99 |
*/ |
| 100 |
Regnessem::tstring format(const TCHAR*fmt,...); |
| 101 |
std::string formatA(const char*fmt,...); |
| 102 |
|
| 103 |
#endif |