From 460eb164f0051cf0ffab6860220649c4f03c74fb Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 15 Nov 2019 13:27:23 +0300 Subject: Use path_name_view in location and path_name_value in location_value --- libbuild2/types.ixx | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 libbuild2/types.ixx (limited to 'libbuild2/types.ixx') 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; + } +} -- cgit v1.1