/* options.hpp: parses arguments from the commandline.
*
* Copyright (C) 2014: Dalton Nell, Slop Contributors (https://github.com/naelstrof/slop/graphs/contributors).
*
* This file is part of Slop.
*
* Slop is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Slop is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Slop. If not, see .
*/
#ifndef N_OPTIONS_H_
#define N_OPTIONS_H_
#include
#include
#include
#include
#include
#include
class Argument {
public:
std::string name;
char cname;
bool isFlagArgument;
Argument( std::string name, char cname, bool isFlagArgument ) : name(name), cname(cname), isFlagArgument(isFlagArgument) {}
};
static std::vector validArguments;
static unsigned int maxFloatingValues = 0;
class Options {
private:
std::vector arguments;
std::vector values;
std::vector floatingValues;
int parseCharOption( int argc, char** argv, int argumentIndex, int validIndex );
int parseStringOption( int argc, char** argv, int argumentIndex, int validIndex );
int validateStringOption( int argc, char** argv, int argumentIndex );
int validateCharOption( int argc, char** argv, int argumentIndex );
void validate( int argc, char** argv );
public:
Options( int argc, char** argv );
bool getFloat( std::string name, char namec, float& found );
bool getInt( std::string name, char namec, int& found );
bool getString( std::string name, char namec, std::string& found );
bool getColor( std::string name, char namec, glm::vec4& found );
bool getBool( std::string name, char namec, bool& found );
};
#endif // N_OPTIONS_H_