本文整理汇总了C++中GetFunction函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFunction函数的具体用法?C++ GetFunction怎么用?C++ GetFunction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetFunction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
// CONSTRUCTOR
//------------------------------------------------------------------------------
/*explicit*/ CachePlugin::CachePlugin( const AString & dllName ) :
#if defined( __WINDOWS__ )
m_DLL( nullptr ),
#endif
m_InitFunc( nullptr ),
m_ShutdownFunc( nullptr ),
m_PublishFunc( nullptr ),
m_RetrieveFunc( nullptr ),
m_FreeMemoryFunc( nullptr )
{
#if defined( __WINDOWS__ )
m_DLL = ::LoadLibrary( dllName.Get() );
if ( !m_DLL )
{
FLOG_WARN( "Cache plugin '%s' load failed (0x%x).", dllName.Get(), ::GetLastError() );
return;
}
m_InitFunc = (CacheInitFunc) GetFunction( "CacheInit", "[email protected]@[email protected]" );
m_ShutdownFunc = (CacheShutdownFunc) GetFunction( "CacheShutdown", "[email protected]@YAXXZ" );
m_PublishFunc = (CachePublishFunc) GetFunction( "CachePublish", "[email protected]@[email protected]" );
m_RetrieveFunc = (CacheRetrieveFunc) GetFunction( "CacheRetrieve", "[email protected]@[email protected]" );
m_FreeMemoryFunc= (CacheFreeMemoryFunc) GetFunction( "CacheFreeMemory", "[email protected]@[email protected]" );
#elif defined( __APPLE__ )
ASSERT( false ); // TODO:MAC Implement CachePlugin
#elif defined( __LINUX__ )
ASSERT( false ); // TODO:LINUX Implement CachePlugin
#else
#error Unknown platform
#endif
}
示例2: GetFunctionNum
void Statement::WriteToFile(FILE* fp, int indent)const
{
#if _DEBUG
int num = GetFunctionNum();
Function* func1 = GetFunction(0);
Function* func2 = GetFunction(1);
if (num == 2 && NULL != func1 && NULL != func2 && func1->GetCall().GetParamClass() == Call::PARAM_CLASS_TERNARY_OPERATOR && func2->GetCall().GetParamClass() == Call::PARAM_CLASS_TERNARY_OPERATOR){
ISyntaxComponent* pcomp0 = func1->GetCall().GetParam(0);
ISyntaxComponent* pcomp1 = func1->GetStatement(0);
ISyntaxComponent* pcomp2 = func2->GetStatement(0);
if (NULL!=pcomp0 && NULL != pcomp1 && NULL != pcomp2){
WriteComponent(fp, *pcomp0, indent);
fwrite(" ? ", 3, 1, fp);
WriteComponent(fp, *pcomp1, 0);
fwrite(" : ", 3, 1, fp);
WriteComponent(fp, *pcomp2, 0);
}
} else {
for (int ix = 0; ix < num; ++ix){
ISyntaxComponent& component = *GetFunction(ix);
WriteComponent(fp, component, indent);
if (ix < num - 1){
fwrite("\n", 1, 1, fp);
}
}
}
#endif
}
示例3: LOGERROR
void ScriptFile::AddEventHandler(Object* sender, StringHash eventType, const String& handlerName)
{
if (!compiled_)
return;
if (!sender)
{
LOGERROR("Null event sender for event " + String(eventType) + ", handler " + handlerName);
return;
}
String declaration = "void " + handlerName + "(StringHash, VariantMap&)";
asIScriptFunction* function = GetFunction(declaration);
if (!function)
{
declaration = "void " + handlerName + "()";
function = GetFunction(declaration);
if (!function)
{
LOGERROR("Event handler function " + handlerName + " not found in " + GetName());
return;
}
}
SubscribeToEvent(sender, eventType, HANDLER_USERDATA(ScriptFile, HandleScriptEvent, (void*)function));
}
示例4: wxLogDebug
wxString wxStringFormatter::DoFunction(wxString func, wxString block)
{
wxLogDebug("DoFunction: " + block);
if(GetFunction(func))
{
return GetFunction(func)->Parse(ReplaceSymbols(block));
}
return func + block;
}
示例5: DiagStackFrame
DiagNativeStackFrame::DiagNativeStackFrame(
ScriptFunction* function,
int byteCodeOffset,
void* stackAddr,
void *codeAddr,
int frameIndex) :
DiagStackFrame(frameIndex),
m_function(function),
m_byteCodeOffset(byteCodeOffset),
m_stackAddr(stackAddr),
m_localVarSlotsOffset(InvalidOffset),
m_localVarChangedOffset(InvalidOffset)
{
Assert(m_stackAddr != NULL);
AssertMsg(m_function && m_function->GetScriptContext() && m_function->GetScriptContext()->IsInDebugMode(),
"This only supports functions in debug mode.");
FunctionEntryPointInfo * entryPointInfo = GetFunction()->GetEntryPointFromNativeAddress((DWORD_PTR)codeAddr);
if (entryPointInfo)
{
m_localVarSlotsOffset = entryPointInfo->localVarSlotsOffset;
m_localVarChangedOffset = entryPointInfo->localVarChangedOffset;
}
else
{
AssertMsg(FALSE, "Failed to get entry point for native address. Most likely the frame is old/gone.");
}
OUTPUT_TRACE(Js::DebuggerPhase, L"DiagNativeStackFrame::DiagNativeStackFrame: e.p(addr %p)=%p varOff=%d changedOff=%d\n", codeAddr, entryPointInfo, m_localVarSlotsOffset, m_localVarChangedOffset);
}
示例6: CreateTimer
void CreateTimer(ScriptValue &s, ScriptValue *args) {
if (args[1].intVal < 1 || args[1].intVal > (1<<30)) {
return;
}
ObjectValue *obj;
int function = GetFunction(&args[0], &args[3], obj);
if (function < 0) return;
int index = FindTimerSpace();
if (index == -1) {
if (obj) obj->Release();
return;
}
if (!(timers[index].slowTimer = (Timer*) malloc(sizeof(Timer)))) {
if (obj) obj->Release();
timers[index].type = KILLED_TIMER;
return;
}
timers[index].obj = obj;
timers[index].type = SLOW_TIMER;
timers[index].function = function;
timers[index].slowTimer->Init(SlowTimerProc, (void*)(size_t)index, args[1].intVal, RUN_ALWAYS, 0, SAVE_NONE);
if (timers[index].slowTimer->timerMode != RUN_ALWAYS) {
timers[index].Kill();
}
else {
CreateIntValue(s, index+1);
if (args[2].intVal == 0) {
timers[index].slowTimer->lastRun = time64i();
timers[index].slowTimer->ChangeDelay(timers[index].slowTimer->delay);
}
}
}
示例7: CreateFastTimer
void CreateFastTimer(ScriptValue &s, ScriptValue *args) {
if (args[1].intVal < 10 || args[1].intVal > 3600000) {
return;
}
ObjectValue *obj;
int function = GetFunction(&args[0], &args[3], obj);
if (function < 0) return;
int index = FindTimerSpace();
if (index == -1) {
if (obj) obj->Release();
return;
}
timers[index].type = FAST_TIMER;
timers[index].obj = obj;
timers[index].function = function;
timers[index].fastTimer.active = 0;
timers[index].fastTimer.id = index+10;
timers[index].fastTimer.delay = args[1].i32;
if (!timers[index].Start(1)) {
timers[index].Kill();
}
else {
CreateIntValue(s, index+1);
if (args[2].intVal)
RunTimerFunction(timers[index].function, timers[index].obj, index+1);
}
}
示例8: NSMain
extern "C" void NSMain(const v8::FunctionCallbackInfo<v8::Value>& args)
{
auto isolate = args.GetIsolate();
auto len = args.Length();
if (len != 5)
{
auto errMsg = v8::String::NewFromUtf8(isolate, "Wrong number of arguments (expected 5)");
auto err = v8::Exception::Error(errMsg);
isolate->ThrowException(err);
return;
}
auto exports = args[1].As<v8::Object>();
auto ft = v8::FunctionTemplate::New(isolate, AddFuncCallback);
auto ctx = isolate->GetCurrentContext();
auto maybeFunc = ft->GetFunction(ctx);
if (maybeFunc.IsEmpty())
{
auto errMsg = v8::String::NewFromUtf8(isolate, "Cannot create 'add' function");
auto err = v8::Exception::Error(errMsg);
isolate->ThrowException(err);
return;
}
auto func = maybeFunc.ToLocalChecked();
auto propName = v8::String::NewFromUtf8(isolate, "add");
auto result = exports->Set(ctx, propName, func);
}
示例9: pkcs11_C_GetMechanismList
static VALUE
pkcs11_C_GetMechanismList(VALUE self, VALUE slot_id)
{
CK_RV rv;
CK_C_GetMechanismList func;
CK_MECHANISM_TYPE_PTR types;
CK_ULONG count;
VALUE ary;
CK_ULONG i;
ary = rb_ary_new();
GetFunction(self, C_GetMechanismList, func);
CallFunction(C_GetMechanismList, func, rv, NUM2HANDLE(slot_id), NULL_PTR, &count);
if (rv != CKR_OK) pkcs11_raise(self,rv);
if (count == 0) return ary;
types = (CK_MECHANISM_TYPE_PTR)malloc(sizeof(CK_MECHANISM_TYPE)*count);
if (!types) rb_sys_fail(0);
CallFunction(C_GetMechanismList, func, rv, NUM2HANDLE(slot_id), types, &count);
if (rv != CKR_OK){
free(types);
pkcs11_raise(self,rv);
}
for (i = 0; i < count; i++)
rb_ary_push(ary, HANDLE2NUM(*(types+i)));
free(types);
return ary;
}
示例10: GetFunction
/*
============
idScriptObject::GetConstructor
============
*/
const function_t *idScriptObject::GetConstructor( void ) const
{
const function_t *func;
func = GetFunction( "init" );
return func;
}
示例11: CL_Vec2f
void ScrollComponent::OnAdd(Entity *pEnt)
{
EntityComponent::OnAdd(pEnt);
//shared with the rest of the entity
m_vecDisplacement = m_vecChildPos = CL_Vec2f(0,0);
m_pPos2d = &GetParent()->GetVar("pos2d")->GetVector2();
m_pSize2d = &GetParent()->GetVar("size2d")->GetVector2();
//vars in our component namespace
m_pBoundsRect = &GetVarWithDefault("boundsRect", CL_Rectf(0, 0, 0,0))->GetRect();
m_pScrollStyle = &GetVarWithDefault("scrollStyle", uint32(STYLE_MOMENTUM))->GetUINT32();
//only used for "momentum style"
m_pFriction = &GetVarWithDefault("friction", 0.1f)->GetFloat();
m_pMaxScrollSpeed = &GetVarWithDefault("maxScrollSpeed", float(7))->GetFloat();
m_pPowerMod = &GetVarWithDefault("powerMod", float(0.15))->GetFloat();
m_progressVar = GetVar("progress2d");
m_pEnforceFingerTracking = &GetVarWithDefault("fingerTracking", uint32(0))->GetUINT32();
m_pSwipeDetectDistance = &GetVarWithDefault("swipeDetectDistance", 25.0f)->GetFloat();
m_pDontScrollUntilSwipeDetected = &GetVarWithDefault("dontScrollUntilSwipeDetected", uint32(0))->GetUINT32();
m_pEatAllInput = &GetVarWithDefault("eatAllInput", uint32(0))->GetUINT32();
GetParent()->GetFunction("OnOverStart")->sig_function.connect(1, boost::bind(&ScrollComponent::OnOverStart, this, _1));
GetParent()->GetFunction("OnOverEnd")->sig_function.connect(1, boost::bind(&ScrollComponent::OnOverEnd, this, _1));
GetParent()->GetFunction("OnOverMove")->sig_function.connect(1, boost::bind(&ScrollComponent::OnOverMove, this, _1));
GetParent()->GetFunction("OnUpdate")->sig_function.connect(1, boost::bind(&ScrollComponent::OnUpdate, this, _1));
GetFunction("SetProgress")->sig_function.connect(1, boost::bind(&ScrollComponent::SetProgress, this, _1));
}
示例12: pkcs11_C_GetSlotList
static VALUE
pkcs11_C_GetSlotList(VALUE self, VALUE presented)
{
CK_ULONG ulSlotCount;
CK_SLOT_ID_PTR pSlotList;
CK_RV rv;
CK_C_GetSlotList func;
CK_ULONG i;
VALUE ary = rb_ary_new();
GetFunction(self, C_GetSlotList, func);
CallFunction(C_GetSlotList, func, rv, CK_FALSE, NULL_PTR, &ulSlotCount);
if (rv != CKR_OK) pkcs11_raise(self,rv);
pSlotList = (CK_SLOT_ID_PTR)malloc(ulSlotCount*sizeof(CK_SLOT_ID));
CallFunction(C_GetSlotList, func, rv, RTEST(presented) ? CK_TRUE : CK_FALSE, pSlotList, &ulSlotCount);
if (rv != CKR_OK) {
free(pSlotList);
pkcs11_raise(self,rv);
}
for (i = 0; i < ulSlotCount; i++)
rb_ary_push(ary, HANDLE2NUM(pSlotList[i]));
free(pSlotList);
return ary;
}
示例13: input
void
TestFunctionEquality
(
const JCharacter* fileName
)
{
std::ifstream input(fileName);
TestVarList theVarList(input);
JFunction* f1 = NULL;
JFunction* f2 = NULL;
while (1)
{
if (!GetFunction(input, &theVarList, &f1))
{
break;
}
else if (f1 == NULL)
{
continue;
}
if (!GetFunction(input, &theVarList, &f2))
{
jdelete f1;
break;
}
else if (f2 == NULL)
{
jdelete f1;
continue;
}
if (*f1 == *f2)
{
(JGetUserNotification())->DisplayMessage("These functions are the same");
}
else
{
(JGetUserNotification())->DisplayMessage("These functions are not the same");
}
jdelete f1;
jdelete f2;
}
}
示例14: LoadSharedLibrary
Module * ModuleFactory::createModule(const char * path) const {
Info << "Loading " << path;
void *hDLL;
//do not add extension. It is handled by LoadSharedLibrary.
hDLL = LoadSharedLibrary(path);
if (hDLL == 0)
return NULL;
Instance instanciate = (Instance)GetFunction(hDLL, "create");
Destroy destroy = (Destroy)GetFunction(hDLL, "destroy");
if (instanciate == 0 || destroy == 0)
return NULL;
Module * module = instanciate();
module->setCleanLibraryCallback(new CleanLibraryCallBack(hDLL, destroy));
return module;
}
示例15: InitInstance
void Dollar::InitInstance(Isolate* iso, v8::Handle<v8::Object> & target)
{
auto tmpl = Local<FunctionTemplate>::New(iso, _Template);
// create an instance of dollar object and make a property
auto dollar = tmpl->GetFunction()->NewInstance();
// target->SetAccessor(String::NewFromUtf8(iso, "$"), jsGetter, 0, dollar);
target->Set(String::NewFromUtf8(iso, "$"), dollar);
}