From 046c4d8017a2c709f506816d4f73d734ccbeaef7 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 10 Mar 2016 11:37:08 +0300 Subject: Replace description and change classes with text_file class --- bpkg/manifest | 67 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 30 deletions(-) (limited to 'bpkg/manifest') diff --git a/bpkg/manifest b/bpkg/manifest index 29ba6fe..a6eeb05 100644 --- a/bpkg/manifest +++ b/bpkg/manifest @@ -170,23 +170,40 @@ namespace bpkg // description // description-file + // change + // change-file // - class description: public std::string + class text_file { public: + using path_type = butl::path; + bool file; + + union + { + std::string text; + path_type path; + }; + std::string comment; - // Description constructor. + // File text constructor. // explicit - description (std::string d = "") - : std::string (std::move (d)), file (false) {} + text_file (std::string t = ""): file (false), text (std::move (t)) {} - // Description file constructor. + // File reference constructor. // - description (std::string f, std::string c) - : std::string (std::move (f)), file (true), comment (std::move (c)) {} + text_file (path_type p, std::string c) + : file (true), path (std::move (p)), comment (std::move (c)) {} + + text_file (text_file&&); + text_file (const text_file&); + text_file& operator= (text_file&&); + text_file& operator= (const text_file&); + + ~text_file (); }; // license @@ -200,26 +217,6 @@ namespace bpkg licenses (std::string c = ""): comment (std::move (c)) {} }; - // change - // change-file - // - class change: public std::string - { - public: - bool file; - std::string comment; - - // Change constructor. - // - explicit - change (std::string c = ""): std::string (std::move (c)), file (false) {} - - // Change file constructor. - // - change (std::string f, std::string c) - : std::string (std::move (f)), file (true), comment (std::move (c)) {} - }; - // url // package-url // @@ -326,7 +323,6 @@ namespace bpkg using priority_type = bpkg::priority; using url_type = bpkg::url; using email_type = bpkg::email; - using description_type = bpkg::description; std::string name; version_type version; @@ -334,8 +330,8 @@ namespace bpkg std::string summary; std::vector license_alternatives; strings tags; - butl::optional description; - std::vector changes; + butl::optional description; + std::vector changes; url_type url; butl::optional package_url; email_type email; @@ -349,13 +345,24 @@ namespace bpkg butl::optional sha256sum; public: + // Create individual package manifest. + // package_manifest (manifest_parser&, bool ignore_unknown = false); + + // Create an element of the package list manifest. + // package_manifest (manifest_parser&, manifest_name_value start, bool ignore_unknown = false); void serialize (manifest_serializer&) const; + + private: + package_manifest (manifest_parser&, + manifest_name_value start, + bool in_list, + bool ignore_unknown); }; class package_manifests: public std::vector -- cgit v1.1