Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_GEOLOCATION_INFO_ |
| 6 | #define SHILL_GEOLOCATION_INFO_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
Gaurav Shah | b790aa2 | 2012-10-23 12:51:12 -0700 | [diff] [blame] | 10 | #include <vector> |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 11 | |
| 12 | #include <gtest/gtest_prod.h> // for FRIEND_TEST |
| 13 | |
| 14 | namespace shill { |
| 15 | |
| 16 | class WiFiMainTest; |
| 17 | |
| 18 | // This class stores properties (key-value pairs) for a single entity |
| 19 | // (e.g. a WiFi access point) that may be used for geolocation. |
| 20 | class GeolocationInfo { |
| 21 | public: |
| 22 | GeolocationInfo(); |
| 23 | ~GeolocationInfo(); |
| 24 | |
| 25 | void AddField(const std::string &key, const std::string &value); |
| 26 | const std::string &GetFieldValue(const std::string &key) const; |
Gaurav Shah | b790aa2 | 2012-10-23 12:51:12 -0700 | [diff] [blame] | 27 | |
| 28 | const std::map<std::string, std::string> properties() const { |
| 29 | return properties_; |
| 30 | } |
| 31 | |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 32 | private: |
| 33 | FRIEND_TEST(WiFiMainTest, GetGeolocationObjects); |
| 34 | |
| 35 | // An equality testing helper for unit tests. |
| 36 | bool Equals(const GeolocationInfo &info) const; |
| 37 | |
| 38 | std::map<std::string, std::string> properties_; |
| 39 | }; |
| 40 | |
Gaurav Shah | b790aa2 | 2012-10-23 12:51:12 -0700 | [diff] [blame] | 41 | typedef std::vector<GeolocationInfo> GeolocationInfos; |
| 42 | |
Gaurav Shah | 6d2c72d | 2012-10-16 16:30:44 -0700 | [diff] [blame] | 43 | } // namespace shill |
| 44 | |
| 45 | #endif // SHILL_GEOLOCATION_INFO_ |