| Leonetienne/Hazelnupp Simple, easy to use, command line parameter interface

Functions
main.cpp File Reference
`#include <iostream>`
`#include "Hazelnupp.h"`
`#include "IntValue.h"`
Include dependency graph for main.cpp:

Go to the source code of this file.

## Functions
int | main (int argc, char **argv)

## Function Documentation

## ◆ main()

int main | ( | int | argc,
|  | char ** | argv
| ) |  |

Definition at line 7 of file main.cpp.

8 {
9 Hazelnupp nupp;
10
11 nupp.SetBriefDescription("This is the testing application for Hazelnupp.");
12
13 nupp.RegisterDescription("--help", "This will display the parameter documentation.");
14 nupp.RegisterDescription("--force", "Just forces it.");
15 nupp.RegisterDescription("--width", "The width of something...");
16 nupp.RegisterDescription("--name", "The names to target");
17 nupp.RegisterDescription("--fruit", "The fruit to use");
18
19 nupp.RegisterAbbreviation("-f", "--force");
20 nupp.RegisterAbbreviation("-w", "--width");
21 nupp.RegisterAbbreviation("-h", "--height");
22
23 nupp.RegisterConstraint("--width", ParamConstraint::TypeSafety(DATA_TYPE::FLOAT));
24 nupp.RegisterConstraint("--name", ParamConstraint(true, DATA_TYPE::LIST, {"peter", "hannes"}, true));
25 nupp.RegisterConstraint("--fruit", ParamConstraint(true, DATA_TYPE::STRING, {}, true));
26
27 nupp.Parse(argc, argv);
28
29 return 0;
30 }
Hazelnp::Hazelnupp
The main class to interface with.
Definition: Hazelnupp.h:11
Hazelnp::Hazelnupp::SetBriefDescription
void SetBriefDescription(const std::string &description)
Sets a brief description of the application to be automatically added to the documentation.
Definition: Hazelnupp.cpp:313
Hazelnp::ParamConstraint
Definition: ParamConstraint.h:8
Hazelnp::Hazelnupp::Parse
void Parse(const int argc, const char *const *argv)
Will parse command line arguments.
Definition: Hazelnupp.cpp:36
Hazelnp::Hazelnupp::RegisterAbbreviation
void RegisterAbbreviation(const std::string &abbrev, const std::string &target)
Will register an abbreviation (like -f for –force)
Definition: Hazelnupp.cpp:527
Hazelnp::Hazelnupp::RegisterConstraint
void RegisterConstraint(const std::string &key, const ParamConstraint &constraint)
Will register a constraint for a parameter.
Definition: Hazelnupp.cpp:558
Hazelnp::Hazelnupp::RegisterDescription
void RegisterDescription(const std::string &parameter, const std::string &description)
Willl register a short description for a parameter.
Definition: Hazelnupp.cpp:324