diff options
author | Philip Chimento <philip.chimento@gmail.com> | 2019-01-20 17:44:45 -0800 |
---|---|---|
committer | Philip Chimento <philip.chimento@gmail.com> | 2019-04-13 22:52:33 -0700 |
commit | 14f1253c134a4870ad9e6b2317e4072f653326f6 (patch) | |
tree | db0a045337d30c18976882ac705a74670c43224a /gi/value.cpp | |
parent | ec595f81b1920a3cf68e069b1cb4ce8f1e8b6d4f (diff) | |
download | gjs-14f1253c134a4870ad9e6b2317e4072f653326f6.tar.gz |
boxed: Move to C++-style API
This allows cleaning up the public API in boxed.h a bit, changing some
methods to be private, adding missing error checks in calling code, and
creating a BoxedInstance::new_for_c_struct() method with a
BoxedInstance::NoCopy overload.
The idea is to gradually provide more typesafe, C++-style APIs for all
of the GI wrapper classes, and change calling code to use them rather
than the old C-style APIs.
Diffstat (limited to 'gi/value.cpp')
-rw-r--r-- | gi/value.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gi/value.cpp b/gi/value.cpp index 241c35ad..c9309aac 100644 --- a/gi/value.cpp +++ b/gi/value.cpp @@ -829,7 +829,6 @@ gjs_value_from_g_value_internal(JSContext *context, return false; } else if (g_type_is_a(gtype, G_TYPE_BOXED) || g_type_is_a(gtype, G_TYPE_VARIANT)) { - GjsBoxedCreationFlags boxed_flags; void *gboxed; JSObject *obj; @@ -837,7 +836,6 @@ gjs_value_from_g_value_internal(JSContext *context, gboxed = g_value_get_boxed(gvalue); else gboxed = g_value_get_variant(gvalue); - boxed_flags = GJS_BOXED_CREATION_NONE; /* special case GError */ if (g_type_is_a(gtype, G_TYPE_ERROR)) { @@ -874,8 +872,10 @@ gjs_value_from_g_value_internal(JSContext *context, GIInfoType type = info.type(); if (type == GI_INFO_TYPE_BOXED || type == GI_INFO_TYPE_STRUCT) { if (no_copy) - boxed_flags = (GjsBoxedCreationFlags) (boxed_flags | GJS_BOXED_CREATION_NO_COPY); - obj = gjs_boxed_from_c_struct(context, info, gboxed, boxed_flags); + obj = BoxedInstance::new_for_c_struct(context, info, gboxed, + BoxedInstance::NoCopy()); + else + obj = BoxedInstance::new_for_c_struct(context, info, gboxed); } else if (type == GI_INFO_TYPE_UNION) { obj = gjs_union_from_c_union(context, info, gboxed); } else { |