diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-11 18:12:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-06-11 18:12:09 +0200 |
commit | c552070230c4ad9c92b516c28658b5c74c57e46b (patch) | |
tree | bc78a4c9c5c9bfb21539e3e65f713a7f0daa766b /bpkg/manifest-parser | |
parent | 294f8e8d3abebaaa976c7d21248a1a205c869b02 (diff) |
Outline of parsing and serialization for manifest object model
Diffstat (limited to 'bpkg/manifest-parser')
-rw-r--r-- | bpkg/manifest-parser | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/bpkg/manifest-parser b/bpkg/manifest-parser index 070cb77..6dc3ee3 100644 --- a/bpkg/manifest-parser +++ b/bpkg/manifest-parser @@ -26,6 +26,22 @@ namespace bpkg std::string description; }; + class manifest_name_value + { + public: + std::string name; + std::string value; + + std::uint64_t name_line; + std::uint64_t name_column; + + std::uint64_t value_line; + std::uint64_t value_column; + + bool + empty () const {return name.empty () && value.empty ();} + }; + class manifest_parser { public: @@ -35,22 +51,6 @@ namespace bpkg const std::string& name () const {return name_;} - class name_value_type - { - public: - std::string name; - std::string value; - - std::uint64_t name_line; - std::uint64_t name_column; - - std::uint64_t value_line; - std::uint64_t value_column; - - bool - empty () const {return name.empty () && value.empty ();} - }; - // The first returned pair is special "start-of-manifest" with // empty name and value being the format version: {"", "<ver>"}. // After that we have a sequence of ordinary pairs which are @@ -64,7 +64,7 @@ namespace bpkg // // ({"", "<ver>"} {"<name>", "<value>"}* {"", ""})* {"", ""} // - name_value_type + manifest_name_value next (); private: @@ -94,10 +94,10 @@ namespace bpkg private: void - parse_name (name_value_type&); + parse_name (manifest_name_value&); void - parse_value (name_value_type&); + parse_value (manifest_name_value&); // Skip spaces and return the first peeked non-space character. // |