Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
Hazelnupp
main.cpp
Go to the documentation of this file.
1
#include <iostream>
2
#include "
Hazelnupp.h
"
3
#include "
IntValue.h
"
4
5
using namespace
Hazelnp
;
6
7
int
main
(
int
argc,
char
** argv)
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.
RegisterConstraints
({
24
ParamConstraint::TypeSafety
(
"--width"
,
DATA_TYPE::FLOAT
),
25
ParamConstraint
(
"--name"
,
true
,
DATA_TYPE::LIST
, {
"peter"
,
"hannes"
},
true
),
26
ParamConstraint
(
"--fruit"
,
true
,
DATA_TYPE::STRING
, {},
true
)
27
});
28
29
nupp.
Parse
(argc, argv);
30
31
return
0;
32
}
Hazelnp
Definition:
DataType.h:4
Hazelnp::Hazelnupp
The main class to interface with.
Definition:
Hazelnupp.h:11
IntValue.h
main
int main(int argc, char **argv)
Definition:
main.cpp:7
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:306
Hazelnp::DATA_TYPE::LIST
@ LIST
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:35
Hazelnp::Hazelnupp::RegisterAbbreviation
void RegisterAbbreviation(const std::string &abbrev, const std::string &target)
Will register an abbreviation (like -f for –force)
Definition:
Hazelnupp.cpp:499
Hazelnp::Hazelnupp::RegisterConstraints
void RegisterConstraints(const std::vector< ParamConstraint > &constraints)
Will register parameter constraints.
Definition:
Hazelnupp.cpp:521
Hazelnupp.h
Hazelnp::DATA_TYPE::FLOAT
@ FLOAT
Hazelnp::ParamConstraint::TypeSafety
static ParamConstraint TypeSafety(const std::string &key, DATA_TYPE wantedType, bool constrainType=true)
Constructs a type-safety constraint.
Definition:
ParamConstraint.h:27
Hazelnp::DATA_TYPE::STRING
@ STRING
Hazelnp::Hazelnupp::RegisterDescription
void RegisterDescription(const std::string ¶meter, const std::string &description)
Willl register a short description for a parameter.
Definition:
Hazelnupp.cpp:317
Generated on Fri Jun 4 2021 15:58:56 for Leonetienne/Hazelnupp by
1.8.17