Defined in header <cparse/Generator.hh>

virtual std::string generateFilename( std::string const& base,
                                      std::string const& ext ) const noexcept;

Returns convertUpperCaseCamel(base) + convertLowerCase(ext). The extension is not treated specially — the leading dot (or absence of one) is preserved from ext.

Parameters

ParameterDescription
baseBare filename, typically snake_case or space-separated words.
extExtension, typically ".HH" or ".cpp". Passed through convertLowerCase, so the dot is preserved but any upper-case letters are lower-cased.

Return value

convertUpperCaseCamel(base) + convertLowerCase(ext).

For generateFilename("state_machine", ".HH") the result is "StateMachine.hh".

Exceptions

noexcept.

Notes

Override to change the filename convention — for example, to emit snake_case.hh files instead of UpperCamel.hh, or to embed a prefix:

std::string generateFilename(std::string const& base,
                             std::string const& ext) const noexcept override
{
    return "gen_" + convertLowerCase(base) + convertLowerCase(ext);
}

See also