aboutsummaryrefslogtreecommitdiff
path: root/build2/variable
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-11 09:20:49 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-11 09:20:49 +0200
commit9da5febf1d9af9f5cb62d5d35fc87136e6e4cd60 (patch)
tree6a8d1f857810787cb6e25e6b416ac8bd5eb8b3d7 /build2/variable
parent0342dc2fcdd78ef28a4e59d84193a3807068d726 (diff)
Add basic support for variable value inheritance
Currently, only abs_dir_path inherits from dir_path.
Diffstat (limited to 'build2/variable')
-rw-r--r--build2/variable10
1 files changed, 9 insertions, 1 deletions
diff --git a/build2/variable b/build2/variable
index 14bf7af..ebf0f02 100644
--- a/build2/variable
+++ b/build2/variable
@@ -28,6 +28,14 @@ namespace build2
const char* name; // Type name for diagnostics.
const size_t size; // Type size in value::data_ (only used for PODs).
+ // Base type, if any. We have very limited support for inheritance: a
+ // const value (but not non-const) can be cast to the base type. In
+ // particular, a derived/base value cannot be assigned to base/derived.
+ // If not NULL, then the cast function below is expected to return the
+ // base pointer if its second argument points to the base's value_type.
+ //
+ const value_type* base;
+
// Destroy the value. If it is NULL, then the type is assumed to be POD
// with a trivial destructor.
//
@@ -59,7 +67,7 @@ namespace build2
// static_cast to const T*. If it is NULL, then cast data_ directly. Note
// that this function is used for both const and non-const values.
//
- const void* (*const cast) (const value&);
+ const void* (*const cast) (const value&, const value_type*);
// If NULL, then the types are compared as PODs using memcmp().
//