OLD | NEW |
1 // Copyright (C) 2013 Google Inc. | 1 // Copyright (C) 2013 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with 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 | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include <libaddressinput/address_problem.h> | 15 #include <libaddressinput/address_problem.h> |
16 | 16 |
17 #include <ostream> | 17 #include <ostream> |
18 #include <string> | 18 #include <string> |
19 | 19 |
20 namespace i18n { | 20 namespace i18n { |
21 namespace addressinput { | 21 namespace addressinput { |
22 | 22 |
23 AddressProblem::AddressProblem(AddressField field, | 23 AddressProblem::AddressProblem(AddressField field, |
24 Type type, | 24 Type type, |
25 const std::string& description) | 25 int description_id) |
26 : field(field), type(type), description(description) {} | 26 : field(field), type(type), description_id(description_id) {} |
27 | 27 |
28 AddressProblem::~AddressProblem() {} | 28 AddressProblem::~AddressProblem() {} |
29 | 29 |
30 std::ostream& operator<<(std::ostream& o, AddressProblem::Type problem_type) { | 30 std::ostream& operator<<(std::ostream& o, AddressProblem::Type problem_type) { |
31 switch (problem_type) { | 31 switch (problem_type) { |
32 case AddressProblem::MISSING_REQUIRED_FIELD: | 32 case AddressProblem::MISSING_REQUIRED_FIELD: |
33 o << "MISSING_REQUIRED_FIELD"; | 33 o << "MISSING_REQUIRED_FIELD"; |
34 break; | 34 break; |
35 case AddressProblem::UNKNOWN_VALUE: | 35 case AddressProblem::UNKNOWN_VALUE: |
36 o << "UNKNOWN_VALUE"; | 36 o << "UNKNOWN_VALUE"; |
37 break; | 37 break; |
38 case AddressProblem::UNRECOGNIZED_FORMAT: | 38 case AddressProblem::UNRECOGNIZED_FORMAT: |
39 o << "UNRECOGNIZED_FORMAT"; | 39 o << "UNRECOGNIZED_FORMAT"; |
40 break; | 40 break; |
41 case AddressProblem::MISMATCHING_VALUE: | 41 case AddressProblem::MISMATCHING_VALUE: |
42 o << "MISMATCHING_VALUE"; | 42 o << "MISMATCHING_VALUE"; |
43 break; | 43 break; |
44 default : | 44 default : |
45 o << "[INVALID]"; | 45 o << "[INVALID]"; |
46 break; | 46 break; |
47 } | 47 } |
48 return o; | 48 return o; |
49 } | 49 } |
50 | 50 |
51 std::ostream& operator<<(std::ostream& o, const AddressProblem& problem) { | 51 std::ostream& operator<<(std::ostream& o, const AddressProblem& problem) { |
52 o << "[" << problem.field << ", " | 52 o << "[" << problem.field << ", " |
53 << problem.type << ", \"" | 53 << problem.type << ", \"" |
54 << problem.description << "\"]"; | 54 << problem.description_id << "\"]"; |
55 return o; | 55 return o; |
56 } | 56 } |
57 | 57 |
58 } // namespace addressinput | 58 } // namespace addressinput |
59 } // namespace i18n | 59 } // namespace i18n |
OLD | NEW |