diff --git a/include/c74_min_attribute.h b/include/c74_min_attribute.h index 3748b8a..fef0d01 100644 --- a/include/c74_min_attribute.h +++ b/include/c74_min_attribute.h @@ -206,6 +206,13 @@ namespace c74::min { symbol name() const { 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)? diff --git a/include/c74_min_doc.h b/include/c74_min_doc.h index ef04be1..a8ac694 100644 --- a/include/c74_min_doc.h +++ b/include/c74_min_doc.h @@ -112,6 +112,34 @@ namespace c74::min { returned_description = "Unknown"; } + #define MIN_DISCUSSION static constexpr const char* class_discussion + + template + struct has_class_discussion { + template + class checker; + + template + static std::true_type test(checker*); + + template + static std::false_type test(...); + + typedef decltype(test(nullptr)) type; + static const bool value = is_same(nullptr))>::value; + }; + + template + typename enable_if::value>::type doc_get_discussion(std::string& returned_class_discussion) { + returned_class_discussion = min_class_type::class_discussion; + } + + template + typename enable_if::value>::type doc_get_discussion(std::string& returned_class_discussion) { + returned_class_discussion = ""; + } + + template 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) { @@ -179,6 +207,46 @@ namespace c74::min { refpage_file << " " << endl; refpage_file << endl << endl; + // inlets + + const auto& inlets = instance.inlets(); + if (!inlets.empty()) { + refpage_file << " " << endl; + refpage_file << " " << endl; + for(auto i=0;idescription(); + const string attr_type = inlets[i]->type(); + + refpage_file << " " << endl; + refpage_file << " " << endl; + refpage_file << " " << description << endl; + refpage_file << " " << endl; + refpage_file << " " << endl; + } + refpage_file << " " << endl; + + } + + // outlet + + const auto& outlets = instance.outlets(); + if (!outlets.empty()) { + refpage_file << " " << endl; + refpage_file << " " << endl; + for(auto i=0;idescription(); + const string attr_type = outlets[i]->type(); + + refpage_file << " " << endl; + refpage_file << " " << endl; + refpage_file << " " << description << endl; + refpage_file << " " << endl; + refpage_file << " " << endl; + } + refpage_file << " " << endl; + + } + // arguments refpage_file << " " << endl << endl; @@ -265,10 +333,51 @@ namespace c74::min { c = strchr(digest, '.'); if (c) *c = 0; - - refpage_file << " " << endl; + + if(attr_object.size() > 1) { + refpage_file << " " << endl;; + } else { + refpage_file << " " << endl;; + } refpage_file << " " << digest << "" << endl; - refpage_file << " " << description << "" << endl; + + refpage_file << " " << description; + + if(attr_object.default_string() != "") { + refpage_file << " (default = " << attr_object.default_string() << ")" ; + } + refpage_file << " " << endl; + + if((attr_type == "symbol" ) && (!attr_object.range_string().empty())) { + vector tokens; + istringstream iss(attr_object.range_string()); + while(iss) { + string word; + iss >> word; + if(word != "") { + tokens.push_back(word); + } + } + + refpage_file << " " << endl; + refpage_file << " " << endl; + refpage_file << " " << endl; + + + for(auto i=0;i" << endl ; + refpage_file << " " << endl ; + } + + refpage_file << " " << endl; + refpage_file << " " << endl; + refpage_file << " " << endl; + refpage_file << " " << endl; + refpage_file << " " << endl; + + refpage_file << endl; + } + refpage_file << " " << endl << endl; } catch (...) { @@ -290,8 +399,19 @@ namespace c74::min { refpage_file << " " << endl; refpage_file << endl << endl; - // footer + + + // discussion + refpage_file << " " << endl << endl; + string class_discussion; + doc_get_discussion(class_discussion); + if(class_discussion != "") { + refpage_file << " " << class_discussion << "" << endl; + } + + + // footer refpage_file << "" << endl; } diff --git a/include/c74_min_object_components.h b/include/c74_min_object_components.h index ac8b575..1b4523c 100644 --- a/include/c74_min_object_components.h +++ b/include/c74_min_object_components.h @@ -175,6 +175,12 @@ namespace c74::min { auto inlets() -> std::vector& { 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& { + return m_inlets; + } /// Get a reference to this object's outlets. @@ -183,6 +189,12 @@ namespace c74::min { auto outlets() -> std::vector& { 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& { + return m_outlets; + } /// Get a reference to this object's argument declarations.