Home | History | Annotate | Download | only in shill
      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 //
     16 
     17 #ifndef SHILL_GEOLOCATION_INFO_H_
     18 #define SHILL_GEOLOCATION_INFO_H_
     19 
     20 #include <map>
     21 #include <string>
     22 #include <vector>
     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 
     37   void AddField(const std::string& key, const std::string& value);
     38   const std::string& GetFieldValue(const std::string& key) const;
     39 
     40   const std::map<std::string, std::string> properties() const {
     41     return properties_;
     42   }
     43 
     44  private:
     45   FRIEND_TEST(WiFiMainTest, GetGeolocationObjects);
     46 
     47   // An equality testing helper for unit tests.
     48   bool Equals(const GeolocationInfo& info) const;
     49 
     50   std::map<std::string, std::string> properties_;
     51 };
     52 
     53 typedef std::vector<GeolocationInfo> GeolocationInfos;
     54 
     55 }  // namespace shill
     56 
     57 #endif  // SHILL_GEOLOCATION_INFO_H_
     58