• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2013 Google Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef I18N_ADDRESSINPUT_ADDRESS_UI_H_
16 #define I18N_ADDRESSINPUT_ADDRESS_UI_H_
17 
18 #include <string>
19 #include <vector>
20 
21 namespace i18n {
22 namespace addressinput {
23 
24 class Localization;
25 struct AddressUiComponent;
26 
27 // Returns the list of supported CLDR region codes.
28 const std::vector<std::string>& GetRegionCodes();
29 
30 // Returns the UI components for the CLDR |region_code|. Uses the strings from
31 // |localization|. The components can be in default or Latin order, depending on
32 // the BCP 47 |ui_language_tag|.
33 //
34 // Sets the |best_address_language_tag| to the BCP 47 language tag that should
35 // be saved with this address. This language will be used to get drop-downs to
36 // help users fill in their address, and to format the address that the user
37 // entered. The parameter should not be NULL.
38 //
39 // Returns an empty vector on error.
40 std::vector<AddressUiComponent> BuildComponents(
41     const std::string& region_code,
42     const Localization& localization,
43     const std::string& ui_language_tag,
44     std::string* best_address_language_tag);
45 
46 }  // namespace addressinput
47 }  // namespace i18n
48 
49 #endif  // I18N_ADDRESSINPUT_ADDRESS_UI_H_
50