aboutsummaryrefslogtreecommitdiff
path: root/examples/provider/file_config_store.h
blob: e7398d1679e6d16e6831d5981c2aec970a23d295 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2015 The Weave Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef LIBWEAVE_EXAMPLES_PROVIDER_FILE_CONFIG_STORE_H_
#define LIBWEAVE_EXAMPLES_PROVIDER_FILE_CONFIG_STORE_H_

#include <map>
#include <string>
#include <vector>

#include <weave/provider/config_store.h>
#include <weave/provider/task_runner.h>

namespace weave {
namespace examples {

class FileConfigStore : public provider::ConfigStore {
 public:
  FileConfigStore(bool disable_security,
                  const std::string& model_id,
                  provider::TaskRunner* task_runner);

  bool LoadDefaults(Settings* settings) override;
  std::string LoadSettings(const std::string& name) override;
  void SaveSettings(const std::string& name,
                    const std::string& settings,
                    const DoneCallback& callback) override;

  std::string LoadSettings() override;

 private:
  std::string GetPath(const std::string& name) const;
  const bool disable_security_;
  const std::string model_id_;
  provider::TaskRunner* task_runner_{nullptr};
};

}  // namespace examples
}  // namespace weave

#endif  // LIBWEAVE_EXAMPLES_PROVIDER_FILE_CONFIG_STORE_H_