Added incompatibilities to the auto-generated documentation

This commit is contained in:
Leonetienne
2021-09-05 12:24:10 +02:00
parent a9706267db
commit 19560b538f
5 changed files with 30 additions and 7 deletions

View File

@@ -439,6 +439,7 @@ std::string CmdArgsInterface::GenerateDocumentation() const
bool required = false;
bool typeIsForced = false;
std::string defaultVal;
std::string incompatibilities;
};
std::unordered_map<std::string, ParamDocEntry> paramInfos;
@@ -478,19 +479,33 @@ std::string CmdArgsInterface::GenerateDocumentation() const
cached.typeIsForced = it.second.constrainType;
cached.type = DataTypeToString(it.second.requiredType);
std::stringstream defaultValueSs;
// Build default-value string
std::stringstream vec2str_ss;
for (const std::string& s : it.second.defaultValue)
{
defaultValueSs << '\'' << s << '\'';
vec2str_ss << '\'' << s << '\'';
// Add a space if we are not at the last entry
if ((void*)&s != (void*)&it.second.defaultValue.back())
defaultValueSs << " ";
vec2str_ss << " ";
}
cached.defaultVal = defaultValueSs.str();
cached.defaultVal = vec2str_ss.str();
// Build incompatibilities string
vec2str_ss.str("");
for (const std::string& s : it.second.incompatibleParameters)
{
vec2str_ss << s;
// Add a comma-space if we are not at the last entry
if ((void*)&s != (void*)&it.second.incompatibleParameters.back())
vec2str_ss << ", ";
}
cached.incompatibilities = vec2str_ss.str();
}
// Now generate the documentatino body
// Now generate the documentation body
if (paramInfos.size() > 0)
{
ss << std::endl
@@ -517,6 +532,10 @@ std::string CmdArgsInterface::GenerateDocumentation() const
if (pde.defaultVal.length() > 0)
ss << "default=[" << pde.defaultVal << "] ";
// Put incompatibilities
if (pde.incompatibilities.length() > 0)
ss << "incompatibilities=[" << pde.incompatibilities << "] ";
// Put required tag, but only if no default value
if ((pde.required) && (pde.defaultVal.length() == 0))
ss << "[[REQUIRED]] ";

View File

@@ -162,6 +162,7 @@
<ClInclude Include="StringTools.h" />
<ClInclude Include="StringValue.h" />
<ClInclude Include="Value.h" />
<ClInclude Include="Version.h" />
<ClInclude Include="VoidValue.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@@ -83,5 +83,8 @@
<ClInclude Include="CmdArgsInterface.h">
<Filter>Headerdateien</Filter>
</ClInclude>
<ClInclude Include="Version.h">
<Filter>Headerdateien</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -1,2 +1,2 @@
#pragma once
#define HAZELNUPP_VERSION (1.1)
#define HAZELNUPP_VERSION (1.11)