wuwebview.hpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef WUWEBVIEW_INCL
  14. #define WUWEBVIEW_INCL
  15. #ifdef _WIN32
  16. #ifdef WUWEBVIEW_EXPORTS
  17. #define WUWEBVIEW_API __declspec(dllexport)
  18. #else
  19. #define WUWEBVIEW_API __declspec(dllimport)
  20. #endif
  21. #else
  22. #define WUWEBVIEW_API
  23. #endif
  24. #define WWV_OMIT_XML_DECLARATION 0x0001
  25. #define WWV_USE_DISPLAY_XSLT 0x0002
  26. #define WWV_OMIT_RESULT_TAG 0x0004
  27. #define WWV_ADD_SOAP 0x0008
  28. #define WWV_ADD_RESULTS_TAG 0x0010
  29. #define WWV_ADD_RESPONSE_TAG 0x0020
  30. #define WWV_OMIT_SCHEMAS 0x0040
  31. #define WWV_CDATA_SCHEMAS 0x0080
  32. #define WWV_INCL_NAMESPACES 0x0100
  33. #define WWV_INCL_GENERATED_NAMESPACES 0x0200
  34. interface IWuWebView : extends IInterface
  35. {
  36. virtual void getResultViewNames(StringArray &names)=0;
  37. virtual void renderResults(const char *viewName, const char *xml, StringBuffer &html)=0;
  38. virtual void renderResults(const char *viewName, StringBuffer &html)=0;
  39. virtual void renderSingleResult(const char *viewName, const char *resultname, StringBuffer &html)=0;
  40. virtual void applyResultsXSLT(const char *file, const char *xml, StringBuffer &html)=0;
  41. virtual void applyResultsXSLT(const char *file, StringBuffer &html)=0;
  42. virtual StringBuffer &aggregateResources(const char *type, StringBuffer &content)=0;
  43. virtual void expandResults(const char *xml, StringBuffer &out, unsigned flags)=0;
  44. virtual void expandResults(StringBuffer &out, unsigned flags)=0;
  45. virtual void addInputsFromPTree(IPropertyTree *pt)=0;
  46. virtual void addInputsFromXml(const char *xml)=0;
  47. virtual void createWuidResponse(StringBuffer &out, unsigned flags)=0;
  48. virtual bool getResourceByPath(const char *path, MemoryBuffer &mb)=0;
  49. virtual StringBuffer &getManifest(StringBuffer &mf)=0;
  50. };
  51. extern WUWEBVIEW_API IWuWebView *createWuWebView(IConstWorkUnit &wu, const char *queryname, const char*dir, bool mapEspDir);
  52. extern WUWEBVIEW_API IWuWebView *createWuWebView(const char *wuid, const char *queryname, const char*dir, bool mapEspDir);
  53. static inline bool isPathSeparator(char sep)
  54. {
  55. return (sep=='\\')||(sep=='/');
  56. }
  57. static inline const char *skipPathNodes(const char *&s, int skip)
  58. {
  59. if (s) {
  60. while (*s) {
  61. if (isPathSeparator(*s++))
  62. if (!skip--)
  63. return s;
  64. }
  65. }
  66. return NULL;
  67. }
  68. static inline const char *nextPathNode(const char *&s, StringBuffer &node, int skip=0)
  69. {
  70. if (skip)
  71. skipPathNodes(s, skip);
  72. if (s) while (*s) {
  73. if (isPathSeparator(*s))
  74. return s++;
  75. node.append(*s++);
  76. }
  77. return NULL;
  78. }
  79. static inline const char *firstPathNode(const char *&s, StringBuffer &node)
  80. {
  81. if (s && isPathSeparator(*s))
  82. s++;
  83. return nextPathNode(s, node);
  84. }
  85. #endif