-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow auto wrapping temporary C++ objects (implementation of #113)
Added `class_::auto_wrap_objects()` function to set an `auto_wrap_objects_` flag in the `object_registry` for a wrapped class. Added `class_::find_object(obj)` overloaded function for an object reference, to create a clone of the `obj` with `Traits::clone()` and to wrap the cloned object for the JavaScript side, if no such an instance was found. Added `clone(T const& src)` template function into `raw_ptr_traits, `shared_ptr_traits`, to create a copy of `src` with a copy constructor of class T. Using the added `class_::find_object(obj)` overloading in `convert<T>` specializations for a wrapped class T references, both for `raw_ptr_traits and `shared_ptr_traits`. Added a simple test case with a function returning an unwrapped C++ object, and accessing it from JavaScript. The returned objects shall be valid in JavaScript, since the `vpp8:class_.auto_wrap_objects(true)` for the test class.
- Loading branch information
Showing
6 changed files
with
83 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters