From 54de30d7c606afe9b132ee7e36e9a769e50ac51b Mon Sep 17 00:00:00 2001 From: Todd Ingalls Date: Mon, 6 Sep 2021 15:53:45 -0700 Subject: [PATCH 1/3] added size method for to provide better documentation output --- include/c74_min_attribute.h | 7 +++++++ 1 file changed, 7 insertions(+) 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)? From bc1e7f57465532c8dbf7cf7c7d5d9987a426a824 Mon Sep 17 00:00:00 2001 From: Todd Ingalls Date: Mon, 6 Sep 2021 15:54:40 -0700 Subject: [PATCH 2/3] added const inlets and outlets --- include/c74_min_object_components.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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. From 6746c3fa942be12f88f5ad57fefddc0667a88c7e Mon Sep 17 00:00:00 2001 From: Todd Ingalls Date: Mon, 6 Sep 2021 15:59:19 -0700 Subject: [PATCH 3/3] added number of things to make reference generation more informative these just add to autogeneration that make it contain some of the other information/fields used in standard max reference adds MIN_DISCUSSION to add an optional discssion section documents list of inlets and outlets. these exist in currernt max documentation but don't seem to be used. indicates forrect size of attributes (e.g. 2 symbols) indicates default value for attributes lists options for enumvals as seen in max reference documents. --- include/c74_min_doc.h | 128 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 124 insertions(+), 4 deletions(-) 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; }