# HG changeset patch # User František Kučera # Date 1534069959 -7200 # Node ID b498c00cc32fcabede81e4a4f3abe43aff76db9e # Parent 00d1dd4f816adac3e3c06102e8d7fb84034f9056 move header file to include/relpipe/cli/ diff -r 00d1dd4f816a -r b498c00cc32f CLI.cpp --- a/CLI.cpp Sun Aug 12 12:26:16 2018 +0200 +++ b/CLI.cpp Sun Aug 12 12:32:39 2018 +0200 @@ -4,4 +4,4 @@ * Compilation just validates that the .h file has no severe bugs. * In future, the binary might contain some code for testing purposes. */ -#include "CLI.h" +#include "include/relpipe/cli/CLI.h" diff -r 00d1dd4f816a -r b498c00cc32f CLI.h --- a/CLI.h Sun Aug 12 12:26:16 2018 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include - -using namespace std; - -namespace relpipe { -namespace cli { - -/** - * TODO: move to relpipe-lib-cli (a common header-only library) - */ -class CLI { -public: - - CLI(int argc, char* argv[]) { - setlocale(LC_ALL, ""); - - this->argc = &argc; - this->argv = &argv; - - program = convertor.from_bytes(argv[0]); - - for (int i = 1; i < argc; i++) { - args.insert(args.end(), convertor.from_bytes(argv[i])); - } - - } - - CLI(const CLI& orig) { - } - - virtual ~CLI() { - } - - const wstring programName() { - return (const wstring) program; - } - - const vector arguments() { - return (const vector)args; - } - - static const int EXIT_CODE_SUCCESS = 0; - static const int EXIT_CODE_UNEXPECTED_ERROR = 1; - static const int EXIT_CODE_BAD_SYNTAX = 3; - static const int EXIT_CODE_UNKNOWN_COMMAND = 4; - static const int EXIT_CODE_DATA_ERROR = 5; - -private: - int* argc; - char*** argv; - wstring program; - vector args; - wstring_convert> convertor; // TODO: support also other encodings. -}; - -} -} diff -r 00d1dd4f816a -r b498c00cc32f include/relpipe/cli/CLI.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/relpipe/cli/CLI.h Sun Aug 12 12:32:39 2018 +0200 @@ -0,0 +1,64 @@ +#pragma once + +#include +#include +#include +#include +#include +#include + +using namespace std; + +namespace relpipe { +namespace cli { + +/** + * TODO: move to relpipe-lib-cli (a common header-only library) + */ +class CLI { +public: + + CLI(int argc, char* argv[]) { + setlocale(LC_ALL, ""); + + this->argc = &argc; + this->argv = &argv; + + program = convertor.from_bytes(argv[0]); + + for (int i = 1; i < argc; i++) { + args.insert(args.end(), convertor.from_bytes(argv[i])); + } + + } + + CLI(const CLI& orig) { + } + + virtual ~CLI() { + } + + const wstring programName() { + return (const wstring) program; + } + + const vector arguments() { + return (const vector)args; + } + + static const int EXIT_CODE_SUCCESS = 0; + static const int EXIT_CODE_UNEXPECTED_ERROR = 1; + static const int EXIT_CODE_BAD_SYNTAX = 3; + static const int EXIT_CODE_UNKNOWN_COMMAND = 4; + static const int EXIT_CODE_DATA_ERROR = 5; + +private: + int* argc; + char*** argv; + wstring program; + vector args; + wstring_convert> convertor; // TODO: support also other encodings. +}; + +} +} diff -r 00d1dd4f816a -r b498c00cc32f nbproject/configurations.xml --- a/nbproject/configurations.xml Sun Aug 12 12:26:16 2018 +0200 +++ b/nbproject/configurations.xml Sun Aug 12 12:32:39 2018 +0200 @@ -4,7 +4,7 @@ - CLI.h + include/relpipe/cli/CLI.h - + @@ -64,7 +64,7 @@ - +