Rename translation methods to be not one letter.

It fixes several warnings, when the name was shadowed by a local "p".
This commit is contained in:
Alexey Sokolov
2016-09-12 00:01:45 +01:00
parent 187f617bbc
commit cc653efb6b
12 changed files with 198 additions and 194 deletions
+27 -26
View File
@@ -60,24 +60,25 @@ class CModInfo;
#define ZNC_EXPORT_LIB_EXPORT
#endif
#define MODCOMMONDEFS(CLASS, DESCRIPTION, TYPE) \
extern "C" { \
ZNC_EXPORT_LIB_EXPORT bool ZNCModInfo(double dCoreVersion, \
CModInfo& Info); \
ZNC_EXPORT_LIB_EXPORT bool ZNCModInfo(double dCoreVersion, \
CModInfo& Info) { \
if (dCoreVersion != VERSION) return false; \
auto t = [&](const CString& sEnglish, const CString& sContext = "") { \
return sEnglish.empty() ? "" : Info.t(sEnglish, sContext); \
}; \
t(CString()); /* Don't warn about unused t */ \
Info.SetDescription(DESCRIPTION); \
Info.SetDefaultType(TYPE); \
Info.AddType(TYPE); \
Info.SetLoader(TModLoad<CLASS>); \
TModInfo<CLASS>(Info); \
return true; \
} \
#define MODCOMMONDEFS(CLASS, DESCRIPTION, TYPE) \
extern "C" { \
ZNC_EXPORT_LIB_EXPORT bool ZNCModInfo(double dCoreVersion, \
CModInfo& Info); \
ZNC_EXPORT_LIB_EXPORT bool ZNCModInfo(double dCoreVersion, \
CModInfo& Info) { \
if (dCoreVersion != VERSION) return false; \
auto t_s = [&](const CString& sEnglish, \
const CString& sContext = "") { \
return sEnglish.empty() ? "" : Info.t_s(sEnglish, sContext); \
}; \
t_s(CString()); /* Don't warn about unused t_s */ \
Info.SetDescription(DESCRIPTION); \
Info.SetDefaultType(TYPE); \
Info.AddType(TYPE); \
Info.SetLoader(TModLoad<CLASS>); \
TModInfo<CLASS>(Info); \
return true; \
} \
}
/** Instead of writing a constructor, you should call this macro. It accepts all
@@ -280,7 +281,7 @@ class CModInfo {
void SetDefaultType(EModuleType eType) { m_eDefaultType = eType; }
// !Setters
CString t(const CString& sEnglish, const CString& sContext = "") const;
CString t_s(const CString& sEnglish, const CString& sContext = "") const;
private:
protected:
@@ -1301,13 +1302,13 @@ class CModule {
#ifndef SWIG
// Translation
CString t(const CString& sEnglish, const CString& sContext = "") const;
CInlineFormatMessage f(const CString& sEnglish,
const CString& sContext = "") const;
CInlineFormatMessage p(const CString& sEnglish, const CString& sEnglishes,
int iNum, const CString& sContext = "") const;
CDelayedTranslation d(const CString& sEnglish,
const CString& sContext = "") const;
CString t_s(const CString& sEnglish, const CString& sContext = "") const;
CInlineFormatMessage t_f(const CString& sEnglish,
const CString& sContext = "") const;
CInlineFormatMessage t_p(const CString& sEnglish, const CString& sEnglishes,
int iNum, const CString& sContext = "") const;
CDelayedTranslation t_d(const CString& sEnglish,
const CString& sContext = "") const;
#endif
protected:
+7 -7
View File
@@ -279,13 +279,13 @@ class CSocket : public CZNCSock {
#ifndef SWIG
// Translation. As opposed to CCoreTranslationMixin, this one uses module.mo
CString t(const CString& sEnglish, const CString& sContext = "") const;
CInlineFormatMessage f(const CString& sEnglish,
const CString& sContext = "") const;
CInlineFormatMessage p(const CString& sEnglish, const CString& sEnglishes,
int iNum, const CString& sContext) const;
CDelayedTranslation d(const CString& sEnglish,
const CString& sContext = "") const;
CString t_s(const CString& sEnglish, const CString& sContext = "") const;
CInlineFormatMessage t_f(const CString& sEnglish,
const CString& sContext = "") const;
CInlineFormatMessage t_p(const CString& sEnglish, const CString& sEnglishes,
int iNum, const CString& sContext) const;
CDelayedTranslation t_d(const CString& sEnglish,
const CString& sContext = "") const;
#endif
private:
+8 -8
View File
@@ -78,14 +78,14 @@ class CDelayedTranslation {
// CModule defines its own version of these functions.
class CCoreTranslationMixin {
protected:
static CString t(const CString& sEnglish, const CString& sContext = "");
static CInlineFormatMessage f(const CString& sEnglish,
const CString& sContext = "");
static CInlineFormatMessage p(const CString& sEnglish,
const CString& sEnglishes, int iNum,
const CString& sContext = "");
static CDelayedTranslation d(const CString& sEnglish,
const CString& sContext = "");
static CString t_s(const CString& sEnglish, const CString& sContext = "");
static CInlineFormatMessage t_f(const CString& sEnglish,
const CString& sContext = "");
static CInlineFormatMessage t_p(const CString& sEnglish,
const CString& sEnglishes, int iNum,
const CString& sContext = "");
static CDelayedTranslation t_d(const CString& sEnglish,
const CString& sContext = "");
};
#endif