// Copyright (C) 2013 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "testdata_source.h" #include <cassert> #include <cstddef> #include <cstdlib> #include <fstream> #include <iostream> #include <map> #include <string> namespace i18n { namespace addressinput { const char kDataFileName[] = …; namespace { // For historical reasons, normal and aggregated data is here stored in the // same data structure, differentiated by giving each key a prefix. It does // seem like a good idea to refactor this. const char kNormalPrefix = …; const char kAggregatePrefix = …; // Each data key begins with this string. Example of a data key: // data/CH/AG const char kDataKeyPrefix[] = …; // The number of characters in the data key prefix. const size_t kDataKeyPrefixLength = …; // The number of characters in a CLDR region code, e.g. 'CH'. const size_t kCldrRegionCodeLength = …; // The number of characters in an aggregate data key, e.g. 'data/CH'. const size_t kAggregateDataKeyLength = …; std::map<std::string, std::string> InitData(const std::string& src_path) { … } const std::map<std::string, std::string>& GetData(const std::string& src_path) { … } } // namespace TestdataSource::TestdataSource(bool aggregate, const std::string& src_path) : … { … } TestdataSource::TestdataSource(bool aggregate) : … { … } TestdataSource::~TestdataSource() = default; void TestdataSource::Get(const std::string& key, const Callback& data_ready) const { … } } // namespace addressinput } // namespace i18n