FAUST compiler  0.9.9.6b8
description.hh
Go to the documentation of this file.
00001 #ifndef __DESCRIPTION__
00002 #define __DESCRIPTION__
00003 
00004 //------------------------------------
00005 // generation of an xml description
00006 //------------------------------------
00007 
00008 #include <string>
00009 #include <list>
00010 #include <set>
00011 #include <map>
00012 #include <string>
00013 #include "signals.hh"
00014 #include "smartpointer.hh"
00015 #include "tlib.hh"
00016 #include "uitree.hh"
00017 
00018 using namespace std;
00019 
00020 void extractMetadata(const string& fulllabel, string& label, map<string, set<string> >& metadata);
00021 string extractName(Tree fulllabel);
00022 
00023 class Description
00024 {
00025     string          fName;
00026     string          fAuthor;
00027     string          fCopyright;
00028     string          fLicense;
00029     string          fVersion;
00030     
00031     int             fInputs;
00032     int             fOutputs;
00033     int             fWidgetID;
00034     int             fActiveWidgetCount;
00035     int             fPassiveWidgetCount;
00036     list<string>    fActiveLines;
00037     list<string>    fPassiveLines;
00038     list<string>    fLayoutLines;
00039     list<int>       fLayoutTabs;
00040     
00041 
00042   public:
00043   
00044     Description():  /*fName("Unknow"), 
00045                     fAuthor("Unknow"), 
00046                     fCopyright("Unknow"),
00047                     fLicense("Unknow"), 
00048                     fVersion("Unknow"),*/
00049                     
00050                     fInputs(0),
00051                     fOutputs(0),
00052                     fWidgetID(0),
00053                     fActiveWidgetCount(0),
00054                     fPassiveWidgetCount(0)
00055                     {}
00056                     
00057     Description*    name(const string& s)           { fName = s;    return this; }
00058     Description*    author(const string& s)         { fAuthor = s;  return this; }
00059     Description*    copyright(const string& s)      { fCopyright = s; return this; }
00060     Description*    license(const string& s)        { fLicense = s; return this; }
00061     Description*    version(const string& s)        { fVersion = s; return this; }
00062     
00063     Description*    inputs(int n)                   { fInputs = n;  return this; }
00064     Description*    outputs(int n)                  { fOutputs = n; return this; }
00065     
00066     void            ui(Tree t);
00067     void            print(int n, ostream& fout);
00068     
00069         
00070   private:
00071     void            addGroup(int level, Tree t);
00072     int             addWidget(Tree label, Tree varname, Tree sig);
00073     
00074     void            tab (int n, ostream& fout);
00075     void            addActiveLine(const string& l)  { fActiveLines.push_back(l);}
00076     void            addPassiveLine(const string& l) { fPassiveLines.push_back(l);}
00077     void            addLayoutLine(int n, const string& l)   { fLayoutTabs.push_back(n); fLayoutLines.push_back(l);}
00078     
00079     
00080 };
00081 
00082 #endif