diff options
author | Chad Austin <chad@imvu.com> | 2013-05-30 12:02:03 -0700 |
---|---|---|
committer | Chad Austin <chad@imvu.com> | 2013-07-17 11:28:42 -0700 |
commit | c86809e40da84859ec3dde789b4ad8faac86faff (patch) | |
tree | db0b76e1622709a9fa6e8e59e65bd82f9e13d4e1 | |
parent | 295b89e59b926e4e5e00386cb981eef3036c9e76 (diff) |
Rename value_tuple to value_array and value_struct to value_object
-rw-r--r-- | src/embind/embind.js | 12 | ||||
-rw-r--r-- | system/include/emscripten/bind.h | 56 | ||||
-rw-r--r-- | tests/embind/embind.test.js | 4 | ||||
-rw-r--r-- | tests/embind/embind_test.cpp | 16 |
4 files changed, 44 insertions, 44 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index 91386c69..ffa27c5e 100644 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -638,7 +638,7 @@ function __embind_register_function(name, argCount, rawArgTypesAddr, rawInvoker, var tupleRegistrations = {}; -function __embind_register_tuple(rawType, name, rawConstructor, rawDestructor) { +function __embind_register_value_array(rawType, name, rawConstructor, rawDestructor) { tupleRegistrations[rawType] = { name: readLatin1String(name), rawConstructor: FUNCTION_TABLE[rawConstructor], @@ -647,7 +647,7 @@ function __embind_register_tuple(rawType, name, rawConstructor, rawDestructor) { }; } -function __embind_register_tuple_element( +function __embind_register_value_array_element( rawTupleType, getterReturnType, getter, @@ -666,7 +666,7 @@ function __embind_register_tuple_element( }); } -function __embind_finalize_tuple(rawTupleType) { +function __embind_finalize_value_array(rawTupleType) { var reg = tupleRegistrations[rawTupleType]; delete tupleRegistrations[rawTupleType]; var elements = reg.elements; @@ -725,7 +725,7 @@ function __embind_finalize_tuple(rawTupleType) { var structRegistrations = {}; -function __embind_register_struct( +function __embind_register_value_object( rawType, name, rawConstructor, @@ -739,7 +739,7 @@ function __embind_register_struct( }; } -function __embind_register_struct_field( +function __embind_register_value_object_field( structType, fieldName, getterReturnType, @@ -760,7 +760,7 @@ function __embind_register_struct_field( }); } -function __embind_finalize_struct(structType) { +function __embind_finalize_value_object(structType) { var reg = structRegistrations[structType]; delete structRegistrations[structType]; diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index cd465e45..403d8084 100644 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -70,13 +70,13 @@ namespace emscripten { GenericFunction invoker, GenericFunction function); - void _embind_register_tuple( + void _embind_register_value_array( TYPEID tupleType, const char* name, GenericFunction constructor, GenericFunction destructor); - void _embind_register_tuple_element( + void _embind_register_value_array_element( TYPEID tupleType, TYPEID getterReturnType, GenericFunction getter, @@ -85,15 +85,15 @@ namespace emscripten { GenericFunction setter, void* setterContext); - void _embind_finalize_tuple(TYPEID tupleType); + void _embind_finalize_value_array(TYPEID tupleType); - void _embind_register_struct( + void _embind_register_value_object( TYPEID structType, const char* fieldName, GenericFunction constructor, GenericFunction destructor); - void _embind_register_struct_field( + void _embind_register_value_object_field( TYPEID structType, const char* fieldName, TYPEID getterReturnType, @@ -103,7 +103,7 @@ namespace emscripten { GenericFunction setter, void* setterContext); - void _embind_finalize_struct(TYPEID structType); + void _embind_finalize_value_object(TYPEID structType); void _embind_register_smart_ptr( TYPEID pointerType, @@ -531,26 +531,26 @@ namespace emscripten { //////////////////////////////////////////////////////////////////////////////// template<typename ClassType> - class value_tuple : public internal::noncopyable { + class value_array : public internal::noncopyable { public: - value_tuple(const char* name) { + value_array(const char* name) { using namespace internal; - _embind_register_tuple( + _embind_register_value_array( TypeID<ClassType>::get(), name, reinterpret_cast<GenericFunction>(&raw_constructor<ClassType>), reinterpret_cast<GenericFunction>(&raw_destructor<ClassType>)); } - ~value_tuple() { + ~value_array() { using namespace internal; - _embind_finalize_tuple(TypeID<ClassType>::get()); + _embind_finalize_value_array(TypeID<ClassType>::get()); } template<typename InstanceType, typename ElementType> - value_tuple& element(ElementType InstanceType::*field) { + value_array& element(ElementType InstanceType::*field) { using namespace internal; - _embind_register_tuple_element( + _embind_register_value_array_element( TypeID<ClassType>::get(), TypeID<ElementType>::get(), reinterpret_cast<GenericFunction>( @@ -566,11 +566,11 @@ namespace emscripten { } template<typename Getter, typename Setter> - value_tuple& element(Getter getter, Setter setter) { + value_array& element(Getter getter, Setter setter) { using namespace internal; typedef GetterPolicy<Getter> GP; typedef SetterPolicy<Setter> SP; - _embind_register_tuple_element( + _embind_register_value_array_element( TypeID<ClassType>::get(), TypeID<typename GP::ReturnType>::get(), reinterpret_cast<GenericFunction>(&GP::template get<ClassType>), @@ -582,11 +582,11 @@ namespace emscripten { } template<int Index> - value_tuple& element(index<Index>) { + value_array& element(index<Index>) { using namespace internal; ClassType* null = 0; typedef typename std::remove_reference<decltype((*null)[Index])>::type ElementType; - _embind_register_tuple_element( + _embind_register_value_array_element( TypeID<ClassType>::get(), TypeID<ElementType>::get(), reinterpret_cast<GenericFunction>(&internal::get_by_index<ClassType, ElementType>), @@ -603,25 +603,25 @@ namespace emscripten { //////////////////////////////////////////////////////////////////////////////// template<typename ClassType> - class value_struct : public internal::noncopyable { + class value_object : public internal::noncopyable { public: - value_struct(const char* name) { + value_object(const char* name) { using namespace internal; - _embind_register_struct( + _embind_register_value_object( TypeID<ClassType>::get(), name, reinterpret_cast<GenericFunction>(&raw_constructor<ClassType>), reinterpret_cast<GenericFunction>(&raw_destructor<ClassType>)); } - ~value_struct() { - _embind_finalize_struct(internal::TypeID<ClassType>::get()); + ~value_object() { + _embind_finalize_value_object(internal::TypeID<ClassType>::get()); } template<typename InstanceType, typename FieldType> - value_struct& field(const char* fieldName, FieldType InstanceType::*field) { + value_object& field(const char* fieldName, FieldType InstanceType::*field) { using namespace internal; - _embind_register_struct_field( + _embind_register_value_object_field( TypeID<ClassType>::get(), fieldName, TypeID<FieldType>::get(), @@ -638,7 +638,7 @@ namespace emscripten { } template<typename Getter, typename Setter> - value_struct& field( + value_object& field( const char* fieldName, Getter getter, Setter setter @@ -646,7 +646,7 @@ namespace emscripten { using namespace internal; typedef GetterPolicy<Getter> GP; typedef SetterPolicy<Setter> SP; - _embind_register_struct_field( + _embind_register_value_object_field( TypeID<ClassType>::get(), fieldName, TypeID<typename GP::ReturnType>::get(), @@ -659,11 +659,11 @@ namespace emscripten { } template<int Index> - value_struct& field(const char* fieldName, index<Index>) { + value_object& field(const char* fieldName, index<Index>) { using namespace internal; ClassType* null = 0; typedef typename std::remove_reference<decltype((*null)[Index])>::type ElementType; - _embind_register_struct_field( + _embind_register_value_object_field( TypeID<ClassType>::get(), fieldName, TypeID<ElementType>::get(), diff --git a/tests/embind/embind.test.js b/tests/embind/embind.test.js index e60e1ab3..8661d87e 100644 --- a/tests/embind/embind.test.js +++ b/tests/embind/embind.test.js @@ -1747,8 +1747,8 @@ module({ BaseFixture.extend("constants", function() { assert.equal(10, cm.INT_CONSTANT); assert.equal("some string", cm.STRING_CONSTANT); - assert.deepEqual([1, 2, 3, 4], cm.VALUE_TUPLE_CONSTANT); - assert.deepEqual({x:1,y:2,z:3,w:4}, cm.VALUE_STRUCT_CONSTANT); + assert.deepEqual([1, 2, 3, 4], cm.VALUE_ARRAY_CONSTANT); + assert.deepEqual({x:1,y:2,z:3,w:4}, cm.VALUE_OBJECT_CONSTANT); }); BaseFixture.extend("object handle comparison", function() { diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp index 3561b8a1..419c216e 100644 --- a/tests/embind/embind_test.cpp +++ b/tests/embind/embind_test.cpp @@ -1445,7 +1445,7 @@ EMSCRIPTEN_BINDINGS(tests) { //function("emval_test_take_and_return_CustomStruct", &emval_test_take_and_return_CustomStruct); - value_tuple<TupleVector>("TupleVector") + value_array<TupleVector>("TupleVector") .element(&TupleVector::x) .element(&Vector::getY, &Vector::setY) .element(&readVectorZ, &writeVectorZ) @@ -1455,13 +1455,13 @@ EMSCRIPTEN_BINDINGS(tests) { function("emval_test_return_TupleVector", &emval_test_return_TupleVector); function("emval_test_take_and_return_TupleVector", &emval_test_take_and_return_TupleVector); - value_tuple<TupleVectorTuple>("TupleVectorTuple") + value_array<TupleVectorTuple>("TupleVectorTuple") .element(&TupleVectorTuple::v) ; function("emval_test_return_TupleVectorTuple", &emval_test_return_TupleVectorTuple); - value_struct<StructVector>("StructVector") + value_object<StructVector>("StructVector") .field("x", &StructVector::x) .field("y", &Vector::getY, &Vector::setY) .field("z", &readVectorZ, &writeVectorZ) @@ -1471,7 +1471,7 @@ EMSCRIPTEN_BINDINGS(tests) { function("emval_test_return_StructVector", &emval_test_return_StructVector); function("emval_test_take_and_return_StructVector", &emval_test_take_and_return_StructVector); - value_struct<TupleInStruct>("TupleInStruct") + value_object<TupleInStruct>("TupleInStruct") .field("field", &TupleInStruct::field) ; @@ -2077,12 +2077,12 @@ OrderedStruct getOrderedStruct() { } EMSCRIPTEN_BINDINGS(order) { - value_tuple<OrderedTuple>("OrderedTuple") + value_array<OrderedTuple>("OrderedTuple") .element(&OrderedTuple::first) .element(&OrderedTuple::second) ; - value_struct<OrderedStruct>("OrderedStruct") + value_object<OrderedStruct>("OrderedStruct") .field("first", &OrderedStruct::first) .field("second", &OrderedStruct::second) ; @@ -2215,10 +2215,10 @@ EMSCRIPTEN_BINDINGS(constants) { constant("STRING_CONSTANT", std::string("some string")); TupleVector tv(1, 2, 3, 4); - constant("VALUE_TUPLE_CONSTANT", tv); + constant("VALUE_ARRAY_CONSTANT", tv); StructVector sv(1, 2, 3, 4); - constant("VALUE_STRUCT_CONSTANT", sv); + constant("VALUE_OBJECT_CONSTANT", sv); } class DerivedWithOffset : public DummyDataToTestPointerAdjustment, public Base { |