Differential D3185 Diff 14447 ps/trunk/source/third_party/tinygettext/include/tinygettext/plural_forms.hpp
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/third_party/tinygettext/include/tinygettext/plural_forms.hpp
Show All 30 Lines | |||||
private: | private: | ||||
unsigned int nplural; | unsigned int nplural; | ||||
PluralFunc plural; | PluralFunc plural; | ||||
public: | public: | ||||
static PluralForms from_string(const std::string& str); | static PluralForms from_string(const std::string& str); | ||||
PluralForms() | PluralForms() | ||||
: nplural(0), | : nplural(), | ||||
plural(0) | plural() | ||||
{} | {} | ||||
PluralForms(unsigned int nplural_, PluralFunc plural_) | PluralForms(unsigned int nplural_, PluralFunc plural_) | ||||
: nplural(nplural_), | : nplural(nplural_), | ||||
plural(plural_) | plural(plural_) | ||||
{} | {} | ||||
unsigned int get_nplural() const { return nplural; } | unsigned int get_nplural() const { return nplural; } | ||||
unsigned int get_plural(int n) const { if (plural) return plural(n); else return 0; } | unsigned int get_plural(int n) const { if (plural) return plural(n); else return 0; } | ||||
bool operator==(const PluralForms& other) { return nplural == other.nplural && plural == other.plural; } | bool operator==(const PluralForms& other) const { return nplural == other.nplural && plural == other.plural; } | ||||
bool operator!=(const PluralForms& other) { return !(*this == other); } | bool operator!=(const PluralForms& other) const { return !(*this == other); } | ||||
explicit operator bool() const { | explicit operator bool() const { | ||||
return plural != NULL; | return plural != nullptr; | ||||
} | } | ||||
}; | }; | ||||
} // namespace tinygettext | } // namespace tinygettext | ||||
#endif | #endif | ||||
/* EOF */ | /* EOF */ |
Wildfire Games · Phabricator