|
@ -476,6 +476,19 @@ namespace pEp { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
T** data() |
|
|
|
|
|
{ |
|
|
|
|
|
return _c_struct_pp; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const T* c_data() const |
|
|
|
|
|
{ |
|
|
|
|
|
if (_c_struct_pp == nullptr) { |
|
|
|
|
|
throw Exception{ EXSTR("invalid state") }; |
|
|
|
|
|
} |
|
|
|
|
|
return *_c_struct_pp; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
operator T*() |
|
|
operator T*() |
|
|
{ |
|
|
{ |
|
|
return _c_struct_p; |
|
|
return _c_struct_p; |
|
@ -557,26 +570,14 @@ namespace pEp { |
|
|
class TestStruct1 : public PODStruct<::Test_struct1> { |
|
|
class TestStruct1 : public PODStruct<::Test_struct1> { |
|
|
public: |
|
|
public: |
|
|
TestStruct1(bool is_owner, ::Test_struct1** test_struct1_p = nullptr) : |
|
|
TestStruct1(bool is_owner, ::Test_struct1** test_struct1_p = nullptr) : |
|
|
PODStruct<::Test_struct1>(is_owner, _alloc, _free, test_struct1_p) |
|
|
PODStruct<::Test_struct1>(is_owner, test_struct1_p) |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// fields of the struct as 'properties' ;)
|
|
|
// fields of the struct as 'properties' ;)
|
|
|
pEp::POD<int> c_int{ &_c_struct_p->c_int }; |
|
|
pEp::POD<int> c_int{ &(*data())->c_int }; |
|
|
pEp::POD<::Test_enum> c_enum{ &_c_struct_p->c_enum }; |
|
|
pEp::POD<::Test_enum> c_enum{ &(*data())->c_enum }; |
|
|
pEp::String c_str{ false, &_c_struct_p->c_str,"fd" }; |
|
|
pEp::String c_str{ true, &(*data())->c_str }; |
|
|
|
|
|
|
|
|
private: |
|
|
|
|
|
static Test_struct1* _alloc() |
|
|
|
|
|
{ |
|
|
|
|
|
return (Test_struct1*)calloc(1, sizeof(Test_struct1)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void _free(Test_struct1* ptr) |
|
|
|
|
|
{ |
|
|
|
|
|
pEpLog("called"); |
|
|
|
|
|
::free_test_struct(ptr); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
template<> |
|
|
template<> |
|
|