![]() ![]() ![]()
|
BREW C++ Class Library & GUI Framework & XML Middleware : SophiaFramework 4.1 |
SophiaFremwork provides the C++ wrapper classes for all the interfaces included in the BREW SDK.
Example 20.1. Create the interface
// SFBHashSmp is smart pointer that manages SFBHash interface // new interface is created by using SFBHash::NewInstance function SFBHashSmp hash(SFBHash::NewInstance(AEECLSID_MD5));
In a wrapper class, there are two types of functions: inline function that simply wraps the BREW API in C++, and function that takes the instances of SophiaFramework class as arguments.
Since the inline function is inline-expanded during compilation, the speed degradation will never occur at runtime.
Example 20.4. ISHELL_GetAppCopyright function of IShell interface
// BREW native API int ISHELL_GetAppCopyright(IShell* pIShell, AECHAR* pBuff, int nSize); // inline function that simply wraps BREW API function SInt32 SFBShell::GetAppCopyright(WCharPtr buf, SInt32 size); // function that takes instance of SophiaFramework class as argument SInt32 SFBShell::GetAppCopyright(SFXWideStringPtr string);
The above function takes a pointer to the buffer where the WChar string is stored as an argument.
The inline function is one that wraps simply the BREW native API.
In the function that takes the instances of SophiaFramework class as arguments, the class such as SFXWideString is extended to be specified as an argument. Since overheads such as getting the size of SFXWideString instance are included, a bit slowdown occurs.
|
Copyright (C) 2002 - 2009 Sophia Cradle, Inc. All Rights Reserved. |
![]() ![]() ![]()
|