DriverConfigInfo.hpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include <string>
  3. #include "ResDataObject.h"
  4. #pragma warning (disable:4251)
  5. class ConfigInfo
  6. {
  7. public:
  8. ConfigInfo(const char* Key, const char* strType, const char* strAccess, const char* strRequired, const char* strDefaultValue)
  9. {
  10. strConfKey = Key;
  11. ResDataObject temp;
  12. temp.update("Type", strType);
  13. temp.update("Access", strAccess);
  14. temp.update("Required", strRequired);
  15. temp.update("DefaultValue", strDefaultValue);
  16. resDescription = temp.encode();
  17. };
  18. virtual ~ConfigInfo() {};
  19. void ConfigInfo::SetList(const char* str)
  20. {
  21. ResDataObject temp;
  22. temp.decode(resDescription.c_str());
  23. temp.update("List", str);
  24. resDescription = temp.encode();
  25. };
  26. void ConfigInfo::SetRange(const char* strmin, const char* strmax)
  27. {
  28. ResDataObject temp;
  29. temp.decode(resDescription.c_str());
  30. temp.update("RangeMin", strmin);
  31. temp.update("RangeMax", strmax);
  32. resDescription = temp.encode();
  33. };
  34. const char* ConfigInfo::GetDescription()
  35. {
  36. return resDescription.c_str();
  37. };
  38. const char* ConfigInfo::GetCurrentValue()
  39. {
  40. return resValue.c_str();
  41. };
  42. void ConfigInfo::SetCurrentValue(const char* res)
  43. {
  44. resValue = res;
  45. };
  46. const char* ConfigInfo::GetKey()
  47. {
  48. return strConfKey.c_str();
  49. };
  50. private:
  51. std::string strConfKey;
  52. std::string resValue;
  53. std::string resDescription;
  54. };