本文整理汇总了C++中Callback函数的典型用法代码示例。如果您正苦于以下问题:C++ Callback函数的具体用法?C++ Callback怎么用?C++ Callback使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Callback函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOGSTRING
// --------------------------------------------------------------------------
// CNSmlDmAOAdapter::FetchLeafObjectSizeL
// Fetches leaf object size.
// -------------------------------------------------------------------------
void CNSmlDmAOAdapter::FetchLeafObjectSizeL( const TDesC8& aURI,
const TDesC8& aLUID,
const TDesC8& /* aType */,
TInt aResultsRef,
TInt aStatusRef )
{
LOGSTRING( "CNSmlDmAOAdapter::FetchLeafObjectSizeL: Start" );
LOGSTRING3( "\tFetchLeafObjectSizeL \tURI: %S, \tLUID: %S,",
&aURI, &aLUID );
CSmlDmAOCommandElement* cmd =
CSmlDmAOCommandElement::NewLC( ETrue,
aStatusRef,
aResultsRef,
CNSmlDmAOAdapter::EGetSizeCmd,
LastURISeg( aURI ),
KNullDesC8);
TInt luid( KDefaultLuid );
if ( aLUID.Length() > 0 )
{
luid = DesToIntL( aLUID );
}
iSettingStore->ExecuteCmdL( *cmd, luid );
LOGSTRING2( "\tCmd executed with status: %d ",
cmd->Status() );
// if executed get status
if ( cmd->Executed() )
{
Callback().SetStatusL( aStatusRef, cmd->Status() );
// if successful get results
if ( cmd->Status() == CSmlDmAdapter::EOk )
{
LOGSTRING2( "\tCmd executed with result: %S ",
cmd->Data() );
CBufBase* result = CBufFlat::NewL( cmd->Data()->Size() );
CleanupStack::PushL( result );
result->InsertL( 0, *cmd->Data() );
Callback().SetResultsL( aResultsRef, *result, KNullDesC8 );
CleanupStack::PopAndDestroy( result );
}
}
else
{
// failed to execute command
Callback().SetStatusL( aStatusRef, CSmlDmAdapter::EError );
}
CleanupStack::PopAndDestroy( cmd );
LOGSTRING( "CNSmlDmAOAdapter::FetchLeafObjectSizeL: End" );
}
示例2: CVkDlgBase
CVkOptionFeedsForm::CVkOptionFeedsForm(CVkProto *proto):
CVkDlgBase(proto, IDD_OPT_FEEDS, false),
m_cbNewsEnabled(this, IDC_NEWS_ENBL),
m_edtNewsInterval(this, IDC_ED_INT_NEWS),
m_spNewsInterval(this, IDC_SPIN_INT_NEWS),
m_cbNotificationsEnabled(this, IDC_NOTIF_ENBL),
m_edtNotificationsInterval(this, IDC_ED_INT_NOTIF),
m_spNotificationsInterval(this, IDC_SPIN_INT_NOTIF),
m_cbNotificationsMarkAsViewed(this, IDC_NOTIF_MARK_VIEWED),
m_cbSpecialContactAlwaysEnabled(this, IDC_SPEC_CONT_ENBL),
m_cbNewsAutoClearHistory(this, IDC_NEWSAUTOCLEAR),
m_cbNewsFilterPosts(this, IDC_F_POSTS),
m_cbNewsFilterPhotos(this, IDC_F_PHOTOS),
m_cbNewsFilterTags(this, IDC_F_TAGS),
m_cbNewsFilterWallPhotos(this, IDC_F_WALLPHOTOS),
m_cbNewsSourceFriends(this, IDC_S_FRIENDS),
m_cbNewsSourceGroups(this, IDC_S_GROUPS),
m_cbNewsSourcePages(this, IDC_S_PAGES),
m_cbNewsSourceFollowing(this, IDC_S_FOLLOWING),
m_cbNewsSourceIncludeBanned(this, IDC_S_BANNED),
m_cbNewsSourceNoReposts(this, IDC_S_NOREPOSTES),
m_cbNotificationFilterComments(this, IDC_N_COMMENTS),
m_cbNotificationFilterLikes(this, IDC_N_LIKES),
m_cbNotificationFilterReposts(this, IDC_N_REPOSTS),
m_cbNotificationFilterMentions(this, IDC_N_MENTIONS),
m_cbNotificationFilterInvites(this, IDC_N_INVITES)
{
CreateLink(m_cbNewsEnabled, m_proto->m_vkOptions.bNewsEnabled);
CreateLink(m_edtNewsInterval, m_proto->m_vkOptions.iNewsInterval);
CreateLink(m_cbNotificationsEnabled, m_proto->m_vkOptions.bNotificationsEnabled);
CreateLink(m_edtNotificationsInterval, m_proto->m_vkOptions.iNotificationsInterval);
CreateLink(m_cbNotificationsMarkAsViewed, m_proto->m_vkOptions.bNotificationsMarkAsViewed);
CreateLink(m_cbSpecialContactAlwaysEnabled, m_proto->m_vkOptions.bSpecialContactAlwaysEnabled);
CreateLink(m_cbNewsAutoClearHistory, m_proto->m_vkOptions.bNewsAutoClearHistory);
CreateLink(m_cbNewsFilterPosts, m_proto->m_vkOptions.bNewsFilterPosts);
CreateLink(m_cbNewsFilterPhotos, m_proto->m_vkOptions.bNewsFilterPhotos);
CreateLink(m_cbNewsFilterTags, m_proto->m_vkOptions.bNewsFilterTags);
CreateLink(m_cbNewsFilterWallPhotos, m_proto->m_vkOptions.bNewsFilterWallPhotos);
CreateLink(m_cbNewsSourceFriends, m_proto->m_vkOptions.bNewsSourceFriends);
CreateLink(m_cbNewsSourceGroups, m_proto->m_vkOptions.bNewsSourceGroups);
CreateLink(m_cbNewsSourcePages, m_proto->m_vkOptions.bNewsSourcePages);
CreateLink(m_cbNewsSourceFollowing, m_proto->m_vkOptions.bNewsSourceFollowing);
CreateLink(m_cbNewsSourceIncludeBanned, m_proto->m_vkOptions.bNewsSourceIncludeBanned);
CreateLink(m_cbNewsSourceNoReposts, m_proto->m_vkOptions.bNewsSourceNoReposts);
CreateLink(m_cbNotificationFilterComments, m_proto->m_vkOptions.bNotificationFilterComments);
CreateLink(m_cbNotificationFilterLikes, m_proto->m_vkOptions.bNotificationFilterLikes);
CreateLink(m_cbNotificationFilterReposts, m_proto->m_vkOptions.bNotificationFilterReposts);
CreateLink(m_cbNotificationFilterMentions, m_proto->m_vkOptions.bNotificationFilterMentions);
CreateLink(m_cbNotificationFilterInvites, m_proto->m_vkOptions.bNotificationFilterInvites);
m_cbNewsEnabled.OnChange = Callback(this, &CVkOptionFeedsForm::On_cbNewsEnabledChange);
m_cbNotificationsEnabled.OnChange = Callback(this, &CVkOptionFeedsForm::On_cbNotificationsEnabledChange);
}
示例3: CFacebookDlgBase
CFacebookGuardDialog::CFacebookGuardDialog(FacebookProto *proto, const char *fb_dtsg)
: CFacebookDlgBase(proto, IDD_GUARD, false),
m_ok(this, IDOK),
m_sms(this, IDC_SEND_SMS),
m_text(this, IDC_TEXT),
m_fb_dtsg(fb_dtsg)
{
memset(m_code, 0, sizeof(m_code));
m_ok.OnClick = Callback(this, &CFacebookGuardDialog::OnOk);
m_sms.OnClick = Callback(this, &CFacebookGuardDialog::OnSms);
}
示例4: CSuper
CJabberDlgBookmarks::CJabberDlgBookmarks(CJabberProto *proto) :
CSuper(proto, IDD_BOOKMARKS, NULL),
m_btnAdd(this, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add")),
m_btnEdit(this, IDC_EDIT, SKINICON_OTHER_RENAME, LPGEN("Edit")),
m_btnRemove(this, IDC_REMOVE, SKINICON_OTHER_DELETE, LPGEN("Remove")),
m_lvBookmarks(this, IDC_BM_LIST, true, true)
{
m_lvBookmarks.OnItemActivate = Callback(this, &CJabberDlgBookmarks::lvBookmarks_OnDoubleClick);
m_btnAdd.OnClick = Callback(this, &CJabberDlgBookmarks::btnAdd_OnClick);
m_btnEdit.OnClick = Callback(this, &CJabberDlgBookmarks::btnEdit_OnClick);
m_btnRemove.OnClick = Callback(this, &CJabberDlgBookmarks::btnRemove_OnClick);
}
示例5: CVkDlgBase
CVkCaptchaForm::CVkCaptchaForm(CVkProto *proto, CAPTCHA_FORM_PARAMS *param) :
CVkDlgBase(proto, IDD_CAPTCHAFORM, false),
m_instruction(this, IDC_INSTRUCTION),
m_edtValue(this, IDC_VALUE),
m_btnOpenInBrowser(this, IDOPENBROWSER),
m_btnOk(this, IDOK),
m_param(param)
{
m_btnOpenInBrowser.OnClick = Callback(this, &CVkCaptchaForm::On_btnOpenInBrowser_Click);
m_btnOk.OnClick = Callback(this, &CVkCaptchaForm::On_btnOk_Click);
m_edtValue.OnChange = Callback(this, &CVkCaptchaForm::On_edtValue_Change);
}
示例6: Replace
void Replace(uint32_t index, T entry)
{
if (index < Size())
{
Callback(Buffer_Remove, BufferImpl<T>::at(index));
BufferImpl<T>::at(index) = entry;
Callback(Buffer_Add, entry);
}
else
{
Add(entry);
}
}
示例7: CDlgBase
CLuaOptions::CLuaOptions(int idDialog)
: CDlgBase(g_hInstance, idDialog),
m_popupOnError(this, IDC_POPUPONERROR),
m_popupOnObsolete(this, IDC_POPUPONOBSOLETE),
isScriptListInit(false), m_scripts(this, IDC_SCRIPTS),
m_reload(this, IDC_RELOAD)
{
CreateLink(m_popupOnError, "PopupOnError", DBVT_BYTE, 1);
CreateLink(m_popupOnObsolete, "PopupOnObsolete", DBVT_BYTE, 1);
m_scripts.OnClick = Callback(this, &CLuaOptions::OnScriptListClick);
m_reload.OnClick = Callback(this, &CLuaOptions::OnReload);
}
示例8: Accept
auto Accept(ConnectionWrapper *Connection, CallbackFunctor &&Callback)
{
// Accept on streamed socket.
if (Connection->Type == eConnection::STREAMED)
{
sockaddr ClientInfo;
int ClientLength = 0;
void *Socket = (void *)accept((SOCKET)Connection->Handle.Streamed.Socket, &ClientInfo, &ClientLength);
return Callback(Socket, &ClientInfo, ClientLength);
}
return Callback(nullptr, nullptr, 0);
}
示例9: LOG
bool
CamerasChild::RecvFrameSizeChange(const CaptureEngine& capEngine,
const int& capId,
const int& w, const int& h)
{
LOG((__PRETTY_FUNCTION__));
MutexAutoLock lock(mCallbackMutex);
if (Callback(capEngine, capId)) {
Callback(capEngine, capId)->FrameSizeChange(w, h, 0);
} else {
LOG(("Frame size change with dead callback"));
}
return true;
}
示例10: if
void InputManager::HandleEvent(sf::Event e) {
// check for resize event and recreate view
if(e.Type == sf::Event::Resized) {
Root::get_mutable_instance().ResetView();
}
// check for keyboard event
if(e.Type == sf::Event::KeyPressed or e.Type == sf::Event::KeyReleased) {
for(auto i = mKeyBindings.begin(); i != mKeyBindings.end(); ++i) {
if(i->Key == e.Key.Code or i->UseAnyKey) {
if((i->EventType == KEY_PRESSED and e.Type == sf::Event::KeyPressed) or
(i->EventType == KEY_RELEASED and e.Type == sf::Event::KeyReleased))
i->Callback();
}
}
}
// check for mouse event
if(e.Type == sf::Event::MouseButtonPressed or
e.Type == sf::Event::MouseButtonReleased or
e.Type == sf::Event::MouseMoved or
e.Type == sf::Event::MouseWheelMoved) {
for(auto i = mMouseBindings.begin(); i != mMouseBindings.end(); ++i) {
if((i->EventType == BUTTON_PRESSED and
e.Type == sf::Event::MouseButtonPressed)
and i->Button == e.MouseButton.Button) {
MouseEventArgs a;
a.SetScreenPixel(Vector2D(e.MouseButton.X, e.MouseButton.Y));
i->Callback(a);
} else if((i->EventType == BUTTON_RELEASED and
e.Type == sf::Event::MouseButtonReleased) and
i->Button == e.MouseButton.Button) {
MouseEventArgs a;
a.SetScreenPixel(Vector2D(e.MouseButton.X, e.MouseButton.Y));
i->Callback(a);
} else if(i->EventType == MOUSE_MOVED and
e.Type == sf::Event::MouseMoved) {
MouseEventArgs a;
a.SetScreenPixel(Vector2D(e.MouseMove.X, e.MouseMove.Y));
i->Callback(a);
} else if(i->EventType == WHEEL_MOVED and
e.Type == sf::Event::MouseWheelMoved) {
MouseEventArgs a;
a.WheelDelta = e.MouseWheel.Delta;
i->Callback(a);
}
}
}
}
示例11: ec
void CUICustomEdit::Register_callbacks()
{
ec().assign_callback( DIK_ESCAPE, text_editor::ks_free, Callback( this, &CUICustomEdit::press_escape ) );
ec().assign_callback( DIK_RETURN, text_editor::ks_free, Callback( this, &CUICustomEdit::press_commit ) );
ec().assign_callback( DIK_NUMPADENTER, text_editor::ks_free, Callback( this, &CUICustomEdit::press_commit ) );
ec().assign_callback( DIK_GRAVE, text_editor::ks_free, Callback( this, &CUICustomEdit::nothing ) );
// ec().assign_callback( DIK_TAB, text_editor::ks_free, Callback( this, &CConsole::Find_cmd ) );
// ec().assign_callback( DIK_TAB, text_editor::ks_Shift, Callback( this, &CConsole::Find_cmd_back ) );
// ec().assign_callback( DIK_UP, text_editor::ks_free, Callback( this, &CConsole::Prev_cmd ) );
// ec().assign_callback( DIK_DOWN, text_editor::ks_free, Callback( this, &CConsole::Next_cmd ) );
// ec().assign_callback( DIK_TAB, text_editor::ks_Alt, Callback( this, &CConsole::GamePause ) );
}
示例12: EntityNode
LightNode::LightNode(const IEntityClassPtr& eclass) :
EntityNode(eclass),
_light(_entity,
*this,
Callback(boost::bind(&scene::Node::transformChanged, this)),
Callback(boost::bind(&scene::Node::boundsChanged, this)),
Callback(boost::bind(&LightNode::lightChanged, this))),
_lightCenterInstance(_light.getDoom3Radius().m_centerTransformed, boost::bind(&LightNode::selectedChangedComponent, this, _1)),
_lightTargetInstance(_light.targetTransformed(), boost::bind(&LightNode::selectedChangedComponent, this, _1)),
_lightRightInstance(_light.rightTransformed(), _light.targetTransformed(), boost::bind(&LightNode::selectedChangedComponent, this, _1)),
_lightUpInstance(_light.upTransformed(), _light.targetTransformed(), boost::bind(&LightNode::selectedChangedComponent, this, _1)),
_lightStartInstance(_light.startTransformed(), boost::bind(&LightNode::selectedChangedComponent, this, _1)),
_lightEndInstance(_light.endTransformed(), boost::bind(&LightNode::selectedChangedComponent, this, _1)),
m_dragPlanes(boost::bind(&LightNode::selectedChangedComponent, this, _1))
{}
示例13: PyThreadState_Get
void ForwardType::Fire(py::list argumentsList) {
for(std::list<ForwardFunction>::iterator it = Functions.begin();
it != Functions.end(); it++) {
ForwardFunction fwdFunction = *it;
PyThreadState *oldThreadState = PyThreadState_Get();
PyThreadState_Swap(fwdFunction.ThreadState);
py::object returnValue = py::object(true);
try {
py::object returnValue = fwdFunction.PythonFunction(*py::tuple(argumentsList));
}
catch(const py::error_already_set &) {
PyErr_Print();
}
PyThreadState_Swap(oldThreadState);
if(!Callback(returnValue)) {
PyThreadState_Swap(oldThreadState);
return;
}
}
}
示例14: CAddContactDlg
CAddContactDlg(ADDCONTACTSTRUCT *acs) :
CDlgBase(g_hInst, IDD_ADDCONTACT),
m_chkAdded(this, IDC_ADDED),
m_chkAuth(this, IDC_AUTH),
m_chkOpen(this, IDC_OPEN_WINDOW),
m_btnOk(this, IDOK),
m_group(this, IDC_GROUP),
m_authReq(this, IDC_AUTHREQ),
m_myHandle(this, IDC_MYHANDLE)
{
m_chkAuth.OnChange = Callback(this, &CAddContactDlg::OnAuthClicked);
m_chkOpen.OnChange = Callback(this, &CAddContactDlg::OnOpenClicked);
m_btnOk.OnClick = Callback(this, &CAddContactDlg::OnOk);
m_acs = *acs;
}
示例15: sizeof
bool cConnection::Read(void)
{
char temp[8193];
int size;
size = Socket->recv(temp, sizeof(temp)-1);
if (size >= 0)
{
Buffer.Add(temp, size);
temp[size] = 0;
}
if (Buffer.Get() && strstr(Buffer.Get(), "\r\n\r\n"))
{ // found the blank line
temp[0] = 0;
Buffer.Add(temp, 1);
Reading = false;
Buffer.FreeBeforeNextAdd();
if (Callback)
{
Callback(this);
}
return ReadCallback();
}
return false;
}