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

Hazelnupp.cpp
Go to the documentation of this file.
1 #include "Hazelnupp.h"
2 #include "VoidValue.h"
3 #include "IntValue.h"
4 #include "FloatValue.h"
5 #include "StringValue.h"
6 #include "ListValue.h"
7 #include "HazelnuppException.h"
8 #include "Placeholders.h"
9 #include "StringTools.h"
10 #include <iostream>
11 #include <cstdlib>
12
13 using namespace Hazelnp;
14
15 Hazelnupp::Hazelnupp()
16 {
17 return;
18 }
19
20 Hazelnupp::Hazelnupp(const int argc, const char* const* argv)
21 {
22 Parse(argc, argv);
23 return;
24 }
25
26 Hazelnupp::~Hazelnupp()
27 {
28 for (auto& it : parameters)
29 delete it.second;
30
31 parameters.clear();
32
33 return;
34 }
35
36 void Hazelnupp::Parse(const int argc, const char* const* argv)
37 {
38 try
39 {
40 // Populate raw arguments
41 PopulateRawArgs(argc, argv);
42
43 // Expand abbreviations
44 ExpandAbbreviations();
45
46 executableName = std::string(rawArgs[0]);
47
48 std::size_t i = 1;
49 while (i < rawArgs.size())
50 {
51 if ((rawArgs[i].length() > 2) && (rawArgs[i].substr(0, 2) == "--"))
52 {
53 Parameter* param = nullptr;
54 i = ParseNextParameter(i, param);
55
56 parameters.insert(std::pair<std::string, Parameter*>(param->Key(), param));
57 }
58 else
59 i++;
60 }
61
62 // Apply constraints such as default values, and required parameters.
63 // Types have already been enforced.
64 // Dont apply constraints when we are just printind the param docs
65 if ((!catchHelp) || (!HasParam("--help")))
66 ApplyConstraints();
67 }
68 catch (const HazelnuppConstraintTypeMissmatch& exc)
69 {
70 if (crashOnFail)
71 {
72 std::cout << GenerateDocumentation() << std::endl << std::endl;
73 std::cerr << "Parameter error: " << exc.What() << std::endl;
74 quick_exit(-1009);
75 }
76 else
77 throw exc; // yeet
78 }
79 catch (const HazelnuppConstraintMissingValue& exc)
80 {
81 if (crashOnFail)
82 {
83 std::cout << GenerateDocumentation() << std::endl << std::endl;
84 std::cerr << "Parameter error: " << exc.What() << std::endl;
85 quick_exit(-1010);
86 }
87 else
88 throw exc; // yeet
89 }
90
91 // Catch --help parameter
92 if ((catchHelp) && (HasParam("--help")))
93 {
94 std::cout << GenerateDocumentation() << std::endl;
95 quick_exit(0);
96 }
97
98 return;
99 }
100
101 std::size_t Hazelnupp::ParseNextParameter(const std::size_t parIndex, Parameter*& out_Par)
102 {
103 std::size_t i = parIndex;
104 const std::string key = rawArgs[parIndex];
105 std::vector<std::string> values;
106
107 // Get values
108 for (i++; i < rawArgs.size(); i++)
109 // If not another parameter
110 if ((rawArgs[i].length() < 2) || (rawArgs[i].substr(0, 2) != "--"))
111 values.emplace_back(rawArgs[i]);
112 else
113 {
114 break;
115 }
116
117 // Fetch constraint info
118 const ParamConstraint* pcn = GetConstraintForKey(key);
119
120 Value* parsedVal = ParseValue(values, pcn);
121 if (parsedVal != nullptr)
122 {
123 out_Par = new Parameter(key, parsedVal);
124
125 delete parsedVal;
126 parsedVal = nullptr;
127 }
128 else
129 throw std::runtime_error("Unable to parse parameter!");
130
131 return i;
132 }
133
134 void Hazelnupp::PopulateRawArgs(const int argc, const char* const* argv)
135 {
136 rawArgs.clear();
137 rawArgs.reserve(argc);
138
139 for (int i = 0; i < argc; i++)
140 rawArgs.emplace_back(std::string(argv[i]));
141
142 return;
143 }
144
145 void Hazelnupp::ExpandAbbreviations()
146 {
147 // Abort if no abbreviations
148 if (parameterAbreviations.size() == 0)
149 return;
150
151 for (std::string& arg : rawArgs)
152 {
153 // Is arg registered as an abbreviation?
154 auto abbr = parameterAbreviations.find(arg);
155 if (abbr != parameterAbreviations.end())
156 {
157 // Yes: replace arg with the long form
158 arg = abbr->second;
159 }
160 }
161
162 return;
163 }
164
165 bool Hazelnupp::HasParam(const std::string& key) const
166 {
167 return parameters.find(key) != parameters.end();
168 }
169
170 Value* Hazelnupp::ParseValue(const std::vector<std::string>& values, const ParamConstraint* constraint)
171 {
172 // This is the raw (unconverted) data type the user provided
173 DATA_TYPE rawInputType;
174
175 // Constraint values
176 const bool constrainType = (constraint != nullptr) && (constraint->constrainType);
177
178 // Void-type
179 if (values.size() == 0)
180 {
181 rawInputType = DATA_TYPE::VOID;
182
183 // Is a list forced via a constraint? If yes, return an empty list
184 if ((constrainType) &&
185 (constraint->requiredType == DATA_TYPE::LIST))
186 return new ListValue();
187
188 // Is a string forced via a constraint? If yes, return an empty string
189 else if ((constrainType) &&
190 (constraint->requiredType == DATA_TYPE::STRING))
191 return new StringValue("");
192
193 // Is an int or float forced via constraint? If yes, throw an exception
194 else if ((constrainType) &&
195 ((constraint->requiredType == DATA_TYPE::INT) ||
196 (constraint->requiredType == DATA_TYPE::FLOAT)))
197 throw HazelnuppConstraintTypeMissmatch(
198 constraint->key,
199 constraint->requiredType,
200 rawInputType,
201 GetDescription(constraint->key)
202 );
203
204 // Else, just return the void type
205 return new VoidValue;
206 }
207
208 // Force void type by constraint
209 else if ((constrainType) &&
210 (constraint->requiredType == DATA_TYPE::VOID))
211 {
212 return new VoidValue;
213 }
214
215 // List-type
216 else if (values.size() > 1)
217 {
218 rawInputType = DATA_TYPE::LIST;
219
220 // Should the type be something other than list?
221 if ((constrainType) &&
222 (constraint->requiredType != DATA_TYPE::LIST))
223 {
224 throw HazelnuppConstraintTypeMissmatch(
225 constraint->key,
226 constraint->requiredType,
227 rawInputType,
228 GetDescription(constraint->key)
229 );
230 }
231
232 ListValue* newList = new ListValue();
233 for (const std::string& val : values)
234 {
235 Value* tmp = ParseValue({ val });
236 newList->AddValue(tmp);
237 delete tmp;
238 }
239 return newList;
240 }
241
242 // Now we're only dealing with a single value
243 const std::string& val = values[0];
244
245 // String
246 if (!StringTools::IsNumeric(val, true))
247 {
248 rawInputType = DATA_TYPE::STRING;
249
250 // Is the type not supposed to be a string?
251 // void and list are already sorted out
252 if ((constrainType) &&
253 (constraint->requiredType != DATA_TYPE::STRING))
254 {
255 // We can only force a list-value from here
256 if (constraint->requiredType == DATA_TYPE::LIST)
257 {
258 ListValue* list = new ListValue();
259 Value* tmp = ParseValue({ val });
260 list->AddValue(tmp);
261 delete tmp;
262 tmp = nullptr;
263 return list;
264 }
265 // Else it is not possible to convert to a numeric
266 else
267 throw HazelnuppConstraintTypeMissmatch(
268 constraint->key,
269 constraint->requiredType,
270 rawInputType,
271 GetDescription(constraint->key)
272 );
273 }
274
275 return new StringValue(val);
276 }
277
278 // In this case we have a numeric value.
279 // We should still produce a string if requested
280 if ((constrainType) &&
281 (constraint->requiredType == DATA_TYPE::STRING))
282 return new StringValue(val);
283
284 // Numeric
285 bool isInt;
286 long double num;
287
288 if (StringTools::ParseNumber(val, isInt, num))
289 {
290 rawInputType = isInt ? DATA_TYPE::INT : DATA_TYPE::FLOAT;
291
292 // Is the type constrained?
293 // (only int and float left)
294 if (constrainType)
295 {
296 // Must it be an integer?
297 if (constraint->requiredType == DATA_TYPE::INT)
298 return new IntValue((long long int)num);
299 // Must it be a floating point?
300 else if (constraint->requiredType == DATA_TYPE::FLOAT)
301 return new FloatValue(num);
302 // Else it must be a List
303 else
304 {
305 ListValue* list = new ListValue();
306 Value* tmp = ParseValue({ val });
307 list->AddValue(tmp);
308 delete tmp;
309 tmp = nullptr;
310 return list;
311 }
312 }
313 // Type is not constrained
314 else
315 {
316 // Integer
317 if (isInt)
318 return new IntValue((long long int)num);
319
320 // Double
321 return new FloatValue(num);
322 }
323 }
324
325 // Failed
326 return nullptr;
327 }
328
329 bool Hazelnupp::GetCrashOnFail() const
330 {
331 return crashOnFail;
332 }
333
334 void Hazelnupp::SetCatchHelp(bool catchHelp)
335 {
336 this->catchHelp = catchHelp;
337 return;
338 }
339
340 bool Hazelnupp::GetCatchHelp() const
341 {
342 return catchHelp;
343 }
344
345 void Hazelnupp::SetBriefDescription(const std::string& description)
346 {
347 briefDescription = description;
348 return;
349 }
350
351 const std::string& Hazelnupp::GetBriefDescription()
352 {
353 return briefDescription;
354 }
355
356 void Hazelnp::Hazelnupp::RegisterDescription(const std::string& parameter, const std::string& description)
357 {
358 parameterDescriptions[parameter] = description;
359 return;
360 }
361
362 const std::string& Hazelnp::Hazelnupp::GetDescription(const std::string& parameter) const
363 {
364 // Do we already have a description for this parameter?
365 if (!HasDescription(parameter))
366 // No? Then return ""
367 return Placeholders::g_emptyString;
368
369 // We do? Then return it
370 return parameterDescriptions.find(parameter)->second;
371 }
372
373 bool Hazelnupp::HasDescription(const std::string& parameter) const
374 {
375 return parameterDescriptions.find(parameter) != parameterDescriptions.end();
376 }
377
378 void Hazelnupp::ClearDescription(const std::string& parameter)
379 {
380 // This will just do nothing if the entry does not exist
381 parameterDescriptions.erase(parameter);
382 return;
383 }
384
385 void Hazelnp::Hazelnupp::ClearDescriptions()
386 {
387 parameterDescriptions.clear();
388 return;
389 }
390
391 std::string Hazelnupp::GenerateDocumentation() const
392 {
393 std::stringstream ss;
394
395 // Add brief, if available
396 if (briefDescription.length() > 0)
397 ss << briefDescription << std::endl;
398
399 // Collect parameter information
400 struct ParamDocEntry
401 {
402 std::string abbreviation;
403 std::string description;
404 std::string type;
405 bool required = false;
406 bool typeIsForced = false;
407 std::string defaultVal;
408 };
409 std::unordered_map<std::string, ParamDocEntry> paramInfos;
410
411 // Collect descriptions
412 for (const auto& it : parameterDescriptions)
413 {
414 // Do we already have that param in the paramInfo set?
415 if (paramInfos.find(it.first) == paramInfos.end())
416 // No? Create it.
417 paramInfos[it.first] = ParamDocEntry();
418
419 paramInfos[it.first].description = it.second;
420 }
421
422 // Collect abbreviations
423 // first value is abbreviation, second is long form
424 for (const auto& it : parameterAbreviations)
425 {
426 // Do we already have that param in the paramInfo set?
427 if (paramInfos.find(it.second) == paramInfos.end())
428 // No? Create it.
429 paramInfos[it.second] = ParamDocEntry();
430
431 paramInfos[it.second].abbreviation = it.first;
432 }
433
434 // Collect constraints
435 for (const auto& it : parameterConstraints)
436 {
437 // Do we already have that param in the paramInfo set?
438 if (paramInfos.find(it.first) == paramInfos.end())
439 // No? Create it.
440 paramInfos[it.first] = ParamDocEntry();
441
442 ParamDocEntry& cached = paramInfos[it.first];
443 cached.required = it.second.required;
444 cached.typeIsForced = it.second.constrainType;
445 cached.type = DataTypeToString(it.second.requiredType);
446
447 std::stringstream defaultValueSs;
448 for (const std::string& s : it.second.defaultValue)
449 {
450 defaultValueSs << '\'' << s << '\'';
451
452 // Add a space if we are not at the last entry
453 if ((void*)&s != (void*)&it.second.defaultValue.back())
454 defaultValueSs << " ";
455 }
456 cached.defaultVal = defaultValueSs.str();
457 }
458
459 // Now generate the documentatino body
460 if (paramInfos.size() > 0)
461 {
462 ss << std::endl
463 << "==== AVAILABLE PARAMETERS ===="
464 << std::endl << std::endl;
465
466 std::size_t counter = 0;
467 for (const auto& it : paramInfos)
468 {
469 const ParamDocEntry& pde = it.second;
470
471 // Put name
472 ss << it.first << " ";
473
474 // Put abbreviation
475 if (pde.abbreviation.length() > 0)
476 ss << pde.abbreviation << " ";
477
478 // Put type
479 if (pde.typeIsForced)
480 ss << pde.type << " ";
481
482 // Put default value
483 if (pde.defaultVal.length() > 0)
484 ss << "default=[" << pde.defaultVal << "] ";
485
486 // Put required tag, but only if no default value
487 if ((pde.required) && (pde.defaultVal.length() == 0))
488 ss << "[[REQUIRED]] ";
489
490 // Put brief description
491 if (pde.description.length() > 0)
492 ss << pde.description;
493
494 // Omit linebreaks when we're on the last element
495 if (counter < paramInfos.size()-1)
496 ss << std::endl << std::endl;
497
498 counter++;
499 }
500 }
501
502 return ss.str();
503 }
504
505 void Hazelnupp::ApplyConstraints()
506 {
507 // Enforce required parameters / default values
508 for (const auto& pc : parameterConstraints)
509 // Parameter in question is not supplied
510 if (!HasParam(pc.second.key))
511 {
512 // Do we have a default value?
513 if (pc.second.defaultValue.size() > 0)
514 {
515 // Then create it now, by its default value
516
517 Value* tmp = ParseValue(pc.second.defaultValue, &pc.second);
518 parameters.insert(std::pair<std::string, Parameter*>(
519 pc.second.key,
520 new Parameter(pc.second.key, tmp)
521 ));
522
523 delete tmp;
524 tmp = nullptr;
525 }
526 // So we do not have a default value...
527 else
528 {
529 // Is it important to have the missing parameter?
530 if (pc.second.required)
531 // Throw an error message then
532 throw HazelnuppConstraintMissingValue(
533 pc.second.key,
534 GetDescription(pc.second.key)
535 );
536 }
537 }
538
539 return;
540 }
541
542 ParamConstraint Hazelnupp::GetConstraint(const std::string& parameter) const
543 {
544 return parameterConstraints.find(parameter)->second;
545 }
546
547 void Hazelnupp::ClearConstraint(const std::string& parameter)
548 {
549 parameterConstraints.erase(parameter);
550 return;
551 }
552
553 const std::string& Hazelnupp::GetExecutableName() const
554 {
555 return executableName;
556 }
557
558 const Value& Hazelnupp::operator[](const std::string& key) const
559 {
560 // Throw exception if param is unknown
561 if (!HasParam(key))
562 throw HazelnuppInvalidKeyException();
563
564 return *parameters.find(key)->second->GetValue();
565 }
566
567 void Hazelnupp::RegisterAbbreviation(const std::string& abbrev, const std::string& target)
568 {
569 parameterAbreviations.insert(std::pair<std::string, std::string>(abbrev, target));
570 return;
571 }
572
573 const std::string& Hazelnupp::GetAbbreviation(const std::string& abbrev) const
574 {
575 if (!HasAbbreviation(abbrev))
576 return Placeholders::g_emptyString;
577
578 return parameterAbreviations.find(abbrev)->second;
579 }
580
581 bool Hazelnupp::HasAbbreviation(const std::string& abbrev) const
582 {
583 return parameterAbreviations.find(abbrev) != parameterAbreviations.end();
584 }
585
586 void Hazelnupp::ClearAbbreviation(const std::string& abbrevation)
587 {
588 parameterAbreviations.erase(abbrevation);
589 return;
590 }
591
592 void Hazelnupp::ClearAbbreviations()
593 {
594 parameterAbreviations.clear();
595 return;
596 }
597
598 void Hazelnupp::RegisterConstraint(const std::string& key, const ParamConstraint& constraint)
599 {
600 // Magic syntax, wooo
601 (parameterConstraints[key] = constraint).key = key;
602 return;
603 }
604
605 void Hazelnupp::ClearConstraints()
606 {
607 parameterConstraints.clear();
608 return;
609 }
610
611 void Hazelnupp::SetCrashOnFail(bool crashOnFail)
612 {
613 this->crashOnFail = crashOnFail;
614 return;
615 }
616
617 const ParamConstraint* Hazelnupp::GetConstraintForKey(const std::string& key) const
618 {
619 const auto constraint = parameterConstraints.find(key);
620
621 if (constraint == parameterConstraints.end())
622 return nullptr;
623
624 return &constraint->second;
625 }
HazelnuppException.h
Hazelnp
Definition: DataType.h:4
Hazelnp::IntValue
Specializations for integer values (uses long long int)
Definition: IntValue.h:8
Hazelnp::StringTools::IsNumeric
static bool IsNumeric(const std::string &str, const bool allowDecimalPoint=false)
Will return true if the given string consists only of digits (including signage)
Definition: StringTools.cpp:56
Hazelnp::StringTools::ParseNumber
static bool ParseNumber(const std::string &str, bool &out_isInt, long double &out_number)
Will convert the number in str to a number.
Definition: StringTools.cpp:82
Hazelnp::Hazelnupp::GetBriefDescription
const std::string & GetBriefDescription()
Returns the brief description of the application to be automatically added to the documentation.
Definition: Hazelnupp.cpp:351
Hazelnp::Hazelnupp::ClearConstraints
void ClearConstraints()
Will delete all constraints.
Definition: Hazelnupp.cpp:605
Hazelnp::HazelnuppInvalidKeyException
Gets thrown when an non-existent key gets dereferenced.
Definition: HazelnuppException.h:29
Hazelnp::Hazelnupp::GetExecutableName
const std::string & GetExecutableName() const
Will return argv[0], the name of the executable.
Definition: Hazelnupp.cpp:553
Hazelnp::Hazelnupp::GenerateDocumentation
std::string GenerateDocumentation() const
Will generate a text-based documentation suited to show the user, for example on –help.
Definition: Hazelnupp.cpp:391
Hazelnp::Hazelnupp::GetConstraint
ParamConstraint GetConstraint(const std::string &parameter) const
Will return the constraint information for a specific parameter.
Definition: Hazelnupp.cpp:542
Hazelnp::Hazelnupp::~Hazelnupp
~Hazelnupp()
Definition: Hazelnupp.cpp:26
Hazelnp::Hazelnupp::operator[]
const Value & operator[](const std::string &key) const
Will return the value given a key.
Definition: Hazelnupp.cpp:558
StringValue.h
Hazelnp::HazelnuppException::What
const std::string & What() const
Will return an error message.
Definition: HazelnuppException.h:18
IntValue.h
Hazelnp::Hazelnupp::Hazelnupp
Hazelnupp()
Definition: Hazelnupp.cpp:15
Placeholders.h
Hazelnp::Hazelnupp::ClearAbbreviations
void ClearAbbreviations()
Will delete all abbreviations.
Definition: Hazelnupp.cpp:592
Hazelnp::DATA_TYPE::VOID
@ VOID
Hazelnp::FloatValue
Specializations for floating point values (uses long double)
Definition: FloatValue.h:9
Hazelnp::ParamConstraint::requiredType
DATA_TYPE requiredType
Constrain the parameter to this value. Requires constrainType to be set to true.
Definition: ParamConstraint.h:51
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:345
Hazelnp::Value
Abstract class for values.
Definition: Value.h:10
Hazelnp::Hazelnupp::GetCrashOnFail
bool GetCrashOnFail() const
Gets whether the application crashes on an exception whilst parsing, and prints to stderr.
Definition: Hazelnupp.cpp:329
Hazelnp::Hazelnupp::HasDescription
bool HasDescription(const std::string &parameter) const
Returns whether or not a given parameter has a registered description.
Definition: Hazelnupp.cpp:373
Hazelnp::Hazelnupp::SetCatchHelp
void SetCatchHelp(bool catchHelp)
Sets whether the Hazelnupp should automatically catch the –help parameter, print the parameter docume...
Definition: Hazelnupp.cpp:334
Hazelnp::Hazelnupp::GetCatchHelp
bool GetCatchHelp() const
Retruns whether the Hazelnupp should automatically catch the –help parameter, print the parameter doc...
Definition: Hazelnupp.cpp:340
Hazelnp::DATA_TYPE::LIST
@ LIST
Hazelnp::Parameter
Definition: Parameter.h:8
Hazelnp::ParamConstraint
Definition: ParamConstraint.h:8
Hazelnp::Placeholders::g_emptyString
static const std::string g_emptyString
The only purpose of this is to provide the ability to return an empty string as an error for std::str...
Definition: Placeholders.h:9
Hazelnp::Hazelnupp::HasParam
bool HasParam(const std::string &key) const
Will check wether a parameter exists given a key, or not.
Definition: Hazelnupp.cpp:165
Hazelnp::Hazelnupp::Parse
void Parse(const int argc, const char *const *argv)
Will parse command line arguments.
Definition: Hazelnupp.cpp:36
ListValue.h
Hazelnp::ParamConstraint::constrainType
bool constrainType
Should this parameter be forced to be of a certain type? Remember to set constrainTo to the wanted ...
Definition: ParamConstraint.h:48
Hazelnp::Hazelnupp::ClearDescription
void ClearDescription(const std::string &parameter)
Will delete the description of a parameter if it exists.
Definition: Hazelnupp.cpp:378
Hazelnp::Parameter::Key
const std::string & Key() const
Will return the key of this parameter.
Definition: Parameter.cpp:21
Hazelnp::HazelnuppConstraintMissingValue
Gets thrown when a parameter constrained to be required is not provided, and has no default value set...
Definition: HazelnuppException.h:80
Hazelnp::Hazelnupp::RegisterAbbreviation
void RegisterAbbreviation(const std::string &abbrev, const std::string &target)
Will register an abbreviation (like -f for –force)
Definition: Hazelnupp.cpp:567
Hazelnp::HazelnuppConstraintTypeMissmatch
Gets thrown when a parameter is of a type that does not match the required type, and is not convertib...
Definition: HazelnuppException.h:56
VoidValue.h
Hazelnp::Hazelnupp::GetAbbreviation
const std::string & GetAbbreviation(const std::string &abbrev) const
Will return the long form of an abbreviation (like –force for -f) Returns "" if no match is found.
Definition: Hazelnupp.cpp:573
Hazelnp::Hazelnupp::ClearDescriptions
void ClearDescriptions()
Will delete all parameter descriptions.
Definition: Hazelnupp.cpp:385
Hazelnupp.h
Hazelnp::ListValue::AddValue
void AddValue(const Value *value)
Will add this value to the list.
Definition: ListValue.cpp:33
Hazelnp::Hazelnupp::RegisterConstraint
void RegisterConstraint(const std::string &key, const ParamConstraint &constraint)
Will register a constraint for a parameter.
Definition: Hazelnupp.cpp:598
Hazelnp::VoidValue
Specializations for void values.
Definition: VoidValue.h:8
Hazelnp::Hazelnupp::GetDescription
const std::string & GetDescription(const std::string &parameter) const
Will return a short description for a parameter, if it exists.
Definition: Hazelnupp.cpp:362
Hazelnp::DATA_TYPE::FLOAT
@ FLOAT
Hazelnp::DATA_TYPE::INT
@ INT
Hazelnp::Hazelnupp::ClearConstraint
void ClearConstraint(const std::string &parameter)
Will the constraint of a specific parameter.
Definition: Hazelnupp.cpp:547
FloatValue.h
Hazelnp::DATA_TYPE
DATA_TYPE
The different data types a paramater can be.
Definition: DataType.h:8
Hazelnp::Hazelnupp::HasAbbreviation
bool HasAbbreviation(const std::string &abbrev) const
Will check wether or not an abbreviation is registered.
Definition: Hazelnupp.cpp:581
Hazelnp::DATA_TYPE::STRING
@ STRING
Hazelnp::Hazelnupp::SetCrashOnFail
void SetCrashOnFail(bool crashOnFail)
Sets whether to crash the application, and print to stderr, when an exception is raised whilst parsin...
Definition: Hazelnupp.cpp:611
Hazelnp::Hazelnupp::RegisterDescription
void RegisterDescription(const std::string &parameter, const std::string &description)
Willl register a short description for a parameter.
Definition: Hazelnupp.cpp:356
Hazelnp::DataTypeToString
static std::string DataTypeToString(DATA_TYPE type)
Definition: DataType.h:17
Hazelnp::Hazelnupp::ClearAbbreviation
void ClearAbbreviation(const std::string &abbrevation)
Will delete the abbreviation for a given parameter.
Definition: Hazelnupp.cpp:586
Hazelnp::ListValue
Specializations for list values (uses std::vector<Value*>)
Definition: ListValue.h:9
Hazelnp::StringValue
Specializations for string values (uses std::string)
Definition: StringValue.h:9
StringTools.h