mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
[JSC] Implemented adapter. Removed Native2Value and Value2Native from js_base.h
This commit is contained in:
@ -23,11 +23,20 @@ FUNCTION_WRAPPER_JS_3(hash, hash)
|
||||
FUNCTION_WRAPPER_JS_4(hash2, hash2)
|
||||
@end
|
||||
|
||||
void* CHashEmbed::GetDataForEmbedObject(void* data)
|
||||
class CHashEmbedAdapter : public CJSEmbedObjectAdapterJSC
|
||||
{
|
||||
CHashEmbed* pNativeObj = reinterpret_cast<CHashEmbed*>(data);
|
||||
CJSCHashEmbed* pEmbedObj = [[CJSCHashEmbed alloc] init:pNativeObj];
|
||||
return (void*)CFBridgingRetain(pEmbedObj);
|
||||
public:
|
||||
id getExportedObject(CJSEmbedObject* pNative)
|
||||
{
|
||||
return [[CJSCHashEmbed alloc] init:(CHashEmbed*)pNative];
|
||||
}
|
||||
};
|
||||
|
||||
CJSEmbedObjectAdapterBase* CHashEmbed::getAdapter()
|
||||
{
|
||||
if (m_pAdapter == nullptr)
|
||||
m_pAdapter = new CHashEmbedAdapter();
|
||||
return m_pAdapter;
|
||||
}
|
||||
|
||||
std::string CHashEmbed::getName() { return "CHashEmbed"; }
|
||||
|
||||
@ -43,11 +43,20 @@ FUNCTION_WRAPPER_JS_2(encodeImage, encodeImage)
|
||||
FUNCTION_WRAPPER_JS_1(getImageType, getImageType)
|
||||
@end
|
||||
|
||||
void* CZipEmbed::GetDataForEmbedObject(void* data)
|
||||
class CZipEmbedAdapter : public CJSEmbedObjectAdapterJSC
|
||||
{
|
||||
CZipEmbed* pNativeObj = reinterpret_cast<CZipEmbed*>(data);
|
||||
CJSCZipEmbed* pEmbedObj = [[CJSCZipEmbed alloc] init:pNativeObj];
|
||||
return (void*)CFBridgingRetain(pEmbedObj);
|
||||
public:
|
||||
id getExportedObject(CJSEmbedObject* pNative)
|
||||
{
|
||||
return [[CJSCZipEmbed alloc] init:(CZipEmbed*)pNative];
|
||||
}
|
||||
};
|
||||
|
||||
CJSEmbedObjectAdapterBase* CZipEmbed::getAdapter()
|
||||
{
|
||||
if (m_pAdapter == nullptr)
|
||||
m_pAdapter = new CZipEmbedAdapter();
|
||||
return m_pAdapter;
|
||||
}
|
||||
|
||||
std::string CZipEmbed::getName() { return "CZipEmbed"; }
|
||||
|
||||
Reference in New Issue
Block a user