summaryrefslogtreecommitdiff
path: root/include/o3tl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-04-17 21:35:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-26 08:50:54 +0200
commitc70d49c7c888da8cfd73db8585e7be1f37fc398a (patch)
treec0e540401850018464ca76300536faf9aa7e27d2 /include/o3tl
parentcd4344d3bdef631b3e64ac12a9e64bc9670c1b7c (diff)
use strong_int for LanguageType
Change-Id: If99a944f7032180355da291ad283b4cfcea4f448 Reviewed-on: https://gerrit.libreoffice.org/36629 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/o3tl')
-rw-r--r--include/o3tl/strong_int.hxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/o3tl/strong_int.hxx b/include/o3tl/strong_int.hxx
index 588cab8e5472..ff2ba9123627 100644
--- a/include/o3tl/strong_int.hxx
+++ b/include/o3tl/strong_int.hxx
@@ -43,7 +43,7 @@ public:
explicit constexpr strong_int(UNDERLYING_TYPE value) : m_value(value) {}
strong_int() : m_value(0) {}
- explicit operator UNDERLYING_TYPE() const { return m_value; }
+ explicit constexpr operator UNDERLYING_TYPE() const { return m_value; }
explicit operator bool() const { return m_value != 0; }
UNDERLYING_TYPE get() const { return m_value; }
@@ -56,6 +56,15 @@ public:
strong_int& operator++() { ++m_value; return *this; }
strong_int operator++(int) { UNDERLYING_TYPE nOldValue = m_value; ++m_value; return strong_int(nOldValue); }
+ bool anyOf(strong_int v) const {
+ return *this == v;
+ }
+
+ template<typename... Args>
+ bool anyOf(strong_int first, Args... args) const {
+ return *this == first || anyOf(args...);
+ }
+
private:
UNDERLYING_TYPE m_value;
};