aboutsummaryrefslogtreecommitdiff
path: root/clean/types-parsers.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-10-28 01:01:53 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-10-30 16:20:21 +0300
commit873987793b05fc0d6e9908f5030b2bca145c4e6d (patch)
tree6641e447d892e5b364ae7471e7a0a71581c85e91 /clean/types-parsers.cxx
parent018603c5529117b993066f4f3a0f45f48f92e801 (diff)
Add tenant object
Diffstat (limited to 'clean/types-parsers.cxx')
-rw-r--r--clean/types-parsers.cxx60
1 files changed, 0 insertions, 60 deletions
diff --git a/clean/types-parsers.cxx b/clean/types-parsers.cxx
deleted file mode 100644
index 31f3a8d..0000000
--- a/clean/types-parsers.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-// file : clean/types-parsers.cxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#include <chrono>
-#include <string> // strtoull()
-
-#include <clean/types-parsers.hxx>
-
-#include <clean/options-types.hxx>
-#include <clean/clean-options.hxx> // cli namespace
-
-using namespace std;
-using namespace brep;
-
-namespace cli
-{
- void parser<toolchain_timeouts>::
- parse (toolchain_timeouts& x, bool& xs, scanner& s)
- {
- const char* o (s.next ());
-
- if (!s.more ())
- throw missing_value (o);
-
- string ov (s.next ());
- size_t p (ov.find ('='));
-
- timestamp now (system_clock::now ());
-
- // Convert timeout duration into the time point.
- //
- auto timeout = [o, &ov, &now] (const string& tm) -> timestamp
- {
- char* e (nullptr);
- uint64_t t (strtoull (tm.c_str (), &e, 10));
-
- if (*e != '\0' || tm.empty ())
- throw invalid_value (o, ov);
-
- if (t == 0)
- return timestamp_nonexistent;
-
- return now - chrono::duration<uint64_t, ratio<86400>> (t);
- };
-
- if (p == string::npos)
- x[string ()] = timeout (ov); // Default timeout.
- else
- {
- string k (ov, 0, p);
- if (k.empty ())
- throw invalid_value (o, ov);
-
- x[k] = timeout (string (ov, p + 1));
- }
-
- xs = true;
- }
-}