本文整理汇总了C++中COption类的典型用法代码示例。如果您正苦于以下问题:C++ COption类的具体用法?C++ COption怎么用?C++ COption使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了COption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetQuickMenu
void CWinMain::SetQuickMenu(HMENU hMenu)
{
COption clOption;
SOption& stOption = clOption.GetOpt();
struct SQuickSet
{
LPBOOL pbOption;
int nID;
} stQuickSet[] = {
{&stOption.bHighSearchOgg, IDM_QUICKSET_STD_SEARCHOGG},
{&stOption.bCreateFolder, IDM_QUICKSET_EXTRACT_CREATEFOLDER},
{&stOption.bFixOgg, IDM_QUICKSET_EXTRACT_FIXOGG},
{&stOption.bEasyDecrypt, IDM_QUICKSET_EXTRACT_EASYDECRYPT},
{&stOption.bDstPNG, IDM_QUICKSET_EXTRACT_DSTPNG},
{&stOption.bAlphaBlend, IDM_QUICKSET_EXTRACT_ALPHABLEND},
{&stOption.bSusieUse, IDM_QUICKSET_SUSIE_USE},
{&stOption.bSusieFirst, IDM_QUICKSET_SUSIE_FIRST}
};
for (int i = 0; i < ARRAYSIZE(stQuickSet); i++)
{
UINT uCheck = MF_BYCOMMAND | (*stQuickSet[i].pbOption == TRUE) ? MF_CHECKED : MF_UNCHECKED;
CheckMenuItem(hMenu, stQuickSet[i].nID, uCheck);
}
}
示例2: SaveToProfile
void CProfileOptions::SaveToProfile(IPlayerProfile* pProfile, bool online, unsigned int reason)
{
if(reason & ePR_Options)
{
if(online && gEnv->bMultiplayer)
if (pProfile == NULL)
return;
//Want to save all the options (mostly for online attributes)
std::vector<COption*>::iterator it = m_allOptions.begin();
std::vector<COption*>::iterator end = m_allOptions.end();
for(; it!=end; ++it)
{
COption *pOption = *it;
IPlayerProfile *pPrevPlayerProfile = pOption->GetPlayerProfile();
pOption->SetPlayerProfile(pProfile);
pOption->SetToProfile();
pOption->SetPlayerProfile(pPrevPlayerProfile);
}
}
}
示例3: OnConfig
void CCLLKDlg::OnConfig(void)
{
COption dlg;
dlg.m_uColNum=m_nCol-2;
dlg.m_uRowNum=m_nRow-2;
dlg.m_uKindNum=m_Kind;
dlg.m_iBlockWidth=FRONTWIDTH;
dlg.m_iBlockHeight=FRONTHEIGHT;
dlg.m_bFullScreen=m_bIsFullScreen;
dlg.m_b3DBar=m_b3DBar;
if(dlg.DoModal()==IDOK)
{
m_nCol=dlg.m_uColNum+2;
m_nRow=dlg.m_uRowNum+2;
m_Kind=dlg.m_uKindNum;
FRONTWIDTH=dlg.m_iBlockWidth;
FRONTHEIGHT=dlg.m_iBlockHeight;
m_bIsFullScreen=dlg.m_bFullScreen;
m_b3DBar=dlg.m_b3DBar;
m_iSeekX=dlg.SeekX;
m_iSeekY=dlg.SeekY;
SizeWindow();
if(dlg.m_bNeedReStart)
StartNewGame();
}
}
示例4: GetOptionByCVar
COption* CProfileOptions::GetOptionByCVar(const char* cvar) const
{
if(!cvar || !cvar[0])
return NULL;
bool returnValue = false;
std::vector<COption*>::const_iterator it = m_allOptions.begin();
std::vector<COption*>::const_iterator end = m_allOptions.end();
for(; it!=end; ++it)
{
COption* pOption = (*it);
if(pOption->GetType() == ePOT_CVar || pOption->GetType() == ePOT_SysSpec)
{
CCVarOption* pCVarOption = static_cast<CCVarOption*>(pOption);
if (pCVarOption->GetCVar().compareNoCase(cvar)==0)
{
return pOption;
}
}
else if(pOption->GetType() == ePOT_ScreenResolution)
{
if(!stricmp("r_width", cvar) || !stricmp("r_height", cvar))
{
return pOption;
}
}
}
return NULL;
}
示例5: AddOption
/**
* @brief Add new option to list.
* @param [in] name Option's name.
* @param [in] defaultValue Option's initial and default value.
*/
int COptionsMgr::AddOption(const String& name, const varprop::VariantValue& defaultValue)
{
int retVal = COption::OPT_OK;
COption tmpOption;
retVal = tmpOption.Init(name, defaultValue);
if (retVal == COption::OPT_OK)
m_optionsMap[name] = tmpOption;
return retVal;
}
示例6: ClearPendingOptionValues
void CProfileOptions::ResetToDefault()
{
ClearPendingOptionValues(); // Just to be safe
std::vector<COption*>::iterator it = m_allOptions.begin();
std::vector<COption*>::const_iterator end = m_allOptions.end();
for(; it!=end; ++it)
{
COption* pOption = (*it);
if (!pOption->IsWriteToConfig())
{
pOption->ResetDefault();
}
}
}
示例7: Reset
/**
* @brief Reset option value to default.
* @param [in] name Name of the option to reset.
*/
int COptionsMgr::Reset(LPCTSTR name)
{
int retVal = OPT_OK;
OptionsMap::const_iterator found = m_optionsMap.find(name);
if (found != m_optionsMap.end())
{
COption tmpOption = found->second;
tmpOption.Reset();
m_optionsMap[name] = tmpOption;
}
else
{
retVal = OPT_NOTFOUND;
}
return retVal;
}
示例8: main
int main(int ArgI, char* ArgC[])
{
COption op;
CRec geneticmap;
for (int i = 0; i != ArgI-1; ++i)
{
if (strcmp(ArgC[i], "-interval") == 0 && i + 2 < ArgI)
{
op.minpos = atoi(ArgC[i+1]);
op.maxpos = atoi(ArgC[i+2]);
}
if (strcmp(ArgC[i], "-include-variant") == 0) op.fn0 = ArgC[i+1];
if (strcmp(ArgC[i], "-exclude-vatiant") == 0) op.fn1 = ArgC[i+1];
if (strcmp(ArgC[i], "-genetic-map") == 0) geneticmap.Init(ArgC[i+1]);
if (strcmp(ArgC[i], "-buffer") == 0) op.intv = atoi(ArgC[i+1]);
if (strcmp(ArgC[i], "-include-sample") == 0) op.GetIncludedSamples(ArgC[i+1]);
if (strcmp(ArgC[i], "-exclude-sample") == 0) op.GetExcludedSamples(ArgC[i+1]);
if (strcmp(ArgC[i], "-output") == 0) op.fnoutput = ArgC[i+1];
}
op.GetData();
CData dhap (&op);
CData dlk (&op);
for (int i = 0; i != ArgI-1; ++i)
{
if (strcmp(ArgC[i], "-hap") == 0) dhap.GetHaplotype(ArgC[i+1]);
if (strcmp(ArgC[i], "-lk") == 0) dlk.GetLK(ArgC[i+1]);
}
dhap.MatchData(dlk.GetSamples());
dhap.CM_Location(geneticmap);
dlk.CM_Location(geneticmap);
dhap.Estimate_Panel_ID(200);
CMCMC mcmc(&dhap, &op, &geneticmap, &dlk);
dlk.Output(op.GetfnOutput());
return 0;
}
示例9: GetOption
COption* CProfileOptions::GetOption(const char* option) const
{
if(!option || !option[0])
return NULL;
bool returnValue = false;
std::vector<COption*>::const_iterator it = m_allOptions.begin();
std::vector<COption*>::const_iterator end = m_allOptions.end();
for(; it!=end; ++it)
{
COption* pOption = (*it);
if (pOption->GetName().compare(option)==0)
{
return pOption;
}
}
return NULL;
}
示例10: AddOption
/**
* @brief Add new option to list.
* @param [in] name Option's name.
* @param [in] defaultValue Option's initial and default value.
*/
int COptionsMgr::AddOption(LPCTSTR name, varprop::VariantValue defaultValue)
{
int retVal = OPT_OK;
COption tmpOption;
#ifdef _DEBUG
OptionsMap::const_iterator found = m_optionsMap.find(name);
if (found != m_optionsMap.end())
_RPTF1(_CRT_WARN, "Re-adding option: %s !", name);
#endif
retVal = tmpOption.Init(name, defaultValue);
if (retVal == OPT_OK)
m_optionsMap[name] = tmpOption;
else
_RPTF1(_CRT_ERROR, "Could not add option: %s!", name);
return retVal;
}
示例11: Set
/**
* @brief Set new value for option.
* @param [in] name Option's name.
* @param [in] value Option's new value.
*/
int COptionsMgr::Set(const String& name, const varprop::VariantValue& value)
{
int retVal = COption::OPT_OK;
OptionsMap::const_iterator found = m_optionsMap.find(name);
if (found != m_optionsMap.end())
{
// Allow automatic conversion so we don't bother callsites about this!
COption tmpOption = found->second;
retVal = tmpOption.Set(value, true);
if (retVal == COption::OPT_OK)
m_optionsMap[name] = tmpOption;
}
else
{
retVal = COption::OPT_NOTFOUND;
}
return retVal;
}
示例12: SetOptionValue
void CProfileOptions::AddOrReplacePendingOption(const char* command, const char* param)
{
std::vector<SPendingOption>::iterator it = m_pendingOptions.begin();
std::vector<SPendingOption>::const_iterator end = m_pendingOptions.end();
for(; it!=end; ++it)
{
SPendingOption& option = (*it);
if(option.command.compare(command))
continue;
if(option.preview)
{
SetOptionValue(command, param);
}
if(option.original.compare(param))
{
option.param = param;
}
else
{
m_pendingOptions.erase(it);
}
return;
}
COption* pOption = GetOption(command);
if(pOption != NULL)
{
if(pOption->IsPreview())
{
m_pendingOptions.push_back(SPendingOption(command, param, GetOptionValue(command), true, pOption->IsConfirmation(), pOption->IsRequiresRestart(), pOption->IsWriteToConfig()));
SetOptionValue(command, param);
}
else
{
m_pendingOptions.push_back(SPendingOption(command, param, GetOptionValue(command), false, pOption->IsConfirmation(), pOption->IsRequiresRestart(), pOption->IsWriteToConfig()));
}
}
}
示例13: Set
/**
* @brief Set new value for option.
* @param [in] name Option's name.
* @param [in] value Option's new value.
*/
int COptionsMgr::Set(LPCTSTR name, varprop::VariantValue value)
{
int retVal = OPT_OK;
OptionsMap::const_iterator found = m_optionsMap.find(name);
if (found != m_optionsMap.end())
{
// Allow automatic conversion so we don't bother callsites about this!
COption tmpOption = found->second;
retVal = tmpOption.Set(value, true);
if (retVal == OPT_OK)
m_optionsMap[name] = tmpOption;
}
else
{
_RPTF1(_CRT_ERROR, "Could not set option: %s", name);
retVal = OPT_NOTFOUND;
}
return retVal;
}
示例14:
void CProfileOptions::CCVarSink::OnElementFound(ICVar *pCVar)
{
if (pCVar == 0)
return;
const char* name = pCVar->GetName();
const char* val = pCVar->GetString();
COption* pOption = m_pOptions->GetOptionByCVar(name);
if(!pOption)
return;
if(!pOption->IsWriteToConfig())
return;
const char* optionName = pOption->GetName().c_str();
const char* writeValue = pOption->Get().c_str();
const std::vector<SPendingOption>& pendingOptions = m_pOptions->GetPendingOptions();
std::vector<SPendingOption>::const_iterator it = pendingOptions.begin();
std::vector<SPendingOption>::const_iterator end = pendingOptions.end();
for(; it!=end; ++it)
{
const SPendingOption& option = (*it);
if(!option.writeToConfig)
continue;
if(option.command.compareNoCase(optionName))
continue;
writeValue = option.param.c_str();
break;
}
CryFixedStringT<128> format;
pOption->GetWriteToConfigString(format, pCVar, writeValue);
fputs(format.c_str(), m_pFile);
}
示例15: SetQuickMenuItem
void CWinMain::SetQuickMenuItem(int nID)
{
COption clOption;
SOption& stOption = clOption.GetOpt();
struct SQuickSet
{
LPBOOL pbOption;
int nID;
} stQuickSet[] = {
{&stOption.bHighSearchOgg, IDM_QUICKSET_STD_SEARCHOGG},
{&stOption.bCreateFolder, IDM_QUICKSET_EXTRACT_CREATEFOLDER},
{&stOption.bFixOgg, IDM_QUICKSET_EXTRACT_FIXOGG},
{&stOption.bEasyDecrypt, IDM_QUICKSET_EXTRACT_EASYDECRYPT},
{&stOption.bDstPNG, IDM_QUICKSET_EXTRACT_DSTPNG},
{&stOption.bAlphaBlend, IDM_QUICKSET_EXTRACT_ALPHABLEND},
{&stOption.bSusieUse, IDM_QUICKSET_SUSIE_USE},
{&stOption.bSusieFirst, IDM_QUICKSET_SUSIE_FIRST}
};
for (int i = 0; i < ARRAYSIZE(stQuickSet); i++)
{
if (stQuickSet[i].nID == nID)
*stQuickSet[i].pbOption ^= 1;
}
if (nID == IDM_QUICKSET_EXTRACT_DSTPNG)
{
// Extract images as PNG or BMP depending on setting
stOption.bDstBMP ^= 1;
}
else if (nID == IDM_QUICKSET_SUSIE_USE && stOption.bSusieUse == TRUE)
{
// Load Susie Plug-ins
CSusie clSusie;
clSusie.LoadSpi(stOption.SusieDir);
}
clOption.SaveIni();
}