JSONMarkUp.hpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #ifndef _JSONMARKUP_HPP_
  2. #define _JSONMARKUP_HPP_
  3. namespace CONFIGURATOR
  4. {
  5. /*static const char* JSON_BEGIN("\
  6. {\n\
  7. \"data\": \n\
  8. {\n\
  9. \"PageTitle\": \"Configuration Manager\",\n\
  10. \"APIVersion\": \"2.0\",\n\
  11. \"toplevelcontainer\": \n\
  12. [\n");
  13. static const char* JSON_END("\n\
  14. ]\n\
  15. }\n\
  16. }\n");*/
  17. static const char* JSON_BEGIN("\
  18. {\n\
  19. \"content\": {\n\
  20. \"innercontent\": [\n");
  21. static const char* JSON_END("\
  22. ]\n\
  23. }\n\
  24. }\n");
  25. static const char* JSON_CONTENT_BEGIN(",\"content\" : {\n");
  26. static const char* JSON_CONTENT_END("}\n");
  27. static const char* JSON_LABEL("\"label\":");
  28. static const char* JSON_VALUES("\"values\":");
  29. static const char* JSON_VALUE("\"value\":");
  30. static const char* JSON_TYPE("\"type\":");
  31. static const char* JSON_TYPE_TAB("tab");
  32. static const char* JSON_TYPE_TABLE("table");
  33. static const char* JSON_TYPE_INPUT("input");
  34. static const char* JSON_TYPE_DROP_DOWN("dropdown");
  35. static const char* JSON_KEY("\"key\":");
  36. static const char* JSON_TOOLTIP("\"tooltip\": ");
  37. static const char* JSON_DEFAULT_VALUE("\"defaultValue\":");
  38. static const char* JSON_COLUMN_NAMES_VALUE("\"columnNames\":");
  39. static const char* JSON_INNER_CONTENT_BEGIN_1("\"innercontent\": [ \n");
  40. static const char* JSON_INNER_CONTENT_END("]");
  41. static const char* JSON_NAVIGATOR_BEGIN("[{\n");
  42. static const char* JSON_NAVIGATOR_END("}]\n");
  43. static const char* JSON_NAVIGATOR_NODE_BEGIN("[{\n");
  44. static const char* JSON_NAVIGATOR_NODE_END("}]\n");
  45. static const char* JSON_NAVIGATOR_TEXT("\"text\":");
  46. //static const char* JSON_NAVIGATOR_TYPE("\"type\":");
  47. static const char* JSON_NAVIGATOR_KEY("\"href\": ");
  48. //static const char* JSON_NAVIGATOR_KEY(JSON_DEFAULT_VALUE);
  49. static const char* JSON_NAVIGATOR_SELECTABLE("\"selectable\":");
  50. static const char* JSON_NAVIGATOR_NODES("\"nodes\":");
  51. #define CONTENT_INNER_CONTENT_BEGIN strJSON.append(JSON_CONTENT_BEGIN);offset += STANDARD_OFFSET_1;quickOutPad(strJSON, offset);strJSON.append(JSON_INNER_CONTENT_BEGIN_1);
  52. #define INNER_CONTENT_END offset -= STANDARD_OFFSET_1;strJSON.append(JSON_INNER_CONTENT_END);
  53. #define CONTENT_CONTENT_END offset -= STANDARD_OFFSET_1;strJSON.append(JSON_CONTENT_END);
  54. class CJSONMarkUpHelper
  55. {
  56. public:
  57. static void createUIContent(::StringBuffer &strJSON, unsigned int &offset, const char *pUIType, const char* pLabel, const char* pKey, const char *pToolTip = "", const char *pDefaultValue = "", const char* pValues = "", const char* pValue = "");
  58. //static void createUIContent(::StringBuffer &strJSON, unsigned int &offset, ::StringBuffer strUIType, ::StringBuffer strLabel, ::StringBuffer strKey, ::StringBuffer strToolTip = "", ::StringBuffer strDefaultValue = "", ::StringBuffer strValues = "", ::StringBuffer strValue = "");
  59. static void getNavigatorJSON(::StringBuffer &strJSON);
  60. };
  61. }
  62. #endif // _JSONMARKUP_HPP_