aboutsummaryrefslogtreecommitdiff
path: root/libbrep/common.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-08-30 23:14:51 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-08-31 18:19:37 +0300
commitd22f466823192963c22eb8f51ae930cb5af8fa9a (patch)
treef60f5dc30a76a2fff67ab20b399dafe05e80a024 /libbrep/common.hxx
parent05eeac08b63449925cc2e12d2fdaf937d5fa1bbc (diff)
Add support for git repositories to brep-load
Diffstat (limited to 'libbrep/common.hxx')
-rw-r--r--libbrep/common.hxx30
1 files changed, 24 insertions, 6 deletions
diff --git a/libbrep/common.hxx b/libbrep/common.hxx
index 5b172ec..0163ca0 100644
--- a/libbrep/common.hxx
+++ b/libbrep/common.hxx
@@ -218,21 +218,39 @@ namespace brep
// repository_type
//
using bpkg::repository_type;
+ using bpkg::to_repository_type;
+
+ #pragma db map type(repository_type) as(string) \
+ to(to_string (?)) \
+ from(brep::to_repository_type (?))
// repository_url
//
using bpkg::repository_url;
+ #pragma db map type(repository_url) as(string) \
+ to((?).string ()) \
+ from((?).empty () ? brep::repository_url () : brep::repository_url (?))
+
// repository_location
//
using bpkg::repository_location;
- #pragma db map type(repository_location) as(string) \
- to((?).url ().string ()) \
- from(brep::repository_location ((?).empty () \
- ? bpkg::repository_url () \
- : brep::repository_url (?), \
- brep::repository_type::pkg))
+ #pragma db value
+ struct _repository_location
+ {
+ repository_url url;
+ repository_type type;
+ };
+
+ // Note that the type() call fails for an empty repository location.
+ //
+ #pragma db map type(repository_location) as(_repository_location) \
+ to(brep::_repository_location {(?).url (), \
+ (?).empty () \
+ ? brep::repository_type::pkg \
+ : (?).type ()}) \
+ from(brep::repository_location (std::move ((?).url), (?).type))
// Version comparison operators.
//