mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
C++ wrapper: public structure support improvement
This commit is contained in:
parent
64584409ae
commit
d410536b2d
3 changed files with 22 additions and 1 deletions
|
|
@ -726,6 +726,7 @@ class CParser(object):
|
|||
elif cType.ctype in self.classesIndex or cType.ctype in self.interfacesIndex:
|
||||
absType = ClassType(cType.ctype)
|
||||
absType.isconst = cType.completeType.startswith('const ')
|
||||
absType.isref = cType.completeType.endswith('*')
|
||||
elif cType.ctype == self.cListType:
|
||||
absType = ListType(cType.containedType)
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -334,7 +334,13 @@ class CppTranslator(object):
|
|||
else:
|
||||
return 'Object::cPtrToSharedPtr<{0}>({1})'.format(cppReturnType, cExpr)
|
||||
else:
|
||||
return '{0}({1})'.format(exprtype.desc.name.to_camel_case(), cExpr);
|
||||
if exprtype.isref:
|
||||
return '{0}({1})'.format(exprtype.desc.name.to_camel_case(), cExpr)
|
||||
else:
|
||||
return '{0}(StructWrapper<::{1}>({2}).ptr())'.format(
|
||||
exprtype.desc.name.to_camel_case(),
|
||||
exprtype.desc.name.to_c(),
|
||||
cExpr)
|
||||
elif type(exprtype) is AbsApi.ListType:
|
||||
if type(exprtype.containedTypeDesc) is AbsApi.BaseType and exprtype.containedTypeDesc.name == 'string':
|
||||
return 'StringBctbxListWrapper::bctbxListToCppList({0})'.format(cExpr)
|
||||
|
|
|
|||
|
|
@ -119,6 +119,20 @@ namespace linphone {
|
|||
static std::list<std::string> cStringArrayToCppList(const char **cArray);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class StructWrapper {
|
||||
public:
|
||||
StructWrapper(const T &s) {
|
||||
mStruct = s;
|
||||
}
|
||||
const void *ptr() const {
|
||||
return &mStruct;
|
||||
}
|
||||
|
||||
private:
|
||||
T mStruct;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
#endif // _TOOLS_HH
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue