本文整理汇总了C++中FindString函数的典型用法代码示例。如果您正苦于以下问题:C++ FindString函数的具体用法?C++ FindString怎么用?C++ FindString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Determine_QM_Level
void Determine_QM_Level(char szQMLevel[])
{
char ErrorMsg[256];
if(FindString(szQMLevel, "HF") >= 0) {
QM_Level = QM_LEVEL_HF;
}
else if(FindString(szQMLevel, "MP2") >= 0) {
QM_Level = QM_LEVEL_MP2;
}
else {
sprintf(ErrorMsg, "Fail to determine the QM level.\n%s\nQuit\n", szQMLevel);
Quit_With_Error_Msg(ErrorMsg);
}
return;
}
示例2: OPT_GET
void OptionPage::OptionChoice(wxFlexGridSizer *flex, const wxString &name, const wxArrayString &choices, const char *opt_name) {
parent->AddChangeableOption(opt_name);
const auto opt = OPT_GET(opt_name);
auto cb = new wxComboBox(this, -1, wxEmptyString, wxDefaultPosition, wxDefaultSize, choices, wxCB_READONLY | wxCB_DROPDOWN);
Add(flex, name, cb);
switch (opt->GetType()) {
case agi::OptionType::Int: {
int val = opt->GetInt();
cb->Select(val < (int)choices.size() ? val : 0);
cb->Bind(wxEVT_COMBOBOX, IntCBUpdater(opt_name, parent));
break;
}
case agi::OptionType::String: {
wxString val(to_wx(opt->GetString()));
if (cb->FindString(val) != wxNOT_FOUND)
cb->SetStringSelection(val);
else if (!choices.empty())
cb->SetSelection(0);
cb->Bind(wxEVT_COMBOBOX, StringUpdater(opt_name, parent));
break;
}
default:
throw agi::InternalError("Unsupported type");
}
}
示例3: FindString
/*
** Vers. 1.1
** NEW: CopyList()
*/
void CACListWnd::CopyList()
{
m_DisplayList.Copy(m_SearchList);
m_lCount = (long)m_DisplayList.GetSize();
if(m_lCount)
FindString(0,_T(""),true);
}
示例4: To_Find_Tag
int To_Find_Tag(FILE *fIn, char szFileName[], char szTag[], char szLine[])
{
char *ReadLine, ErrorMsg[256];
while(1) {
if(feof(fIn)) {
sprintf(ErrorMsg, "Fail to find the tag: %s in file %s\nQuit\n", szTag, szFileName);
fclose(fIn);
Quit_With_Error_Msg(ErrorMsg);
}
ReadLine = fgets(szLine, 256, fIn);
if(ReadLine == NULL) {
sprintf(ErrorMsg, "Fail to find the tag: %s in file %s\nQuit\n", szTag, szFileName);
fclose(fIn);
Quit_With_Error_Msg(ErrorMsg);
}
else {
if(FindString(szLine, szTag) >= 0) {
return 1;
}
}
}
return 0;
}
示例5: FindString
bool wxBitmapComboBox::Create(wxWindow *parent,
wxWindowID id,
const wxString& value,
const wxPoint& pos,
const wxSize& size,
int n,
const wxString choices[],
long style,
const wxValidator& validator,
const wxString& name)
{
if ( !wxComboBox::Create(parent, id, value, pos, size,
n, choices, style, validator, name) )
return false;
// Select 'value' in entry-less mode
if ( !GetEntry() )
{
int i = FindString(value);
if (i != wxNOT_FOUND)
SetSelection(i);
}
return true;
}
示例6: SetStringValue
virtual void SetStringValue(const wxString& s)
{
if (s.Length() > 0)
{
// Search item index
int index = FindString(s);
// Removes item if already in combos box
if ( index != wxNOT_FOUND )
{
Delete(index);
}
// Removes last item if max nb item is reached
if ( GetCount() >= m_MaxHistoryLen)
{
// Removes last one
Delete(GetCount()-1);
}
// Adds it to combos
Insert(s, 0);
Select(0);
}
}
示例7: FindString
void FStringTable::SetString (const char *name, const char *newString)
{
StringEntry **pentry, *oentry;
FindString (name, pentry, oentry);
size_t newlen = strlen (newString);
size_t namelen = strlen (name);
// Create a new string entry
StringEntry *entry = (StringEntry *)M_Malloc (sizeof(*entry) + newlen + namelen + 2);
strcpy (entry->String, newString);
strcpy (entry->Name = entry->String + newlen + 1, name);
entry->PassNum = 0;
// If this is a new string, insert it. Otherwise, replace the old one.
if (oentry == NULL)
{
entry->Next = *pentry;
*pentry = entry;
}
else
{
*pentry = entry;
entry->Next = oentry->Next;
M_Free (oentry);
}
}
示例8: GetCurSel
LONG CSizeComboBox::GetHeight(int sel)
{
if (sel == -1)
sel = GetCurSel();
if (sel == -1)
{
TCHAR szText[20];
GetWindowText(szText, 20);
sel = FindString( -1, szText);
if (sel == CB_ERR)
{
CY cyTmp;
cyTmp.Lo = 0;
cyTmp.Hi = 0;
_AfxCyFromString(cyTmp, szText);
int PointSize = (int)((cyTmp.Lo + 5000) / 10000);
if (PointSize != 0)
return MulDiv(-afxData.cyPixelsPerInch, PointSize, 72);
else
sel = 0;
}
}
return (LONG) GetItemData(sel);
}
示例9: AddFont
int CFontComboBox::AddFont(LOGFONT *pLF, DWORD FontType)
{
int nEntry;
FONTITEM_PPG* pFontItem = NULL;
// Font already in the combobox
if (FindString(-1, (LPCTSTR) pLF->lfFaceName) != CB_ERR)
return CB_ERR;
// allocate some memory for the FONTITEM_PPG structure
TRY
{
pFontItem = new FONTITEM_PPG;
}
CATCH( CMemoryException, e )
{
return CB_ERR;
}
END_CATCH
ASSERT( pFontItem );
pFontItem->lf = *pLF;
pFontItem->dwFontType = FontType;
nEntry = AddString( (LPCTSTR) pFontItem->lf.lfFaceName );
if (nEntry == CB_ERR)
delete pFontItem;
else
SetItemData( nEntry, (DWORD) pFontItem );
return nEntry;
}
示例10:
const char*
PSettings::GetString(const char *name)
{
const char *old;
status_t s=FindString(name,&old);
return old;
}
示例11: FindString
void wxListBoxBase::SetFirstItem(const wxString& s)
{
int n = FindString(s);
wxCHECK_RET( n != wxNOT_FOUND, wxT("invalid string in wxListBox::SetFirstItem") );
DoSetFirstItem(n);
}
示例12: Lock
bool
Preferences::ReadString(BString &string, const char* name)
{
Lock();
bool loaded = FindString(name, &string) == B_OK;
Unlock();
return loaded;
}
示例13: FindStringExact
void CLocalComboBox::SetTheText(LPCTSTR lpszText,BOOL bMatchExact)
{
int idx = (bMatchExact) ? FindStringExact(-1,lpszText) :
FindString(-1, lpszText);
SetCurSel( (idx==CB_ERR) ? -1 : idx);
if (idx == CB_ERR)
SetWindowText(lpszText);
}
示例14: FindString
int ctlComboBox::GetGuessedSelection() const
{
int sel=GetCurrentSelection();
if (sel < 0)
sel = FindString(GetValue());
return sel;
}
示例15: GetHeader
DWORD CItemList::FindString(LPCTSTR pCol, LPCTSTR pStr)
{
// Get column index
DWORD i = GetHeader().FindCol( pCol );
if ( i == MAXDWORD ) return i;
return FindString( i, pStr );
}