/*############################################################################## HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ############################################################################## */ #ifndef THORXMLWRITE_HPP #define THORXMLWRITE_HPP #ifdef THORHELPER_EXPORTS #define thorhelper_decl DECL_EXPORT #else #define thorhelper_decl DECL_IMPORT #endif #include "eclhelper.hpp" #include "jptree.hpp" #include "thorhelper.hpp" class thorhelper_decl CommonFieldProcessor : implements IFieldProcessor, public CInterface { bool trim; StringBuffer &result; public: IMPLEMENT_IINTERFACE; CommonFieldProcessor(StringBuffer &_result, bool _trim=false); virtual void processString(unsigned len, const char *value, const RtlFieldInfo * field); virtual void processBool(bool value, const RtlFieldInfo * field); virtual void processData(unsigned len, const void *value, const RtlFieldInfo * field); virtual void processInt(__int64 value, const RtlFieldInfo * field); virtual void processUInt(unsigned __int64 value, const RtlFieldInfo * field); virtual void processReal(double value, const RtlFieldInfo * field); virtual void processDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field); virtual void processUDecimal(const void *value, unsigned digits, unsigned precision, const RtlFieldInfo * field); virtual void processUnicode(unsigned len, const UChar *value, const RtlFieldInfo * field); virtual void processQString(unsigned len, const char *value, const RtlFieldInfo * field); virtual void processUtf8(unsigned len, const char *value, const RtlFieldInfo * field); virtual bool processBeginSet(const RtlFieldInfo * field, unsigned numElements, bool isAll, const byte *data); virtual bool processBeginDataset(const RtlFieldInfo * field, unsigned numRows); virtual bool processBeginRow(const RtlFieldInfo * field); virtual void processEndSet(const RtlFieldInfo * field); virtual void processEndDataset(const RtlFieldInfo * field); virtual void processEndRow(const RtlFieldInfo * field); }; extern thorhelper_decl void printKeyedValues(StringBuffer &out, IIndexReadContext *segs, IOutputMetaData *rowMeta); extern thorhelper_decl void convertRowToXML(size32_t & lenResult, char * & result, IOutputMetaData & info, const void * row, unsigned flags = (unsigned)-1); extern thorhelper_decl void convertRowToJSON(size32_t & lenResult, char * & result, IOutputMetaData & info, const void * row, unsigned flags = (unsigned)-1); #endif // THORXMLWRITE_HPP