Bug fixed in the Makefile.
[Faustine.git] / interpretor / faust-0.9.47mr3 / compiler / generator / description.hh
1 #ifndef __DESCRIPTION__
2 #define __DESCRIPTION__
3
4 //------------------------------------
5 // generation of an xml description
6 //------------------------------------
7
8 #include <string>
9 #include <list>
10 #include <set>
11 #include <map>
12 #include <string>
13 #include "signals.hh"
14 #include "smartpointer.hh"
15 #include "tlib.hh"
16 #include "uitree.hh"
17
18 using namespace std;
19
20 void extractMetadata(const string& fulllabel, string& label, map<string, set<string> >& metadata);
21 string extractName(Tree fulllabel);
22
23 class Description
24 {
25 string fName;
26 string fAuthor;
27 string fCopyright;
28 string fLicense;
29 string fVersion;
30
31 int fInputs;
32 int fOutputs;
33 int fWidgetID;
34 int fActiveWidgetCount;
35 int fPassiveWidgetCount;
36 list<string> fActiveLines;
37 list<string> fPassiveLines;
38 list<string> fLayoutLines;
39 list<int> fLayoutTabs;
40
41
42 public:
43
44 Description(): /*fName("Unknow"),
45 fAuthor("Unknow"),
46 fCopyright("Unknow"),
47 fLicense("Unknow"),
48 fVersion("Unknow"),*/
49
50 fInputs(0),
51 fOutputs(0),
52 fWidgetID(0),
53 fActiveWidgetCount(0),
54 fPassiveWidgetCount(0)
55 {}
56
57 Description* name(const string& s) { fName = s; return this; }
58 Description* author(const string& s) { fAuthor = s; return this; }
59 Description* copyright(const string& s) { fCopyright = s; return this; }
60 Description* license(const string& s) { fLicense = s; return this; }
61 Description* version(const string& s) { fVersion = s; return this; }
62
63 Description* inputs(int n) { fInputs = n; return this; }
64 Description* outputs(int n) { fOutputs = n; return this; }
65
66 void ui(Tree t);
67 void print(int n, ostream& fout);
68
69
70 private:
71 void addGroup(int level, Tree t);
72 int addWidget(Tree label, Tree varname, Tree sig);
73
74 void tab (int n, ostream& fout);
75 void addActiveLine(const string& l) { fActiveLines.push_back(l);}
76 void addPassiveLine(const string& l) { fPassiveLines.push_back(l);}
77 void addLayoutLine(int n, const string& l) { fLayoutTabs.push_back(n); fLayoutLines.push_back(l);}
78
79
80 };
81
82 #endif