From ccff0b87a28177cd9f298adc9b650e5143b371f6 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Tue, 23 Aug 2022 19:33:09 +0400 Subject: cmDocumentation: Accept `Iterable` instead of `vector` on add entries --- Source/cmDocumentation.cxx | 20 -------------------- Source/cmDocumentation.h | 24 ++++++++++++++++++------ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 9f9393d..93685ad 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -373,14 +373,6 @@ void cmDocumentation::SetSection(const char* name, this->SectionAtName(name) = std::move(section); } -void cmDocumentation::SetSection(const char* name, - std::vector& docs) -{ - cmDocumentationSection sec{ name }; - sec.Append(docs); - this->SetSection(name, std::move(sec)); -} - void cmDocumentation::SetSection(const char* name, const char* docs[][2]) { cmDocumentationSection sec{ name }; @@ -406,24 +398,12 @@ void cmDocumentation::PrependSection(const char* name, const char* docs[][2]) this->SectionAtName(name).Prepend(docs); } -void cmDocumentation::PrependSection(const char* name, - std::vector& docs) -{ - this->SectionAtName(name).Prepend(docs); -} - void cmDocumentation::AppendSection(const char* name, const char* docs[][2]) { this->SectionAtName(name).Append(docs); } void cmDocumentation::AppendSection(const char* name, - std::vector& docs) -{ - this->SectionAtName(name).Append(docs); -} - -void cmDocumentation::AppendSection(const char* name, cmDocumentationEntry& docs) { diff --git a/Source/cmDocumentation.h b/Source/cmDocumentation.h index 4055039..de5449a 100644 --- a/Source/cmDocumentation.h +++ b/Source/cmDocumentation.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "cmDocumentationFormatter.h" @@ -74,19 +75,30 @@ public: /** Set a section of the documentation. Typical sections include Name, Usage, Description, Options */ void SetSection(const char* sectionName, cmDocumentationSection section); - void SetSection(const char* sectionName, - std::vector& docs); + template + void SetSection(const char* sectionName, const Iterable& docs) + { + cmDocumentationSection sec{ sectionName }; + sec.Append(docs); + this->SetSection(sectionName, std::move(sec)); + } void SetSection(const char* sectionName, const char* docs[][2]); void SetSections(std::map sections); /** Add the documentation to the beginning/end of the section */ void PrependSection(const char* sectionName, const char* docs[][2]); - void PrependSection(const char* sectionName, - std::vector& docs); + template + void PrependSection(const char* sectionName, const Iterable& docs) + { + this->SectionAtName(sectionName).Prepend(docs); + } void PrependSection(const char* sectionName, cmDocumentationEntry& docs); void AppendSection(const char* sectionName, const char* docs[][2]); - void AppendSection(const char* sectionName, - std::vector& docs); + template + void AppendSection(const char* sectionName, const Iterable& docs) + { + this->SectionAtName(sectionName).Append(docs); + } void AppendSection(const char* sectionName, cmDocumentationEntry& docs); /** Add common (to all tools) documentation section(s) */ -- cgit v0.12