PolyConfig.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * PolyConfig.h
  3. * Poly
  4. *
  5. * Created by Ivan Safrin on 4/15/09.
  6. * Copyright 2009 __MyCompanyName__. All rights reserved.
  7. *
  8. */
  9. // @package Services
  10. #pragma once
  11. #include "PolyGlobals.h"
  12. #include <string>
  13. #include <vector>
  14. #include "tinyxml.h"
  15. #include "PolyUtil.h"
  16. using std::string;
  17. using std::vector;
  18. namespace Polycode {
  19. class ConfigEntry {
  20. public:
  21. string key;
  22. string configNamespace;
  23. float numVal;
  24. string stringVal;
  25. bool isString;
  26. };
  27. class _PolyExport Config {
  28. public:
  29. Config();
  30. ~Config();
  31. void loadConfig(string configNamespace, string fileName);
  32. void saveConfig(string configNamespace, string fileName);
  33. ConfigEntry *getEntry(string configNamespace, string key);
  34. void setStringValue(string configNamespace, string key, string value);
  35. void setNumericValue(string configNamespace, string key, float value);
  36. float getNumericValue(string configNamespace, string key);
  37. string getStringValue(string configNamespace, string key);
  38. private:
  39. vector<ConfigEntry*> entries;
  40. };
  41. }