aboutsummaryrefslogtreecommitdiff
path: root/build2/variable.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/variable.cxx')
-rw-r--r--build2/variable.cxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/build2/variable.cxx b/build2/variable.cxx
index 1741172..48ea8aa 100644
--- a/build2/variable.cxx
+++ b/build2/variable.cxx
@@ -858,6 +858,51 @@ namespace build2
&default_empty<process_path>
};
+ // target_triplet value
+ //
+ target_triplet value_traits<target_triplet>::
+ convert (name&& n, name* r)
+ {
+ if (r == nullptr)
+ {
+ if (n.simple ())
+ {
+ try
+ {
+ return n.empty () ? target_triplet () : target_triplet (n.value);
+ }
+ catch (const invalid_argument& e)
+ {
+ throw invalid_argument (
+ string ("invalid target_triplet value: ") + e.what ());
+ }
+ }
+
+ // Fall through.
+ }
+
+ throw_invalid_argument (n, r, "target_triplet");
+ }
+
+ const char* const value_traits<target_triplet>::type_name = "target_triplet";
+
+ const value_type value_traits<target_triplet>::value_type
+ {
+ type_name,
+ sizeof (target_triplet),
+ nullptr, // No base.
+ &default_dtor<target_triplet>,
+ &default_copy_ctor<target_triplet>,
+ &default_copy_assign<target_triplet>,
+ &simple_assign<target_triplet>,
+ nullptr, // Append not supported.
+ nullptr, // Prepend not supported.
+ &simple_reverse<target_triplet>,
+ nullptr, // No cast (cast data_ directly).
+ &simple_compare<target_triplet>,
+ &default_empty<target_triplet>
+ };
+
// variable_pool
//
const variable& variable_pool::