From aacff79e854d6d4eb22540339bc88c3efab353a2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 5 Nov 2015 17:41:16 +0200 Subject: Implement package dependency resolution --- brep/page.cxx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'brep/page.cxx') diff --git a/brep/page.cxx b/brep/page.cxx index a23ce17..deee055 100644 --- a/brep/page.cxx +++ b/brep/page.cxx @@ -6,6 +6,7 @@ #include #include +#include // shared_ptr #include #include // move() #include // min() @@ -16,6 +17,7 @@ #include #include +#include using namespace std; using namespace xml; @@ -51,7 +53,7 @@ namespace brep void FORM_SEARCH:: operator() (serializer& s) const { - // The 'action' attribute is optional in HTML5. While the standard don't + // The 'action' attribute is optional in HTML5. While the standard doesn't // specify browser behavior explicitly for the case the attribute is // ommited, the only reasonable behavior is to default it to the current // document URL. @@ -260,26 +262,35 @@ namespace brep // set ds; for (const auto& da: d) - ds.emplace (da.name); + ds.emplace (da.name ()); bool m (ds.size () > 1); if (m) s << "("; - bool first (true); + bool f (true); // First dependency alternative. for (const auto& da: d) { - if (ds.find (da.name) != ds.end ()) + string n (da.name ()); + if (ds.find (n) != ds.end ()) { - ds.erase (da.name); + ds.erase (n); - if (first) - first = false; + if (f) + f = false; else s << " | "; - s << da.name; // @@ Make it a link. + shared_ptr p (da.package.load ()); + + if (p->internal_repository != nullptr) + s << A << HREF << "/go/" << mime_url_encode (n) << ~HREF << n << ~A; + else + // @@ Refer to package repository URL when supported in repository + // manifest. + // + s << n; } } -- cgit v1.1