-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbetter_docs.patch
220 lines (207 loc) · 9.34 KB
/
better_docs.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
diff --git a/doc/doxyfile.in b/doc/doxyfile.in
index 6f24bea..80bbe03 100644
--- a/doc/doxyfile.in
+++ b/doc/doxyfile.in
@@ -1086,7 +1086,7 @@ IGNORE_PREFIX =
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
# The default value is: YES.
-GENERATE_HTML = NO
+GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
diff --git a/include/c74_min_attribute.h b/include/c74_min_attribute.h
index 3748b8a..7d44c74 100644
--- a/include/c74_min_attribute.h
+++ b/include/c74_min_attribute.h
@@ -207,6 +207,12 @@ namespace c74::min {
return m_name;
}
+ /// Determine the size of the attribute
+ /// @return the size of the attribute
+
+ size_t size() const {
+ return m_size;
+ }
/// Is the attribute writable (meaning settable)?
/// @return True if it is writable. Otherwise false.
diff --git a/include/c74_min_doc.h b/include/c74_min_doc.h
index ef04be1..518d998 100644
--- a/include/c74_min_doc.h
+++ b/include/c74_min_doc.h
@@ -113,6 +113,34 @@ namespace c74::min {
}
+ #define MIN_DISCUSSION static constexpr const char* class_discussion
+
+ template<typename min_class_type>
+ struct has_class_discussion {
+ template<class, class>
+ class checker;
+
+ template<typename C>
+ static std::true_type test(checker<C, decltype(&C::class_discussion)>*);
+
+ template<typename C>
+ static std::false_type test(...);
+
+ typedef decltype(test<min_class_type>(nullptr)) type;
+ static const bool value = is_same<std::true_type, decltype(test<min_class_type>(nullptr))>::value;
+ };
+
+ template<class min_class_type>
+ typename enable_if<has_class_discussion<min_class_type>::value>::type doc_get_discussion(std::string& returned_class_discussion) {
+ returned_class_discussion = min_class_type::class_discussion;
+ }
+
+ template<class min_class_type>
+ typename enable_if<!has_class_discussion<min_class_type>::value>::type doc_get_discussion(std::string& returned_class_discussion) {
+ returned_class_discussion = "";
+ }
+
+
template<class min_class_type>
void doc_generate(const min_class_type& instance, const std::string& refpage_fullpath, const std::string& max_class_name, const std::string& min_class_name) {
documentation_flags flags = documentation_flags::none;
@@ -178,7 +206,46 @@ namespace c74::min {
refpage_file << " <metadata name='tag'>" << str::trim(class_tags[i]) << "</metadata>" << endl;
refpage_file << " </metadatalist>" << endl;
refpage_file << endl << endl;
+ // inlets
+
+ const auto& inlets = instance.inlets();
+ if (!inlets.empty()) {
+ refpage_file << " <!--INLETS-->" << endl;
+ refpage_file << " <inletlist>" << endl;
+ for(auto i=0;i<inlets.size();i++) { //need to get i for inlet id
+ const string description = inlets[i]->description();
+ const string attr_type = inlets[i]->type();
+
+ refpage_file << " <inlet id='" << i << "' type='" << attr_type << "'>" << endl;
+ refpage_file << " <description>" << endl;
+ refpage_file << " " << description << endl;
+ refpage_file << " </description>" << endl;
+ refpage_file << " </inlet>" << endl;
+ }
+ refpage_file << " </inletlist>" << endl;
+
+ }
+
+ // outlet
+
+ const auto& outlets = instance.outlets();
+ if (!outlets.empty()) {
+ refpage_file << " <!--OUTLETS-->" << endl;
+ refpage_file << " <outletlist>" << endl;
+ for(auto i=0;i<outlets.size();i++) { //need to get i for inlet id
+ const string description = outlets[i]->description();
+ const string attr_type = outlets[i]->type();
+
+ refpage_file << " <outlets id='" << i << "' type='" << attr_type << "'>" << endl;
+ refpage_file << " <description>" << endl;
+ refpage_file << " " << description << endl;
+ refpage_file << " </description>" << endl;
+ refpage_file << " </outlets>" << endl;
+ }
+ refpage_file << " </outletlist>" << endl;
+ }
+
// arguments
refpage_file << " <!--ARGUMENTS-->" << endl << endl;
@@ -266,9 +333,51 @@ namespace c74::min {
if (c)
*c = 0;
- refpage_file << " <attribute name='" << attr_object.name() << "' get='1' set='" << attr_object.writable() << "' type='" << attr_type << "' size='1' >" << endl;
+ if(attr_object.size() > 1) {
+ refpage_file << " <attribute name='" << attr_object.name() << "' get='1' set='" << attr_object.writable() << "' type='" << attr_type << "' size='" << attr_object.size() << "'" << ">" << endl;;
+ } else {
+ refpage_file << " <attribute name='" << attr_object.name() << "' get='1' set='" << attr_object.writable() << "' type='" << attr_type << "' size='1'" << ">" << endl;;
+
+ }
refpage_file << " <digest>" << digest << "</digest>" << endl;
- refpage_file << " <description>" << description << "</description>" << endl;
+ refpage_file << " <description>" << description;
+
+ if(attr_object.default_string() != "") {
+ refpage_file << " (default = " << attr_object.default_string() << ")" ;
+ }
+
+ refpage_file << " </description>" << endl;
+
+ if((attr_type == "symbol" ) && (!attr_object.range_string().empty())) {
+ vector <string> tokens;
+ istringstream iss(attr_object.range_string());
+ while(iss) {
+ string word;
+ iss >> word;
+ if(word != "") {
+ tokens.push_back(word);
+ }
+ }
+
+ refpage_file << " <attributelist>" << endl;
+ refpage_file << " <attribute name='enumvals' get='1' set='1' type='atom' size='" << tokens.size() <<"'" << ">" << endl;
+ refpage_file << " <enumlist>" << endl;
+
+
+ for(auto i=0;i<tokens.size();i++) {
+ refpage_file << " <enum name=" << tokens[i] << ">" << endl ;
+ refpage_file << " </enum>" << endl ;
+ }
+
+ refpage_file << " </enumlist>" << endl;
+ refpage_file << " </attribute>" << endl;
+ refpage_file << " <attribute name='label' get='1' set='1' type='symbol' size='1' value='" << attr_object.label_string() << "' />" << endl;
+ refpage_file << " <attribute name='style' get='1' set='1' type='symbol' size='1' value='enum' />" << endl;
+ refpage_file << " </attributelist>" << endl;
+
+ refpage_file << endl;
+ }
+
refpage_file << " </attribute>" << endl << endl;
}
catch (...) {
@@ -290,6 +399,17 @@ namespace c74::min {
refpage_file << " </seealsolist>" << endl;
refpage_file << endl << endl;
+
+ // discussion
+
+ refpage_file << " <!--DISCUSSION-->" << endl << endl;
+
+ string class_discussion;
+ doc_get_discussion<min_class_type>(class_discussion);
+ if(class_discussion != "") {
+ refpage_file << " <discussion>" << class_discussion << "</discussion>" << endl;
+ }
+
// footer
refpage_file << "</c74object>" << endl;
diff --git a/include/c74_min_object_components.h b/include/c74_min_object_components.h
index 2e0aa55..5851110 100644
--- a/include/c74_min_object_components.h
+++ b/include/c74_min_object_components.h
@@ -175,7 +175,12 @@ namespace c74::min {
auto inlets() -> std::vector<inlet_base*>& {
return m_inlets;
}
-
+
+ /// Get a reference to this object's inlets.
+ /// @return A reference to this object's inlets.
+ auto inlets() const -> const std::vector<inlet_base*>& {
+ return m_inlets;
+ }
/// Get a reference to this object's outlets.
/// @return A reference to this object's outlets.
@@ -183,7 +188,12 @@ namespace c74::min {
auto outlets() -> std::vector<outlet_base*>& {
return m_outlets;
}
-
+
+ /// Get a reference to this object's outlets.
+ /// @return A reference to this object's outlets.
+ auto outlets() const -> const std::vector<outlet_base*>& {
+ return m_outlets;
+ }
/// Get a reference to this object's argument declarations.
/// Note that to get the actual argument values you will need to call state() and parse the dictionary.