Home | History | Annotate | Download | only in provider
      1 // Copyright 2015 The Weave 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 LIBWEAVE_EXAMPLES_PROVIDER_FILE_CONFIG_STORE_H_
      6 #define LIBWEAVE_EXAMPLES_PROVIDER_FILE_CONFIG_STORE_H_
      7 
      8 #include <map>
      9 #include <string>
     10 #include <vector>
     11 
     12 #include <weave/provider/config_store.h>
     13 #include <weave/provider/task_runner.h>
     14 
     15 namespace weave {
     16 namespace examples {
     17 
     18 class FileConfigStore : public provider::ConfigStore {
     19  public:
     20   FileConfigStore(const std::string& model_id,
     21                   provider::TaskRunner* task_runner);
     22 
     23   bool LoadDefaults(Settings* settings) override;
     24   std::string LoadSettings(const std::string& name) override;
     25   void SaveSettings(const std::string& name,
     26                     const std::string& settings,
     27                     const DoneCallback& callback) override;
     28 
     29   std::string LoadSettings() override;
     30 
     31  private:
     32   std::string GetPath(const std::string& name) const;
     33   const std::string model_id_;
     34   provider::TaskRunner* task_runner_{nullptr};
     35 };
     36 
     37 }  // namespace examples
     38 }  // namespace weave
     39 
     40 #endif  // LIBWEAVE_EXAMPLES_PROVIDER_FILE_CONFIG_STORE_H_
     41