Rename all headers from .h++ to .hpp
Idk why I did that in the first place. Probably bc hpp looks stupid. But having a + in a file name bugs me just as much. And other ppl as well. So I changed it.BodgeMaster-unfinished
parent
b59fe1857e
commit
5c73308934
|
@ -13,13 +13,12 @@
|
||||||
// version 3 along with this program.
|
// version 3 along with this program.
|
||||||
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
#include "cli.h++"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "error.h++"
|
#include "cli.hpp"
|
||||||
|
#include "error.hpp"
|
||||||
|
|
||||||
namespace CLI {
|
namespace CLI {
|
||||||
Flag::Flag() {
|
Flag::Flag() {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "error.h++"
|
#include "error.hpp"
|
||||||
|
|
||||||
namespace CLI {
|
namespace CLI {
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
// Copyright 2022, FOSS-VG Developers and Contributers
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify it
|
||||||
|
// under the terms of the GNU Affero General Public License as published
|
||||||
|
// by the Free Software Foundation, version 3.
|
||||||
|
//
|
||||||
|
// This program 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 Affero General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Affero General Public License
|
||||||
|
// version 3 along with this program.
|
||||||
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include "error.hpp"
|
||||||
|
|
||||||
|
namespace CLI {
|
||||||
|
|
||||||
|
struct Flag {
|
||||||
|
char shortName;
|
||||||
|
std::string longName;
|
||||||
|
// used for automatic usage generation
|
||||||
|
std::string description;
|
||||||
|
|
||||||
|
bool present;
|
||||||
|
|
||||||
|
Flag();
|
||||||
|
Flag(char shortName, std::string longName, std::string description);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Option {
|
||||||
|
char shortName;
|
||||||
|
std::string longName;
|
||||||
|
// used for automatic usage generation
|
||||||
|
std::string description;
|
||||||
|
std::string placeholder; // the "COUNT" in "ping [-c <COUNT>] <HOST>"
|
||||||
|
|
||||||
|
bool present;
|
||||||
|
std::string value;
|
||||||
|
|
||||||
|
Option();
|
||||||
|
Option(char shortName, std::string longName, std::string placeholder, std::string description);
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Argument {
|
||||||
|
// used for automatic usage generation
|
||||||
|
std::string description;
|
||||||
|
std::string placeholder; // the "HOST" in "ping [-c <COUNT>] <HOST>"
|
||||||
|
|
||||||
|
bool present;
|
||||||
|
std::string value;
|
||||||
|
|
||||||
|
Argument();
|
||||||
|
Argument(std::string placeholder, std::string description);
|
||||||
|
};
|
||||||
|
|
||||||
|
class ArgumentsParser {
|
||||||
|
private:
|
||||||
|
std::map<char, Flag*> flagsByShortName;
|
||||||
|
std::map<std::string, Flag*> flagsByLongName;
|
||||||
|
std::map<char, Option*> optionsByShortName;
|
||||||
|
std::map<std::string, Option*> optionsByLongName;
|
||||||
|
std::vector<Argument> arguments;
|
||||||
|
std::string description;
|
||||||
|
std::string additionalInfo;
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::string programName;
|
||||||
|
bool wrongUsage;
|
||||||
|
std::vector<std::string> wrongUsageMessages;
|
||||||
|
|
||||||
|
// using int here bc that's how main() is defined
|
||||||
|
ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<Option> options, std::vector<Argument> arguments);
|
||||||
|
ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<Option> options, std::vector<Argument> arguments, std::string description);
|
||||||
|
ArgumentsParser(int argc, const char* const argv[], std::vector<Flag> flags, std::vector<Option> options, std::vector<Argument> arguments, std::string description, std::string additionalInfo);
|
||||||
|
~ArgumentsParser();
|
||||||
|
|
||||||
|
ErrorOr<bool> getFlag(char shortName);
|
||||||
|
ErrorOr<bool> getFlag(std::string longName);
|
||||||
|
ErrorOr<std::string> getArgument(std::vector<CLI::Argument>::size_type position);
|
||||||
|
ErrorOr<std::string> getOption(char shortName);
|
||||||
|
ErrorOr<std::string> getOption(std::string longName);
|
||||||
|
|
||||||
|
std::string getUsage();
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -15,8 +15,8 @@
|
||||||
|
|
||||||
#include <tinyutf8/tinyutf8.h>
|
#include <tinyutf8/tinyutf8.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "error.h++"
|
#include "error.hpp"
|
||||||
#include "javacompat.h++"
|
#include "javacompat.hpp"
|
||||||
#include "../../.endianness"
|
#include "../../.endianness"
|
||||||
|
|
||||||
#ifdef FOSSVG_ENDIAN_BIG_WORD
|
#ifdef FOSSVG_ENDIAN_BIG_WORD
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
//version 3 along with this program.
|
//version 3 along with this program.
|
||||||
//If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
//If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
#include <tinyutf8/tinyutf8.h>
|
|
||||||
#include "error.h++"
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <tinyutf8/tinyutf8.h>
|
||||||
|
#include "error.hpp"
|
||||||
|
|
||||||
namespace JavaCompat {
|
namespace JavaCompat {
|
||||||
ErrorOr<tiny_utf8::string> importJavaString(uint8_t data[], uint16_t size);
|
ErrorOr<tiny_utf8::string> importJavaString(uint8_t data[], uint16_t size);
|
|
@ -19,9 +19,9 @@
|
||||||
#include <tinyutf8/tinyutf8.h>
|
#include <tinyutf8/tinyutf8.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "nbt.h++"
|
#include "nbt.hpp"
|
||||||
#include "error.h++"
|
#include "error.hpp"
|
||||||
#include "javacompat.h++"
|
#include "javacompat.hpp"
|
||||||
|
|
||||||
|
|
||||||
#include "../../.endianness"
|
#include "../../.endianness"
|
||||||
|
@ -156,7 +156,7 @@ namespace NBT {
|
||||||
if(dataSize > 0xFFFF){
|
if(dataSize > 0xFFFF){
|
||||||
return ErrorOr<tiny_utf8::string>(true, ErrorCodes::OVERRUN);
|
return ErrorOr<tiny_utf8::string>(true, ErrorCodes::OVERRUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<tiny_utf8::string> output = JavaCompat::importJavaString(data+currentPosition, (uint16_t) dataSize);
|
ErrorOr<tiny_utf8::string> output = JavaCompat::importJavaString(data+currentPosition, (uint16_t) dataSize);
|
||||||
if(output.isError){
|
if(output.isError){
|
||||||
return ErrorOr<tiny_utf8::string>(true, output.errorCode);
|
return ErrorOr<tiny_utf8::string>(true, output.errorCode);
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "error.h++"
|
|
||||||
#include <tinyutf8/tinyutf8.h>
|
#include <tinyutf8/tinyutf8.h>
|
||||||
|
#include "error.hpp"
|
||||||
|
|
||||||
namespace NBT {
|
namespace NBT {
|
||||||
namespace helper {
|
namespace helper {
|
|
@ -16,10 +16,10 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "assert.h++"
|
#include "assert.hpp"
|
||||||
#include "../lib/error.h++"
|
#include "../lib/error.hpp"
|
||||||
|
|
||||||
#include "../lib/cli.h++"
|
#include "../lib/cli.hpp"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout << "################################################################################" << std::endl;
|
std::cout << "################################################################################" << std::endl;
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
// version 3 along with this program.
|
// version 3 along with this program.
|
||||||
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
#include "assert.h++"
|
|
||||||
#include "../lib/javacompat.h++"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <tinyutf8/tinyutf8.h>
|
#include <tinyutf8/tinyutf8.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "assert.hpp"
|
||||||
|
#include "../lib/javacompat.hpp"
|
||||||
|
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
|
|
|
@ -18,11 +18,11 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "assert.h++"
|
#include "assert.hpp"
|
||||||
|
|
||||||
#include "../lib/nbt.h++"
|
#include "../lib/nbt.hpp"
|
||||||
#include "../lib/error.h++"
|
#include "../lib/error.hpp"
|
||||||
#include "../lib/javacompat.h++"
|
#include "../lib/javacompat.hpp"
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
std::cout << "################################################################################" << std::endl;
|
std::cout << "################################################################################" << std::endl;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "../lib/nbt.h++"
|
#include "../lib/nbt.hpp"
|
||||||
#include "../lib/error.h++"
|
#include "../lib/error.hpp"
|
||||||
#include "../lib/javacompat.h++"
|
#include "../lib/javacompat.hpp"
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
std::cout << "================================================================================" << std::endl;
|
std::cout << "================================================================================" << std::endl;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// version 3 along with this program.
|
// version 3 along with this program.
|
||||||
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
// If not, see https://www.gnu.org/licenses/agpl-3.0.en.html
|
||||||
|
|
||||||
#include "../lib/nbt.h++"
|
#include "../lib/nbt.hpp"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
|
|
||||||
#include "../lib/error.h++"
|
#include "../lib/error.hpp"
|
||||||
#include "../lib/cli.h++"
|
#include "../lib/cli.hpp"
|
||||||
|
|
||||||
#define EXIT_SUCCESS 0
|
#define EXIT_SUCCESS 0
|
||||||
#define EXIT_RUNTIME 1
|
#define EXIT_RUNTIME 1
|
||||||
|
|
Loading…
Reference in New Issue