Source

libphonenumber-csharp / cpp / src / phonenumbers / geocoding / default_map_storage.h

Diff from to

cpp/src/phonenumbers/geocoding/default_map_storage.h

 #ifndef I18N_PHONENUMBERS_DEFAULT_MAP_STORAGE_H_
 #define I18N_PHONENUMBERS_DEFAULT_MAP_STORAGE_H_
 
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
 #include "base/basictypes.h"
-#include "phonenumbers/geocoding/area_code_map_storage_strategy.h"
 
 namespace i18n {
 namespace phonenumbers {
 
-using std::map;
-using std::set;
-using std::string;
-using std::vector;
+struct PrefixDescriptions;
 
 // Default area code map storage strategy that is used for data not
 // containing description duplications. It is mainly intended to avoid
 // the overhead of the string table management when it is actually
 // unnecessary (i.e no string duplication).
-class DefaultMapStorage : public AreaCodeMapStorageStrategy {
+class DefaultMapStorage {
  public:
   DefaultMapStorage();
   virtual ~DefaultMapStorage();
 
-  virtual int GetPrefix(int index) const;
-  virtual const string& GetDescription(int index) const;
-  virtual void ReadFromMap(const map<int, string>& area_codes);
-  virtual int GetNumOfEntries() const;
-  virtual const set<int>& GetPossibleLengths() const;
+  // Returns the phone number prefix located at the provided index.
+  int32 GetPrefix(int index) const;
+
+  // Gets the description corresponding to the phone number prefix located
+  // at the provided index. If the description is not available in the current
+  // language an empty string is returned.
+  const char* GetDescription(int index) const;
+
+  // Sets the internal state of the underlying storage implementation from the
+  // provided area_codes that maps phone number prefixes to description strings.
+  void ReadFromMap(const PrefixDescriptions* descriptions);
+
+  // Returns the number of entries contained in the area code map.
+  int GetNumOfEntries() const;
+
+  // Returns an array containing the possible lengths of prefixes sorted in
+  // ascending order.
+  const int* GetPossibleLengths() const;
+
+  // Returns the number of elements in GetPossibleLengths() array.
+  int GetPossibleLengthsSize() const;
 
  private:
   // Sorted sequence of phone number prefixes.
-  vector<int> prefixes_;
+  const int32* prefixes_;
+  int prefixes_size_;
   // Sequence of prefix descriptions, in the same order than prefixes_.
-  vector<string> descriptions_;
+  const char** descriptions_;
   // Sequence of unique possible lengths in ascending order.
-  set<int> possible_lengths_;
+  const int32* possible_lengths_;
+  int possible_lengths_size_;
 
   DISALLOW_COPY_AND_ASSIGN(DefaultMapStorage);
 };
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.