From 3c6ea25bcfafc513560c9e8a4baaf211bec2750c Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Sat, 11 Jun 2016 22:39:24 +0300 Subject: kms++util: split to subdirs --- kms++util/opts.cpp | 117 ----------------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 kms++util/opts.cpp (limited to 'kms++util/opts.cpp') diff --git a/kms++util/opts.cpp b/kms++util/opts.cpp deleted file mode 100644 index 4ea31f8..0000000 --- a/kms++util/opts.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include - -#include -#include - -#include "opts.h" - -using namespace std; - -Option::Option(const string& str, function func) - : m_void_func(func) -{ - parse(str); -} - -Option::Option(const string& str, function func) - : m_func(func) -{ - parse(str); -} - -void Option::parse(const string& str) -{ - auto iend = str.end(); - if (*(iend - 1) == '=') { - iend--; - m_has_arg = 1; - } else if (*(iend - 1) == '?') { - iend--; - m_has_arg = 2; - } else { - m_has_arg = 0; - } - - auto isplit = find(str.begin(), iend, '|'); - - if (isplit != str.begin()) - m_short = str[0]; - else - m_short = 0; - - if (isplit != iend) - m_long = string(isplit + 1, iend); -} - -OptionSet::OptionSet(initializer_list