BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Locale.h
1 #pragma once
2 
3 #include <string>
4 
5 #include <Poco/Exception.h>
6 #include <Poco/SharedPtr.h>
7 
8 #include "l10n/LocaleImpl.h"
9 
10 namespace BeeeOn {
11 
12 class Locale {
13 public:
17  Locale();
18 
19  template <typename T>
20  Locale(Poco::SharedPtr<T> impl):
21  m_impl(impl)
22  {
23  if (m_impl.isNull())
24  throw Poco::BadCastException("failed to cast to LocaleImpl");
25  }
26 
27  template <typename T>
28  Locale(T *impl):
29  m_impl(impl)
30  {
31  }
32 
33  std::string language() const;
34  std::string country() const;
35  std::string displayName() const;
36  std::string toString() const;
37 
38  bool operator <(const Locale &other) const
39  {
40  return lessThan(other);
41  }
42 
43  bool lessThan(const Locale &other) const;
44 
45  Poco::SharedPtr<LocaleImpl> impl() const;
46 
47  static Locale system();
48 
49 private:
50  Poco::SharedPtr<LocaleImpl> m_impl;
51 };
52 
53 }
Locale()
Definition: Locale.cpp:7
Definition: Locale.h:12