-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Pre-release test for v2 - 17:47 Saturday, March 6, 2024 Universal…
… Time Coordinated
- Loading branch information
1 parent
58e78ba
commit 2455528
Showing
22 changed files
with
612 additions
and
915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
#include "pch.h" | ||
#include "ArgumentParser.h" | ||
ArgumentParser::ArgumentParser(int& argc, const char** argv, int start) | ||
{ | ||
this->tokens = std::vector<std::string>(argv + start, argv + argc); | ||
} | ||
bool ArgumentParser::optionExists(const std::string& option) const | ||
{ | ||
return (std::find(this->tokens.begin(), this->tokens.end(), option) != this->tokens.end()); | ||
} | ||
bool ArgumentParser::optionsExist(const std::vector<std::string>& options) const | ||
{ | ||
for (std::vector<std::string>::const_iterator iter = options.begin(); iter < options.end(); iter++) | ||
{ | ||
if (this->optionExists(*iter)) return true; | ||
} | ||
return false; | ||
} | ||
const std::string& ArgumentParser::getOption(const std::string& option) const | ||
{ | ||
std::vector<std::string>::const_iterator iterator; | ||
iterator = std::find(this->tokens.begin(), this->tokens.end(), option); | ||
if ((iterator != this->tokens.end()) && (++iterator != this->tokens.end())) | ||
{ | ||
return *iterator; | ||
} | ||
static const std::string empty(""); | ||
return empty; | ||
} | ||
const std::string& ArgumentParser::getOptions(const std::vector<std::string>& options) const | ||
{ | ||
for (std::vector<std::string>::const_iterator iter = options.begin(); iter < options.end(); iter++) | ||
{ | ||
const std::string &arg = this->getOption(*iter); | ||
if (!arg.empty()) return arg; | ||
} | ||
static const std::string empty(""); | ||
return empty; | ||
#include "pch.h" | ||
#include "ArgumentParser.h" | ||
ArgumentParser::ArgumentParser(int& argc, const char** argv, int start) | ||
{ | ||
this->tokens = std::vector<std::string>(argv + start, argv + argc); | ||
} | ||
bool ArgumentParser::optionExists(const std::string& option) const | ||
{ | ||
return (std::find(this->tokens.begin(), this->tokens.end(), option) != this->tokens.end()); | ||
} | ||
bool ArgumentParser::optionsExist(const std::vector<std::string>& options) const | ||
{ | ||
for (std::vector<std::string>::const_iterator iter = options.begin(); iter < options.end(); iter++) | ||
{ | ||
if (this->optionExists(*iter)) return true; | ||
} | ||
return false; | ||
} | ||
const std::string& ArgumentParser::getOption(const std::string& option) const | ||
{ | ||
std::vector<std::string>::const_iterator iterator; | ||
iterator = std::find(this->tokens.begin(), this->tokens.end(), option); | ||
if ((iterator != this->tokens.end()) && (++iterator != this->tokens.end())) | ||
{ | ||
return *iterator; | ||
} | ||
static const std::string empty(""); | ||
return empty; | ||
} | ||
const std::string& ArgumentParser::getOptions(const std::vector<std::string>& options) const | ||
{ | ||
for (std::vector<std::string>::const_iterator iter = options.begin(); iter < options.end(); iter++) | ||
{ | ||
const std::string &arg = this->getOption(*iter); | ||
if (!arg.empty()) return arg; | ||
} | ||
static const std::string empty(""); | ||
return empty; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#pragma once | ||
class ArgumentParser | ||
{ | ||
private: | ||
std::vector<std::string> tokens; | ||
public: | ||
ArgumentParser(int& argc, const char** argv, int start); | ||
bool optionExists(const std::string& option) const; | ||
bool optionsExist(const std::vector<std::string>& options) const; | ||
const std::string& getOption(const std::string& option) const; | ||
const std::string& getOptions(const std::vector<std::string>& options) const; | ||
}; | ||
|
||
#pragma once | ||
class ArgumentParser | ||
{ | ||
private: | ||
std::vector<std::string> tokens; | ||
public: | ||
ArgumentParser(int& argc, const char** argv, int start); | ||
bool optionExists(const std::string& option) const; | ||
bool optionsExist(const std::vector<std::string>& options) const; | ||
const std::string& getOption(const std::string& option) const; | ||
const std::string& getOptions(const std::vector<std::string>& options) const; | ||
}; | ||
|
Oops, something went wrong.