本文整理汇总了C++中ReadParams函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadParams函数的具体用法?C++ ReadParams怎么用?C++ ReadParams使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadParams函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleRBACGroupAddCommand
static bool HandleRBACGroupAddCommand(ChatHandler* handler, char const* args)
{
RBACCommandData* command = ReadParams(handler, args);
if (!command)
{
handler->SetSentErrorMessage(true);
return false;
}
RBACCommandResult result = command->rbac->AddGroup(command->id, command->realmId);
RBACGroup const* group = sAccountMgr->GetRBACGroup(command->id);
switch (result)
{
case RBAC_CANT_ADD_ALREADY_ADDED:
handler->PSendSysMessage(LANG_RBAC_GROUP_IN_LIST, command->id, group->GetName().c_str(),
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
break;
case RBAC_OK:
handler->PSendSysMessage(LANG_RBAC_GROUP_ADDED, command->id, group->GetName().c_str(),
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
break;
case RBAC_ID_DOES_NOT_EXISTS:
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
break;
default:
break;
}
if (command->needDelete)
delete command;
return true;
}
示例2: HandleRBACRoleRevokeCommand
static bool HandleRBACRoleRevokeCommand(ChatHandler* handler, char const* args)
{
RBACCommandData* command = ReadParams(handler, args);
if (!command)
{
handler->SetSentErrorMessage(true);
return false;
}
RBACCommandResult result = command->rbac->RevokeRole(command->id, command->realmId);
RBACRole const* role = sAccountMgr->GetRBACRole(command->id);
switch (result)
{
case RBAC_CANT_REVOKE_NOT_IN_LIST:
handler->PSendSysMessage(LANG_RBAC_ROLE_REVOKED_NOT_IN_LIST, command->id, role->GetName().c_str(),
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
break;
case RBAC_OK:
handler->PSendSysMessage(LANG_RBAC_ROLE_REVOKED, command->id, role->GetName().c_str(),
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
break;
case RBAC_ID_DOES_NOT_EXISTS:
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
break;
default:
break;
}
if (command->needDelete)
delete command;
return true;
}
示例3: HandleRBACGroupListCommand
static bool HandleRBACGroupListCommand(ChatHandler* handler, char const* args)
{
RBACCommandData* command = ReadParams(handler, args, false);
if (!command)
{
handler->SetSentErrorMessage(true);
return false;
}
handler->PSendSysMessage(LANG_RBAC_GROUP_LIST_HEADER, command->rbac->GetId(), command->rbac->GetName().c_str());
RBACGroupContainer const& groups = command->rbac->GetGroups();
if (groups.empty())
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
else
{
for (RBACGroupContainer::const_iterator it = groups.begin(); it != groups.end(); ++it)
{
RBACGroup const* group = sAccountMgr->GetRBACGroup(*it);
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, group->GetId(), group->GetName().c_str());
}
}
if (command->needDelete)
delete command;
return true;
}
示例4: HandleRBACAccountPermissionCommand
static bool HandleRBACAccountPermissionCommand(ChatHandler* handler, char const* args)
{
RBACCommandData* command = ReadParams(handler, args, false);
if (!command)
{
handler->SetSentErrorMessage(true);
return false;
}
handler->PSendSysMessage(LANG_RBAC_PERM_LIST_GLOBAL, command->rbac->GetId(), command->rbac->GetName().c_str());
RBACPermissionContainer const& permissions = command->rbac->GetPermissions();
if (!permissions.any())
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
else
{
for (uint32 i = 0; i < RBAC_PERM_MAX; ++i)
if (permissions.test(i))
{
RBACPermission const* permission = sAccountMgr->GetRBACPermission(i);
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
}
}
if (command->needDelete)
delete command;
return true;
}
示例5: define_param_map
/**
* Constructs a WORHP algorithm
*/
worhp::worhp(int iter, double feas, double opt, bool screen_output)
{
// We construct the map between parameters and integers used to set and get them
define_param_map();
// We set the screen output member from algorithm::base
set_screen_output(screen_output);
// We deactivate WORHP keyboard handler as it does introduce funny problems
setenv("WORHP_DISABLE_KEYBOARD_HANDLER", "1", 0);
// We deal with screen output (this is buggy in lworhp 1.8.0, hopefully future releases can fix the problem
// and we will be able to restore the screen output upon request
if (m_screen_output) {
SetWorhpPrint(default_output);
} else {
SetWorhpPrint(no_screen_output);
}
// We read the algorithm parameters from the xml file, if this is not found
// we set default values and ignore the issue.
int status;
m_params.initialised = false;
ReadParams(&status, const_cast<char*>("param.xml"), &m_params);
status = OK;
m_params.MatrixCC = false; // Not sure what this deas exactly
// We set some of the parameters exposed in the constructor
set_param("TolFeas", feas);
set_param("TolOpti", opt);
set_param("MaxIter", iter);
}
示例6: HandleRBACPermRevokeCommand
static bool HandleRBACPermRevokeCommand(ChatHandler* handler, char const* args)
{
RBACCommandData* command = ReadParams(handler, args);
if (!command)
{
handler->SetSentErrorMessage(true);
return false;
}
rbac::RBACCommandResult result = command->rbac->RevokePermission(command->id, command->realmId);
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
switch (result)
{
case rbac::RBAC_CANT_REVOKE_NOT_IN_LIST:
handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED_NOT_IN_LIST, command->id, permission->GetName().c_str(),
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
break;
case rbac::RBAC_OK:
handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED, command->id, permission->GetName().c_str(),
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
break;
case rbac::RBAC_ID_DOES_NOT_EXISTS:
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
break;
default:
break;
}
delete command;
return true;
}
示例7: GameWarning
//------------------------------------------------------------------------
bool CItem::ReadItemParams(const IItemParamsNode *root)
{
if(!root)
{
GameWarning("Warning: ItemParams for item <%s> NULL", GetEntity()->GetName());
return false;
}
const IItemParamsNode *params = root->GetChild("params");
const IItemParamsNode *geometry = root->GetChild("geometry");
const IItemParamsNode *actions = root->GetChild("actions");
const IItemParamsNode *layers = root->GetChild("layers");
const IItemParamsNode *accessories = root->GetChild("accessories");
const IItemParamsNode *damagelevels = root->GetChild("damagelevels");
const IItemParamsNode *accessoryAmmo = root->GetChild("accessoryAmmo");
if(params) ReadParams(params);
if(actions) ReadActions(actions);
if(geometry) ReadGeometry(geometry);
if(layers) ReadLayers(layers);
if(accessories) ReadAccessories(accessories);
if(damagelevels) ReadDamageLevels(damagelevels);
if(accessoryAmmo) ReadAccessoryAmmo(accessoryAmmo);
m_sharedparams->SetValid(true);
return true;
}
示例8: RaiseError
void CCommandLineParser::ProcessSwitch(const char* switch_str)
{
const s_arg_entry* s;
if (!FindArgument(switch_str, true, &s))
RaiseError("unknown switch");
CArgEntity entity(s->id);
#ifdef CP_IGNORE_REST
// special case: if we get the forward switch stop processing
// everything and treat it as a single command.
if (s->id == kIgnoreRest) {
char* arg_str;
while (ReadString(&arg_str)) entity.Add(arg_str);
} else ReadParams(s, entity);
#else
ReadParams(s, entity);
#endif
switches.insert(std::pair<e_arg_ids, CArgEntity>(entity.id, entity));
}
示例9: f_stream
void cController::ReadParams(const std::string& file)
{
if (file != "")
{
std::ifstream f_stream(file);
if (f_stream.is_open())
{
ReadParams(f_stream);
}
f_stream.close();
}
}
示例10: HandleRBACPermListCommand
static bool HandleRBACPermListCommand(ChatHandler* handler, char const* args)
{
RBACCommandData* command = ReadParams(handler, args, false);
if (!command)
{
handler->SetSentErrorMessage(true);
return false;
}
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
rbac::RBACPermissionContainer const& granted = command->rbac->GetGrantedPermissions();
if (granted.empty())
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
else
{
for (rbac::RBACPermissionContainer::const_iterator itr = granted.begin(); itr != granted.end(); ++itr)
{
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
}
}
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
rbac::RBACPermissionContainer const& denied = command->rbac->GetDeniedPermissions();
if (denied.empty())
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
else
{
for (rbac::RBACPermissionContainer::const_iterator itr = denied.begin(); itr != denied.end(); ++itr)
{
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
}
}
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_BY_SEC_LEVEL, command->rbac->GetId(), command->rbac->GetName().c_str(), command->rbac->GetSecurityLevel());
rbac::RBACPermissionContainer const& defaultPermissions = sAccountMgr->GetRBACDefaultPermissions(command->rbac->GetSecurityLevel());
if (defaultPermissions.empty())
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
else
{
for (rbac::RBACPermissionContainer::const_iterator itr = defaultPermissions.begin(); itr != defaultPermissions.end(); ++itr)
{
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
}
}
delete command;
return true;
}
示例11: GetFocus
BOOL CWAdvDlg::PreTranslateMessage(MSG* pMsg)
{
if((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_RETURN)){
CWnd* ppp = GetFocus();
if(GetDlgItem(IDOK) != ppp) {
ReadParams();
m_ctrlOK.SetFocus();
return true;
}
}
return CDialog::PreTranslateMessage(pMsg);
}
示例12: GetFocus
BOOL CWingScaleDlg::PreTranslateMessage(MSG* pMsg)
{
CWnd* pWnd = GetFocus();
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN){
if(GetDlgItem(IDCANCEL) != pWnd && GetDlgItem(IDOK) != pWnd) {
ReadParams();
m_ctrlOK.SetFocus();
}
else if(GetDlgItem(IDOK) == pWnd ) OnOK();
else if(GetDlgItem(IDCANCEL) == pWnd ) OnCancel();
return true;
}
return CDialog::PreTranslateMessage(pMsg);
}
示例13: main
int main( int argc, char* argv[] )
{
gArgs.SetCmdLine( argc, argv );
ReadParams();
ChannelLoop();
for( int i = 0; i < 4; ++i )
RasterFree( ffras[i] );
fprintf( flog, "\n" );
fclose( flog );
return 0;
}
示例14: HandleRBACPermListCommand
static bool HandleRBACPermListCommand(ChatHandler* handler, char const* args)
{
RBACCommandData* command = ReadParams(handler, args, false);
if (!command)
{
handler->SetSentErrorMessage(true);
return false;
}
handler->PSendSysMessage(LANG_RBAC_PERM_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
RBACPermissionContainer const& granted = command->rbac->GetGrantedPermissions();
if (!granted.any())
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
else
{
for (uint32 i = 0; i < RBAC_PERM_MAX; ++i)
if (granted.test(i))
{
RBACPermission const* permission = sAccountMgr->GetRBACPermission(i);
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
}
}
handler->PSendSysMessage(LANG_RBAC_PERM_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
RBACPermissionContainer const& denied = command->rbac->GetDeniedPermissions();
if (!denied.any())
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
else
{
for (uint32 i = 0; i < RBAC_PERM_MAX; ++i)
if (denied.test(i))
{
RBACPermission const* permission = sAccountMgr->GetRBACPermission(i);
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
}
}
delete command;
return true;
}
示例15: VERIFY
BOOL CDsnPage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// TODO: Add extra initialization here
// ODBC-Data-Sources lesen
CWaitCursor wc;
CString strCaption;
VERIFY (strCaption.LoadString (IDS_USER_DSN_CAPT));
m_dlgUserDsn.m_tType = UserDataSource;
VERIFY (0 == m_tbDsn.AddDialog (&m_dlgUserDsn, IDD_USER_DSN_MEDIUM, strCaption));
VERIFY (strCaption.LoadString (IDS_SYSTEM_DSN_CAPT));
m_dlgSystemDsn.m_tType = SystemDataSource;
VERIFY (1 == m_tbDsn.AddDialog (&m_dlgSystemDsn, IDD_USER_DSN_MEDIUM, strCaption));
VERIFY (strCaption.LoadString (IDS_FILE_DSN_CAPT));
m_dlgFileDsn.m_tType = FileDataSource;
VERIFY (2 == m_tbDsn.AddDialog (&m_dlgFileDsn, IDD_FILE_DSN_MEDIUM, strCaption));
m_tbDsn.SetActiveDialog (0);
// TRiAS-Namen austauschen
FakeName(GetDlgItem(IDB_DSN_ON_TRIAS));
FakeName(GetDlgItem(IDB_DSN_ON_TABLE));
#ifndef WIN32
if (!ReadParams ())
{
GetParent () -> EndDialog (IDCANCEL);
return TRUE;
}
SetControlState ();
if (!ModifyButtonsText ())
{
GetParent () -> EndDialog (IDCANCEL);
return TRUE;
}
UpdateWindow ();
PostMessage (IDM_SETFOCUS, 0, 0L);
#endif
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}