# Leonetienne/Hazelnupp: Hazelnupp/main.cpp Source File

main.cpp
Go to the documentation of this file.
#include <iostream>
#include "Hazelnupp.h"
#include "IntValue.h"
using namespace Hazelnp;
int main(int argc, char** argv)
{
Hazelnupp nupp;
nupp.SetBriefDescription("This is the testing application for Hazelnupp.");
nupp.RegisterDescription("--help", "This will display the parameter documentation.");
nupp.RegisterDescription("--force", "Just forces it.");
nupp.RegisterDescription("--width", "The width of something...");
nupp.RegisterDescription("--name", "The names to target");
nupp.RegisterDescription("--fruit", "The fruit to use");
nupp.RegisterAbbreviation("-f", "--force");
nupp.RegisterAbbreviation("-w", "--width");
nupp.RegisterAbbreviation("-h", "--height");
nupp.RegisterConstraint("--width", ParamConstraint::TypeSafety(DATA_TYPE::FLOAT));
nupp.RegisterConstraint("--name", ParamConstraint(true, DATA_TYPE::LIST, {"peter", "hannes"}, true));
nupp.RegisterConstraint("--fruit", ParamConstraint(true, DATA_TYPE::STRING, {}, true));
nupp.Parse(argc, argv);
return 0;
}
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:313
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: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
Hazelnupp.h
Hazelnp::Hazelnupp::RegisterConstraint
void RegisterConstraint(const std::string &key, const ParamConstraint &constraint)
Will register a constraint for a parameter.
Definition: Hazelnupp.cpp:558
Hazelnp::DATA_TYPE::FLOAT
@ FLOAT
Hazelnp::DATA_TYPE::STRING
@ STRING
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
Hazelnp::ParamConstraint::TypeSafety
static ParamConstraint TypeSafety(DATA_TYPE wantedType, bool constrainType=true)
Constructs a type-safety constraint.
Definition: ParamConstraint.h:26