![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /********************************************** 00002 00003 License: BSD 00004 Project Webpage: http://cajun-jsonapi.sourceforge.net/ 00005 Author: Terry Caton 00006 00007 ***********************************************/ 00008 00009 #ifndef WNS_PROBE_BUS_JSON_WRITER_HPP 00010 #define WNS_PROBE_BUS_JSON_WRITER_HPP 00011 00012 #include <WNS/probe/bus/json/elements.hpp> 00013 #include <WNS/probe/bus/json/visitor.hpp> 00014 00015 namespace wns { namespace probe { namespace bus { namespace json { 00016 00017 class Writer : private ConstVisitor 00018 { 00019 public: 00020 static void Write(const Object& object, std::ostream& ostr); 00021 static void Write(const Array& array, std::ostream& ostr); 00022 static void Write(const String& string, std::ostream& ostr); 00023 static void Write(const Number& number, std::ostream& ostr); 00024 static void Write(const Boolean& boolean, std::ostream& ostr); 00025 static void Write(const Null& null, std::ostream& ostr); 00026 static void Write(const UnknownElement& elementRoot, std::ostream& ostr); 00027 00028 private: 00029 Writer(std::ostream& ostr); 00030 00031 template <typename ElementTypeT> 00032 static void Write_i(const ElementTypeT& element, std::ostream& ostr); 00033 00034 void Write_i(const Object& object); 00035 void Write_i(const Array& array); 00036 void Write_i(const String& string); 00037 void Write_i(const Number& number); 00038 void Write_i(const Boolean& boolean); 00039 void Write_i(const Null& null); 00040 void Write_i(const UnknownElement& unknown); 00041 00042 virtual void Visit(const Array& array); 00043 virtual void Visit(const Object& object); 00044 virtual void Visit(const Number& number); 00045 virtual void Visit(const String& string); 00046 virtual void Visit(const Boolean& boolean); 00047 virtual void Visit(const Null& null); 00048 00049 std::ostream& m_ostr; 00050 int m_nTabDepth; 00051 }; 00052 00053 } // json 00054 } // bus 00055 } // probe 00056 } // wns 00057 00058 00059 #include <WNS/probe/bus/json/writerInl.hpp> 00060 00061 #endif // WNS_PROBE_BUS_JSON_WRITER_HPP
1.5.5