thorxmlwrite.hpp 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 THORXMLWRITE_HPP
  14. #define THORXMLWRITE_HPP
  15. #ifdef THORHELPER_EXPORTS
  16. #define thorhelper_decl DECL_EXPORT
  17. #else
  18. #define thorhelper_decl DECL_IMPORT
  19. #endif
  20. #include "eclhelper.hpp"
  21. #include "jptree.hpp"
  22. #include "thorhelper.hpp"
  23. class thorhelper_decl CommonFieldProcessor : implements IFieldProcessor, public CInterface
  24. {
  25. bool trim;
  26. StringBuffer &result;
  27. public:
  28. IMPLEMENT_IINTERFACE;
  29. CommonFieldProcessor(StringBuffer &_result, bool _trim=false);
  30. virtual void processString(unsigned len, const char *value, const RtlFieldInfo * field);
  31. virtual void processBool(bool value, const RtlFieldInfo * field);
  32. virtual void processData(unsigned len, const void *value, const RtlFieldInfo * field);
  33. virtual void processInt(__int64 value, const RtlFieldInfo * field);
  34. virtual void processUInt(unsigned __int64 value, const RtlFieldInfo * field);
  35. virtual void processReal(double value, const RtlFieldInfo * field);
  36. virtual void processDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field);
  37. virtual void processUDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field);
  38. virtual void processUnicode(unsigned len, const UChar *value, const RtlFieldInfo * field);
  39. virtual void processQString(unsigned len, const char *value, const RtlFieldInfo * field);
  40. virtual void processUtf8(unsigned len, const char *value, const RtlFieldInfo * field);
  41. virtual bool processBeginSet(const RtlFieldInfo * field, unsigned numElements, bool isAll, const byte *data);
  42. virtual bool processBeginDataset(const RtlFieldInfo * field, unsigned numRows);
  43. virtual bool processBeginRow(const RtlFieldInfo * field);
  44. virtual void processEndSet(const RtlFieldInfo * field);
  45. virtual void processEndDataset(const RtlFieldInfo * field);
  46. virtual void processEndRow(const RtlFieldInfo * field);
  47. };
  48. extern thorhelper_decl void printKeyedValues(StringBuffer &out, IIndexReadContext *segs, IOutputMetaData *rowMeta);
  49. extern thorhelper_decl void convertRowToXML(size32_t & lenResult, char * & result, IOutputMetaData & info, const void * row, unsigned flags = (unsigned)-1);
  50. extern thorhelper_decl void convertRowToJSON(size32_t & lenResult, char * & result, IOutputMetaData & info, const void * row, unsigned flags = (unsigned)-1);
  51. #endif // THORXMLWRITE_HPP