mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 07:15:35 +08:00
Ref T241, made QStrings static const
This commit is contained in:
@@ -26,28 +26,39 @@ namespace BlackMisc
|
||||
return splitString(s, [](QChar c) { return c == '\n' || c == '\r'; });
|
||||
}
|
||||
|
||||
QString boolToOnOff(bool v, bool i18n)
|
||||
const QString &boolToOnOff(bool v)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "on" : "off";
|
||||
static const QString on("on");
|
||||
static const QString off("off");
|
||||
return v ? on : off;
|
||||
}
|
||||
|
||||
QString boolToYesNo(bool v, bool i18n)
|
||||
const QString &boolToYesNo(bool v)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "yes" : "no";
|
||||
static const QString yes("yes");
|
||||
static const QString no("no");
|
||||
return v ? yes : no;
|
||||
}
|
||||
|
||||
QString boolToTrueFalse(bool v, bool i18n)
|
||||
const QString &boolToTrueFalse(bool v)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "true" : "false";
|
||||
static const QString t("true");
|
||||
static const QString f("false");
|
||||
return v ? t : f;
|
||||
}
|
||||
|
||||
QString boolToEnabledDisabled(bool v, bool i18n)
|
||||
const QString &boolToEnabledDisabled(bool v)
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return v ? "enabled" : "disabled";
|
||||
static const QString e("enabled");
|
||||
static const QString d("disabled");
|
||||
return v ? e : d;
|
||||
}
|
||||
|
||||
const QString &boolToNullNotNull(bool isNull)
|
||||
{
|
||||
static const QString n("null");
|
||||
static const QString nn("not null");
|
||||
return isNull ? n : nn;
|
||||
}
|
||||
|
||||
bool stringToBool(const QString &string)
|
||||
|
||||
@@ -121,16 +121,19 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Bool to on/off
|
||||
BLACKMISC_EXPORT QString boolToOnOff(bool v, bool i18n = false);
|
||||
BLACKMISC_EXPORT const QString &boolToOnOff(bool v);
|
||||
|
||||
//! Bool to yes/no
|
||||
BLACKMISC_EXPORT QString boolToYesNo(bool v, bool i18n = false);
|
||||
BLACKMISC_EXPORT const QString &boolToYesNo(bool v);
|
||||
|
||||
//! Bool to true/false
|
||||
BLACKMISC_EXPORT QString boolToTrueFalse(bool v, bool i18n = false);
|
||||
BLACKMISC_EXPORT const QString &boolToTrueFalse(bool v);
|
||||
|
||||
//! Bool to enabled/disabled
|
||||
BLACKMISC_EXPORT QString boolToEnabledDisabled(bool v, bool i18n = false);
|
||||
BLACKMISC_EXPORT const QString &boolToEnabledDisabled(bool v);
|
||||
|
||||
//! Bool isNull to null/no null
|
||||
BLACKMISC_EXPORT const QString &boolToNullNotNull(bool isNull);
|
||||
|
||||
//! Convert string to bool
|
||||
BLACKMISC_EXPORT bool stringToBool(const QString &boolString);
|
||||
@@ -246,10 +249,10 @@ namespace BlackMisc
|
||||
* the derived class uses this macro to disambiguate the inherited members.
|
||||
*/
|
||||
# define BLACKMISC_DECLARE_USING_MIXIN_STRING(DERIVED) \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toQString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toFormattedQString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toStdString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::stringForStreaming;
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toQString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toFormattedQString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::toStdString; \
|
||||
using ::BlackMisc::Mixin::String<DERIVED>::stringForStreaming;
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
|
||||
Reference in New Issue
Block a user