OutputBuilderText.hpp

Go to the documentation of this file.
00001 
00015 #ifndef OutputBuilderText_H
00016 #define OutputBuilderText_H
00017 
00018 #include "OutputBuilder.hpp"
00019 #include <iostream>
00020 using namespace std;
00021 
00022 namespace OA {
00023 
00025 ostream &indt(ostream &os);
00026 
00028 ostream &pushIndt(ostream &os);
00029 
00031 ostream &popIndt(ostream &os);
00032 
00033 // colors are specific to UNIX terminals.
00034 // use color sparingly
00035 ostream &black(ostream &os);
00036 ostream &red(ostream &os);
00037 ostream &green(ostream &os);
00038 ostream &yellow(ostream &os);
00039 ostream &blue(ostream &os);
00040 ostream &magenta(ostream &os);
00041 ostream &purple(ostream &os);
00042 ostream &cyan(ostream &os);
00043 ostream &white(ostream &os);
00044 ostream &brBlack(ostream &os);
00045 ostream &darkGray(ostream &os);
00046 ostream &darkGrey(ostream &os);
00047 ostream &brRed(ostream &os);
00048 ostream &brGreen(ostream &os);
00049 ostream &brYellow(ostream &os);
00050 ostream &brBlue(ostream &os);
00051 ostream &brMagenta(ostream &os);
00052 ostream &brPurple(ostream &os);
00053 ostream &brCyan(ostream &os);
00054 ostream &brWhite(ostream &os);
00055 
00056 
00057 ostream &blackBG(ostream &os);
00058 ostream &redBG(ostream &os);
00059 ostream &greenBG(ostream &os);
00060 ostream &yellowBG(ostream &os);
00061 ostream &blueBG(ostream &os);
00062 ostream &magentaBG(ostream &os);
00063 ostream &purpleBG(ostream &os);
00064 ostream &cyanBG(ostream &os);
00065 ostream &whiteBG(ostream &os);
00066 ostream &brBlackBG(ostream &os);
00067 ostream &darkGrayBG(ostream &os);
00068 ostream &darkGreyBG(ostream &os);
00069 ostream &brRedBG(ostream &os);
00070 ostream &brGreenBG(ostream &os);
00071 ostream &brYellowBG(ostream &os);
00072 ostream &brBlueBG(ostream &os);
00073 ostream &brMagentaBG(ostream &os);
00074 ostream &brPurpleBG(ostream &os);
00075 ostream &brCyanBG(ostream &os);
00076 ostream &brWhiteBG(ostream &os);
00077 
00078 
00079 ostream &boldOn(ostream &os);
00080 ostream &underlineOn(ostream &os);
00081 ostream &blinkOn(ostream &os);
00082 
00083 ostream &boldOff(ostream &os);
00084 ostream &underlineOff(ostream &os);
00085 ostream &blinkOff(ostream &os);
00086 
00087 ostream &resetColor(ostream &os);
00088 
00089 
00090 
00091 class OutputBuilderText : public OutputBuilder { 
00092 
00093   public:
00094     OutputBuilderText() : mObjDepth(0), mStream(std::cout) {}
00095     OutputBuilderText(std::ostream& s) : mObjDepth(0), mStream(s) {}
00096 
00097     //void configStream(std::ostream& s) : mStream(s) {}
00098 
00099   virtual void outputString(const std::string &str);
00100 
00101     //*****************************************************************
00102     // IRHandles
00103     //*****************************************************************
00104     void outputIRHandle(ProcHandle h, IRHandlesIRInterface& pIR);
00105     void outputIRHandle(StmtHandle h, IRHandlesIRInterface& pIR);
00106     void outputIRHandle(ExprHandle h, IRHandlesIRInterface& pIR);
00107     void outputIRHandle(CallHandle h, IRHandlesIRInterface& pIR);
00108     void outputIRHandle(OpHandle h, IRHandlesIRInterface& pIR);
00109     void outputIRHandle(MemRefHandle h, IRHandlesIRInterface& pIR);
00110     void outputIRHandle(SymHandle h, IRHandlesIRInterface& pIR);
00111     void outputIRHandle(ConstSymHandle h, IRHandlesIRInterface& pIR);
00112     void outputIRHandle(ConstValHandle h, IRHandlesIRInterface& pIR);
00113 
00114     //*****************************************************************
00115     // Object
00116     //*****************************************************************
00117     void objStart(const std::string& objName); 
00118     void objEnd(const std::string& objName);
00119 
00121     void field(const std::string& fieldname, const std::string& value);
00122  
00123     // for fields whose value requires further output calls
00124     void fieldStart(const std::string& fieldname);
00125     void fieldEnd(const std::string& fieldname);
00126 
00127     //*****************************************************************
00128     // Lists
00129     //*****************************************************************
00130     void listStart();
00131     void listEnd();
00132 
00134     void listItem(const std::string& value);
00135 
00137     void listItemStart();
00138     void listItemEnd();
00139 
00140     //*****************************************************************
00141     // Maps
00142     //*****************************************************************
00143     void mapStart(const std::string& label,
00144                   const std::string& keyLabel,
00145                   const std::string& valueLabel);
00146     void mapEnd(const std::string& label);
00147 
00149     void mapEntry(const std::string& key, const std::string& value);
00150     void mapKey(const std::string& key);
00151     void mapValue(const std::string& value);
00152 
00153 
00155     void mapEntryStart();
00156     void mapEntryEnd();
00157     void mapKeyStart();
00158     void mapKeyEnd();
00159     void mapValueStart();
00160     void mapValueEnd();
00161 
00162     //*****************************************************************
00163     // Graphs
00164     //*****************************************************************
00165     virtual void graphStart(const std::string &label);
00166     virtual void graphEnd(const std::string &label);
00167     virtual void graphSubStart(const std::string &label);
00168     virtual void graphSubEnd(const std::string &label);
00169 
00170     virtual void graphNodeStart(int id);
00171     virtual void graphNodeLabel(const std::string &label);
00172     virtual void graphNodeLabelStart();
00173     virtual void graphNodeLabelEnd();
00174     virtual void graphNodeEnd();
00175 
00176     virtual void graphEdgeStart();
00177     virtual void graphEdgeLabelStart();
00178     virtual void graphEdgeLabelEnd();
00179     virtual void graphEdgeSourceNode(int id);
00180     virtual void graphEdgeSinkNode(int id);
00181     virtual void graphEdgeEnd();
00182 
00183   protected:
00184     int mObjDepth;
00185     std::ostream& mStream;
00186 
00187   private:
00188     int mListItemCount;
00189 };
00190 
00191 } // end of OA namespace
00192 
00193 #endif
00194 

Generated on Sat Oct 31 05:21:25 2009 for OpenAnalysis by  doxygen 1.6.1