Peter Qiu | c0beca5 | 2015-09-03 11:25:46 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2012 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 16 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 17 | #ifndef SHILL_GEOLOCATION_INFO_H_ |
| 18 | #define SHILL_GEOLOCATION_INFO_H_ |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 19 | |
| 20 | #include <map> |
| 21 | #include <string> |
Gaurav Shah | b790aa2 | 2012-10-23 12:51:12 -0700 | [diff] [blame] | 22 | #include <vector> |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 23 | |
| 24 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 25 | |
| 26 | namespace shill { |
| 27 | |
| 28 | class WiFiMainTest; |
| 29 | |
| 30 | // This class stores properties (key-value pairs) for a single entity |
| 31 | // (e.g. a WiFi access point) that may be used for geolocation. |
| 32 | class GeolocationInfo { |
| 33 | public: |
| 34 | GeolocationInfo(); |
| 35 | ~GeolocationInfo(); |
| 36 | |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 37 | void AddField(const std::string& key, const std::string& value); |
| 38 | const std::string& GetFieldValue(const std::string& key) const; |
Gaurav Shah | b790aa2 | 2012-10-23 12:51:12 -0700 | [diff] [blame] | 39 | |
| 40 | const std::map<std::string, std::string> properties() const { |
| 41 | return properties_; |
| 42 | } |
| 43 | |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 44 | private: |
| 45 | FRIEND_TEST(WiFiMainTest, GetGeolocationObjects); |
| 46 | |
| 47 | // An equality testing helper for unit tests. |
Paul Stewart | 8ae1874 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 48 | bool Equals(const GeolocationInfo& info) const; |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 49 | |
| 50 | std::map<std::string, std::string> properties_; |
| 51 | }; |
| 52 | |
Gaurav Shah | b790aa2 | 2012-10-23 12:51:12 -0700 | [diff] [blame] | 53 | typedef std::vector<GeolocationInfo> GeolocationInfos; |
| 54 | |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 55 | } // namespace shill |
| 56 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 57 | #endif // SHILL_GEOLOCATION_INFO_H_ |