aboutsummaryrefslogtreecommitdiff
path: root/butl/tab-parser
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-05-01 16:08:43 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-05-01 16:59:24 +0300
commit61377c582e0f2675baa5f5e6e30a35d1a4164b33 (patch)
tree11cdca992834d7f7f197f72856712fbcb3020e3d /butl/tab-parser
parent442c1a6790e52baa0c081f310d4d9e9b6f1ff638 (diff)
Add hxx extension for headers and lib prefix for library dir
Diffstat (limited to 'butl/tab-parser')
-rw-r--r--butl/tab-parser72
1 files changed, 0 insertions, 72 deletions
diff --git a/butl/tab-parser b/butl/tab-parser
deleted file mode 100644
index f140b71..0000000
--- a/butl/tab-parser
+++ /dev/null
@@ -1,72 +0,0 @@
-// file : butl/tab-parser -*- C++ -*-
-// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#ifndef BUTL_TAB_PARSER
-#define BUTL_TAB_PARSER
-
-#include <string>
-#include <vector>
-#include <istream>
-#include <cstdint> // uint64_t
-#include <stdexcept> // runtime_error
-
-#include <butl/export>
-
-namespace butl
-{
- class LIBBUTL_EXPORT tab_parsing: public std::runtime_error
- {
- public:
- tab_parsing (const std::string& name,
- std::uint64_t line,
- std::uint64_t column,
- const std::string& description);
-
- std::string name;
- std::uint64_t line;
- std::uint64_t column;
- std::string description;
- };
-
- // Line and columns are useful for issuing diagnostics about invalid or
- // missing fields.
- //
- struct tab_field
- {
- std::string value; // Field string (quoting preserved).
- std::uint64_t column; // Field start column number (one-based).
- };
-
- struct tab_fields: std::vector<tab_field>
- {
- std::uint64_t line; // Line number (one-based).
- std::uint64_t end_column; // End-of-line column (line length).
- };
-
- // Read and parse lines consisting of space-separated fields. Field can
- // contain single or double quoted substrings (with spaces) which are
- // interpreted but preserved. No escaping of the quote characters is
- // supported. Blank lines and lines that start with # (collectively called
- // empty lines) are ignored.
- //
- class LIBBUTL_EXPORT tab_parser
- {
- public:
- tab_parser (std::istream& is, const std::string& name)
- : is_ (is), name_ (name) {}
-
- // Return next line of fields. Skip empty lines. Empty result denotes the
- // end of stream.
- //
- tab_fields
- next ();
-
- private:
- std::istream& is_;
- const std::string name_;
- std::uint64_t line_ = 0;
- };
-}
-
-#endif // BUTL_TAB_PARSER