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