From 3d44d607c8c9884a02ac888bbcd9824886d7d292 Mon Sep 17 00:00:00 2001 From: "Marcel M. Otte" Date: Sun, 4 Oct 2015 14:42:45 +0200 Subject: [PATCH] started working on cpp14 variant for fun --- cpp/.cproject | 65 +++++++++++++++++++++++++++++++++++++ cpp/.project | 27 +++++++++++++++ cpp/CMakeLists.txt | 6 ++++ cpp/CmdLineOptions.cpp | 15 +++++++++ cpp/CmdLineOptions.h | 56 ++++++++++++++++++++++++++++++++ cpp/CmdLineOptions_test.cpp | 12 +++++++ 6 files changed, 181 insertions(+) create mode 100644 cpp/.cproject create mode 100644 cpp/.project create mode 100644 cpp/CMakeLists.txt create mode 100644 cpp/CmdLineOptions.cpp create mode 100644 cpp/CmdLineOptions.h create mode 100644 cpp/CmdLineOptions_test.cpp diff --git a/cpp/.cproject b/cpp/.cproject new file mode 100644 index 0000000..b92e101 --- /dev/null +++ b/cpp/.cproject @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cpp/.project b/cpp/.project new file mode 100644 index 0000000..a229865 --- /dev/null +++ b/cpp/.project @@ -0,0 +1,27 @@ + + + cmdlineoptions-cpp14 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt new file mode 100644 index 0000000..bbc536e --- /dev/null +++ b/cpp/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 2.6) +project(CmdLineOptions) + +set(CMAKE_CXX_FLAGS "--std=c++14 -g -Wall") +add_library(CmdLineOptions_static STATIC CmdLineOptions.cpp) +add_library(CmdLineOptions SHARED CmdLineOptions.cpp) diff --git a/cpp/CmdLineOptions.cpp b/cpp/CmdLineOptions.cpp new file mode 100644 index 0000000..5deb192 --- /dev/null +++ b/cpp/CmdLineOptions.cpp @@ -0,0 +1,15 @@ +/* + * cmdlineoptions.cpp + * + * Created on: 04. Okt. 2015 + * Author: qwc + */ + +#include "CmdLineOptions.h" + +namespace cmdlineoptions { + +CmdLineOptions::~CmdLineOptions() {} +CmdLineOptions::CmdLineOptions() {} + +} /* namespace cmdlineoptions */ diff --git a/cpp/CmdLineOptions.h b/cpp/CmdLineOptions.h new file mode 100644 index 0000000..a9d5379 --- /dev/null +++ b/cpp/CmdLineOptions.h @@ -0,0 +1,56 @@ +/* + * cmdlineoptions.h + * + * Created on: 04. Okt. 2015 + * Author: qwc + */ + +#ifndef CMDLINEOPTIONS_H_ +#define CMDLINEOPTIONS_H_ +#include +#include +#include + +namespace cmdlineoptions { + +// using namespace std; + +class CmdLineOptions; + +class Option { +private: + // important information + std::string name; + std::string description; + bool set; + // lists + std::unique_ptr> options; + std::unique_ptr> possibleParameters; + std::unique_ptr> defaultParameters; + std::unique_ptr> values; + +public: + Option(); + Option(std::string name); + virtual ~Option(); + + void setName(std::string name); + +}; + +class CmdLineOptions { + +public: + virtual ~CmdLineOptions(); + static std::unique_ptr i(); + std::shared_ptr