-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
10 changed files
with
91 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Copyright RIME Developers | ||
// Distributed under the BSD License | ||
// | ||
#include <rime/common.h> | ||
#include <rime/language.h> | ||
|
||
namespace rime { | ||
|
||
// "luna_pinyin.extra" has language component "luna_pinyin". | ||
string Language::get_language_component(const string& name) { | ||
size_t dot = name.find('.'); | ||
if (dot != string::npos && dot != 0) | ||
return name.substr(0, dot); | ||
return name; | ||
} | ||
|
||
} // namespace rime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// Copyright RIME Developers | ||
// Distributed under the BSD License | ||
// | ||
#ifndef RIME_LANGUAGE_H_ | ||
#define RIME_LANGUAGE_H_ | ||
|
||
#include <rime/common.h> | ||
|
||
namespace rime { | ||
|
||
class Language { | ||
const string name_; | ||
|
||
public: | ||
Language(const string& name) : name_(name) {} | ||
string name() const { return name_; } | ||
|
||
bool operator== (const Language& other) const { | ||
return name_ == other.name_; | ||
} | ||
|
||
template <class T, class U> | ||
static bool intelligible(const T& t, const U& u) { | ||
return t && t->language() && u && u->language() && | ||
*t->language() == *u->language(); | ||
} | ||
|
||
static string get_language_component(const string& name); | ||
}; | ||
|
||
} // namespace rime | ||
|
||
#endif // RIME_LANGUAGE_H_ |