diff options
| author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:45 -0800 |
| commit | d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 (patch) | |
| tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /tools/localize/Configuration.cpp | |
| parent | 076357b8567458d4b6dfdcf839ef751634cd2bfb (diff) | |
| download | frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.zip frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.gz frameworks_base-d83a98f4ce9cfa908f5c54bbd70f03eec07e7553.tar.bz2 | |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'tools/localize/Configuration.cpp')
| -rw-r--r-- | tools/localize/Configuration.cpp | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/tools/localize/Configuration.cpp b/tools/localize/Configuration.cpp deleted file mode 100644 index 56addbd..0000000 --- a/tools/localize/Configuration.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "Configuration.h" -#include <string.h> - -int -Configuration::Compare(const Configuration& that) const -{ - int n; - - n = locale.compare(that.locale); - if (n != 0) return n; - - n = vendor.compare(that.vendor); - if (n != 0) return n; - - n = orientation.compare(that.orientation); - if (n != 0) return n; - - n = density.compare(that.density); - if (n != 0) return n; - - n = touchscreen.compare(that.touchscreen); - if (n != 0) return n; - - n = keyboard.compare(that.keyboard); - if (n != 0) return n; - - n = navigation.compare(that.navigation); - if (n != 0) return n; - - n = screenSize.compare(that.screenSize); - if (n != 0) return n; - - return 0; -} - -string -Configuration::ToString() const -{ - string s; - if (locale.length() > 0) { - if (s.length() > 0) { - s += "-"; - } - s += locale; - } - return s; -} - -bool -split_locale(const string& in, string* language, string* region) -{ - const int len = in.length(); - if (len == 2) { - if (isalpha(in[0]) && isalpha(in[1])) { - *language = in; - region->clear(); - return true; - } else { - return false; - } - } - else if (len == 5) { - if (isalpha(in[0]) && isalpha(in[1]) && (in[2] == '_' || in[2] == '-') - && isalpha(in[3]) && isalpha(in[4])) { - language->assign(in.c_str(), 2); - region->assign(in.c_str()+3, 2); - return true; - } else { - return false; - } - } - else { - return false; - } -} - |
