aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/types.ixx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2019-11-15 13:27:23 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2019-11-15 21:18:42 +0300
commit460eb164f0051cf0ffab6860220649c4f03c74fb (patch)
tree517455df26047c70429679c7bed790098cb39c4e /libbuild2/types.ixx
parent678345c5a96f14d05a56bce8a68bdd45dfe1d172 (diff)
Use path_name_view in location and path_name_value in location_value
Diffstat (limited to 'libbuild2/types.ixx')
-rw-r--r--libbuild2/types.ixx65
1 files changed, 65 insertions, 0 deletions
diff --git a/libbuild2/types.ixx b/libbuild2/types.ixx
new file mode 100644
index 0000000..5b30cd4
--- /dev/null
+++ b/libbuild2/types.ixx
@@ -0,0 +1,65 @@
+// file : libbuild2/types.ixx -*- C++ -*-
+// copyright : Copyright (c) 2014-2019 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+namespace build2
+{
+ // Note that in the constructors we cannot pass the file data member to the
+ // base class constructor as it is not initialized yet (and so its base
+ // path/name pointers are not initialized). Thus, we initialize the path
+ // name view in the constructor body.
+ //
+ inline location_value::
+ location_value ()
+ {
+ location::file = file;
+ }
+
+ inline location_value::
+ location_value (const location& l)
+ : location (l.line, l.column), file (l.file)
+ {
+ location::file = file;
+ }
+
+ inline location_value::
+ location_value (location_value&& l)
+ : location (l.line, l.column),
+ file (std::move (l.file))
+ {
+ location::file = file;
+ }
+
+ inline location_value::
+ location_value (const location_value& l)
+ : location (l.line, l.column), file (l.file)
+ {
+ location::file = file;
+ }
+
+ inline location_value& location_value::
+ operator= (location_value&& l)
+ {
+ if (this != &l)
+ {
+ file = std::move (l.file);
+ line = l.line;
+ column = l.column;
+ }
+
+ return *this;
+ }
+
+ inline location_value& location_value::
+ operator= (const location_value& l)
+ {
+ if (this != &l)
+ {
+ file = l.file;
+ line = l.line;
+ column = l.column;
+ }
+
+ return *this;
+ }
+}