aboutsummaryrefslogtreecommitdiff
path: root/libbutl/tab-parser.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-09-22 23:32:28 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-09-22 23:32:28 +0200
commitc09cd7512491cee1e82c1ad8128ce9fd4bc3f79b (patch)
treea659ed768d849130ab5780a11b7f791a463a1a91 /libbutl/tab-parser.hxx
parent2a00871f07067f8f9e2de08bb9c8f50e1bf6a650 (diff)
Initial modularization with both Clang and VC hacks
Note: gave up on VC about half way though.
Diffstat (limited to 'libbutl/tab-parser.hxx')
-rw-r--r--libbutl/tab-parser.hxx72
1 files changed, 0 insertions, 72 deletions
diff --git a/libbutl/tab-parser.hxx b/libbutl/tab-parser.hxx
deleted file mode 100644
index 688dedc..0000000
--- a/libbutl/tab-parser.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-// file : libbutl/tab-parser.hxx -*- C++ -*-
-// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
-// license : MIT; see accompanying LICENSE file
-
-#ifndef LIBBUTL_TAB_PARSER_HXX
-#define LIBBUTL_TAB_PARSER_HXX
-
-#include <string>
-#include <vector>
-#include <istream>
-#include <cstdint> // uint64_t
-#include <stdexcept> // runtime_error
-
-#include <libbutl/export.hxx>
-
-namespace butl
-{
- class LIBBUTL_SYMEXPORT 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_SYMEXPORT 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 // LIBBUTL_TAB_PARSER_HXX