librime: language.h Source File

| librime 1.2 Rime Input Method Engine, the core library

language.h
Go to the documentation of this file.
1//
2// Copyright RIME Developers
3// Distributed under the BSD License
4//
5#ifndef RIME_LANGUAGE_H_
6#define RIME_LANGUAGE_H_
7
8#include <rime/common.h>
9
10namespace rime {
11
12 class Language {
13 const string name_;
14
15 public:
16 Language(const string& name) : name_(name) {}
17 string name() const { return name_; }
18
19 bool operator==(const Language& other) const { return name_ == other.name_; }
20
21 template <class T, class U>
22 static bool intelligible(const T& t, const U& u) {
23 return t && t->language() && u && u->language() &&
24 *t->language() == *u->language();
25 }
26
27 static string get_language_component(const string& name);
28};
29
30} // namespace rime
31
32#endif // RIME_LANGUAGE_H_
common.h
rime
Definition algebra.cc:12
rime::Language::get_language_component
static string get_language_component(const string &name)
Definition language.cc:11
rime::Language::operator==
bool operator==(const Language &other) const
Definition language.h:19
rime::Language::intelligible
static bool intelligible(const T &t, const U &u)
Definition language.h:22
rime::Language::Language
Language(const string &name)
Definition language.h:16
rime::Language::name
string name() const
Definition language.h:17