aseprite/src/cfg/cfg.h
David Capello 73658399cc Add setting/preference classes/enums generator
Changes:
* Add a class (Option<T>) to get/set/listen changes to one specific
  preference option
* Add data/pref.xml with the metadata to generate types/classes (not it's
  quite easy to add new preferences)
* Modify the generator to support generation of .h and .cpp files of
  preference types
* Add code to migrate old options to new ones (and functions to delete
  old values)
* Only a couple of options were migrated at the moment, it is a WIP, in the
  future we should completely remove ISettings and direct calls
  to set/get_config_*
2014-12-14 20:19:31 -03:00

45 lines
1.2 KiB
C++

// Aseprite Config Library
// Copyright (c) 2014 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef CFG_CFG_H_INCLUDED
#define CFG_CFG_H_INCLUDED
#pragma once
#include <string>
namespace cfg {
class CfgFile {
public:
CfgFile();
~CfgFile();
const std::string& filename() const;
const char* getValue(const char* section, const char* name, const char* defaultValue) const;
bool getBoolValue(const char* section, const char* name, bool defaultValue);
int getIntValue(const char* section, const char* name, int defaultValue);
double getDoubleValue(const char* section, const char* name, double defaultValue);
void setValue(const char* section, const char* name, const char* value);
void setBoolValue(const char* section, const char* name, bool value);
void setIntValue(const char* section, const char* name, int value);
void setDoubleValue(const char* section, const char* name, double value);
void deleteValue(const char* section, const char* name);
void load(const std::string& filename);
void save();
private:
class CfgFileImpl;
CfgFileImpl* m_impl;
};
} // namespace cfg
#endif