Browse Source

Improve doc

experiment/meta_header
Martchus 5 years ago
parent
commit
438ca48cbb
  1. 19
      application/argumentparser.cpp
  2. 14
      application/argumentparser.h
  3. 10
      cmake/templates/global.h.in
  4. 10
      global.h

19
application/argumentparser.cpp

@ -24,13 +24,17 @@ using namespace IoUtilities;
*/
namespace ApplicationUtilities {
/// \cond
/// \brief Specifies the name of the application (used by ArgumentParser::printHelp()).
const char *applicationName = nullptr;
/// \brief Specifies the author of the application (used by ArgumentParser::printHelp()).
const char *applicationAuthor = nullptr;
/// \brief Specifies the version of the application (used by ArgumentParser::printHelp()).
const char *applicationVersion = nullptr;
/// \brief Specifies the URL to the application website (used by ArgumentParser::printHelp()).
const char *applicationUrl = nullptr;
/// \cond
inline bool notEmpty(const char *str)
{
return str && *str;
@ -1099,4 +1103,15 @@ HelpArgument::HelpArgument(ArgumentParser &parser) :
});
}
/*!
* \class OperationArgument
* \brief The OperationArgument class is an Argument where denotesOperation() is true by default.
*/
/*!
* \class ConfigValueArgument
* \brief The ConfigValueArgument class is an Argument where setCombinable() is true by default.
* \sa ConfigValueArgument::ConfigValueArgument()
*/
}

14
application/argumentparser.h

@ -19,6 +19,11 @@ CPP_UTILITIES_EXPORT extern const char *applicationAuthor;
CPP_UTILITIES_EXPORT extern const char *applicationVersion;
CPP_UTILITIES_EXPORT extern const char *applicationUrl;
/*!
* \macro SET_APPLICATION_INFO
* \brief Sets application meta data used by ArgumentParser::printHelp().
* \remarks Reads those data from the config header so "config.h" must be included.
*/
#define SET_APPLICATION_INFO \
::ApplicationUtilities::applicationName = APP_NAME; \
::ApplicationUtilities::applicationAuthor = APP_AUTHOR; \
@ -365,7 +370,7 @@ inline const std::vector<const char *> &Argument::values(std::size_t occurrence)
* The parser will expect that many values when parsing command line arguments.
* A negative value indicates a variable number of arguments to be expected.
*
* The default value is 0.
* The default value is 0, except for ConfigValueArgument instances.
*
* \sa setRequiredValueCount()
* \sa valueNames()
@ -570,7 +575,7 @@ inline bool Argument::isCombinable() const
}
/*!
* \brief Sets if this argument can be combined.
* \brief Sets whether this argument can be combined.
*
* The parser will complain if two arguments labeled as uncombinable are
* present at the same time.
@ -588,7 +593,7 @@ inline void Argument::setCombinable(bool value)
* An argument which denotes the operation might be specified
* withouth "--" or "-" prefix as first main argument.
*
* The default value is false.
* The default value is false, except for OperationArgument instances.
*
* \sa setDenotesOperation()
*/
@ -810,6 +815,9 @@ public:
ConfigValueArgument(const char *name, char abbreviation = '\0', const char *description = nullptr, std::initializer_list<const char *> valueNames = std::initializer_list<const char *>());
};
/*!
* \brief Constructs a new ConfigValueArgument with the specified parameter. The initial value of requiredValueCount() is set to size of specified \a valueNames.
*/
inline ConfigValueArgument::ConfigValueArgument(const char *name, char abbreviation, const char *description, std::initializer_list<const char *> valueNames) :
Argument(name, abbreviation, description)
{

10
cmake/templates/global.h.in

@ -14,4 +14,14 @@
# define @META_PROJECT_VARNAME_UPPER@_IMPORT LIB_IMPORT
#endif
/*!
* \def @META_PROJECT_VARNAME_UPPER@_EXPORT
* \brief Marks the symbol to be exported by the @META_PROJECT_NAME@ library.
*/
/*!
* \def @META_PROJECT_VARNAME_UPPER@_IMPORT
* \brief Marks the symbol to be imported from the @META_PROJECT_NAME@ library.
*/
#endif // @META_PROJECT_VARNAME_UPPER@_GLOBAL

10
global.h

@ -14,4 +14,14 @@
# define CPP_UTILITIES_IMPORT LIB_IMPORT
#endif
/*!
* \def CPP_UTILITIES_EXPORT
* \brief Marks the symbol to be exported by the c++utilities library.
*/
/*!
* \def CPP_UTILITIES_IMPORT
* \brief Marks the symbol to be imported from the c++utilities library.
*/
#endif // CPP_UTILITIES_GLOBAL

Loading…
Cancel
Save