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 | 19 |
19 namespace i18n { | 20 namespace i18n { |
20 namespace addressinput { | 21 namespace addressinput { |
21 | 22 |
| 23 AddressProblem::AddressProblem(AddressField field, |
| 24 Type type, |
| 25 const std::string& description) |
| 26 : field(field), type(type), description(description) {} |
| 27 |
| 28 AddressProblem::~AddressProblem() {} |
| 29 |
22 std::ostream& operator<<(std::ostream& o, AddressProblem::Type problem_type) { | 30 std::ostream& operator<<(std::ostream& o, AddressProblem::Type problem_type) { |
23 switch (problem_type) { | 31 switch (problem_type) { |
24 case AddressProblem::MISSING_REQUIRED_FIELD: | 32 case AddressProblem::MISSING_REQUIRED_FIELD: |
25 o << "MISSING_REQUIRED_FIELD"; | 33 o << "MISSING_REQUIRED_FIELD"; |
26 break; | 34 break; |
27 case AddressProblem::UNKNOWN_VALUE: | 35 case AddressProblem::UNKNOWN_VALUE: |
28 o << "UNKNOWN_VALUE"; | 36 o << "UNKNOWN_VALUE"; |
29 break; | 37 break; |
30 case AddressProblem::UNRECOGNIZED_FORMAT: | 38 case AddressProblem::UNRECOGNIZED_FORMAT: |
31 o << "UNRECOGNIZED_FORMAT"; | 39 o << "UNRECOGNIZED_FORMAT"; |
(...skipping 10 matching lines...) Expand all Loading... |
42 | 50 |
43 std::ostream& operator<<(std::ostream& o, const AddressProblem& problem) { | 51 std::ostream& operator<<(std::ostream& o, const AddressProblem& problem) { |
44 o << "[" << problem.field << ", " | 52 o << "[" << problem.field << ", " |
45 << problem.type << ", \"" | 53 << problem.type << ", \"" |
46 << problem.description << "\"]"; | 54 << problem.description << "\"]"; |
47 return o; | 55 return o; |
48 } | 56 } |
49 | 57 |
50 } // namespace addressinput | 58 } // namespace addressinput |
51 } // namespace i18n | 59 } // namespace i18n |
OLD | NEW |