00001 #ifndef XDKWRL_PRETTYPRINTER_H
00002 #define XDKWRL_PRETTYPRINTER_H
00003
00004 #include <xdkwrl/config.h>
00005 #include <xdkwrl/node.h>
00006 #include <xdkwrl/proto.h>
00007 #include <iostream>
00008 #include <map>
00009 #include <stack>
00010
00011 namespace wrl
00012 {
00013 class Scene;
00014
00015
00016
00017 class XDKWRL_EXPORT PrettyPrinter
00018 {
00019 public:
00020 PrettyPrinter(std::ostream& s);
00021 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFBool& v);
00022 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFColor& v);
00023 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFFloat& v);
00024 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFImage& v);
00025 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFInt32& v);
00026 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFNode& v);
00027 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFRotation& v);
00028 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFString& v);
00029 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFTime& v);
00030 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFVec2f& v);
00031 friend PrettyPrinter& operator<<(PrettyPrinter& p,const SFVec3f& v);
00032 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFColor& v);
00033 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFFloat& v);
00034 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFInt32& v);
00035 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFNode& v);
00036 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFRotation& v);
00037 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFString& v);
00038 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFTime& v);
00039 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFVec2f& v);
00040 friend PrettyPrinter& operator<<(PrettyPrinter& p,const MFVec3f& v);
00041 friend PrettyPrinter& operator<<(PrettyPrinter& p,
00042 const Node::FieldHandle& h);
00043 friend PrettyPrinter& operator<<(PrettyPrinter& p,
00044 const Node::EventInHandle& h);
00045 friend PrettyPrinter& operator<<(PrettyPrinter& p,
00046 const Node::EventOutHandle& h);
00047 friend PrettyPrinter& operator<<(PrettyPrinter& p,const Scene& s);
00048 protected:
00049 void inc();
00050 void dec();
00051 void newline();
00052 private:
00053 std::ostream* ostm_;
00054 int indent_;
00055 bool bol_;
00056 std::map<Node*,std::string> definedNodes_;
00057 std::stack<ProtoDeclaration::BindingMap> fieldBindingsStack_;
00058 std::stack<ProtoDeclaration::BindingMap> eventInBindingsStack_;
00059 std::stack<ProtoDeclaration::BindingMap> eventOutBindingsStack_;
00060 unsigned int forcep_;
00061 bool forcePrinting_;
00062 };
00063 };
00064 #endif // XDKWRL_PRETTYPRINTER_H
00065
00066
00067
00068
00069
00070