diff options
author | George Hazan <george.hazan@gmail.com> | 2013-02-28 17:02:58 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-02-28 17:02:58 +0000 |
commit | ea922a1ddd0526d37c6a299ab6260729612a8dfa (patch) | |
tree | 56bc15af2b2b173b4368ef3c1a6a065267a23ccf /include/m_utils.h | |
parent | 7b44e3c9879ed7cb1ab3f64b829e0c0b09c6ffae (diff) |
new template, VARST, to hold the result of calling Utils_ReplaceVarsT()
git-svn-id: http://svn.miranda-ng.org/main/trunk@3806 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'include/m_utils.h')
-rw-r--r-- | include/m_utils.h | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/include/m_utils.h b/include/m_utils.h index 64d0e2a2e3..bd9f21d887 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -414,16 +414,34 @@ typedef struct #define MS_UTILS_REPLACEVARS "Utils/ReplaceVars"
__forceinline char* Utils_ReplaceVars(const char *szData) {
- REPLACEVARSDATA dat = {0};
- dat.cbSize = sizeof(dat);
+ REPLACEVARSDATA dat = { sizeof(dat) };
return (char*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szData, (LPARAM)&dat);
}
__forceinline TCHAR* Utils_ReplaceVarsT(const TCHAR *szData) {
- REPLACEVARSDATA dat = {0};
- dat.cbSize = sizeof(dat);
- dat.dwFlags = RVF_TCHAR;
+ REPLACEVARSDATA dat = { sizeof(dat), RVF_TCHAR };
return (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)szData, (LPARAM)&dat);
}
+
+#if defined(__cplusplus)
+ #if !defined(M_SYSTEM_CPP_H__)
+ #include "m_system_cpp.h"
+ #endif
+
+ struct VARS : public mir_ptr<char>
+ {
+ __forceinline VARS(const char *str) :
+ mir_ptr<char>( Utils_ReplaceVars(str))
+ {}
+ };
+
+ struct VARST : public mir_ptr<TCHAR>
+ {
+ __forceinline VARST(const TCHAR *str) :
+ mir_ptr<TCHAR>( Utils_ReplaceVarsT(str))
+ {}
+ };
+#endif
+
#ifdef _UNICODE
#define MS_UTILS_PATHTORELATIVEW "Utils/PathToRelativeW"
#define MS_UTILS_PATHTOABSOLUTEW "Utils/PathToAbsoluteW"
|