本文整理汇总了C++中wxAtoi函数的典型用法代码示例。如果您正苦于以下问题:C++ wxAtoi函数的具体用法?C++ wxAtoi怎么用?C++ wxAtoi使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxAtoi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
bool Tags::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
{
if (wxStrcmp(tag, wxT("tags")) != 0)
return false;
// loop through attrs, which is a null-terminated list of
// attribute-value pairs
while(*attrs) {
const wxChar *attr = *attrs++;
const wxChar *value = *attrs++;
if (!value)
break;
if (!wxStrcmp(attr, wxT("title")))
mTitle = value;
else if (!wxStrcmp(attr, wxT("artist")))
mArtist = value;
else if (!wxStrcmp(attr, wxT("album")))
mAlbum = value;
else if (!wxStrcmp(attr, wxT("track")))
mTrackNum = wxAtoi(value);
else if (!wxStrcmp(attr, wxT("year")))
mYear = value;
else if (!wxStrcmp(attr, wxT("genre")))
mGenre = wxAtoi(value);
else if (!wxStrcmp(attr, wxT("comments")))
mComments = value;
else if (!wxStrcmp(attr, wxT("id3v2")))
mID3V2 = wxAtoi(value)?true:false;
} // while
return true;
}
示例2: type
ItemRecord::ItemRecord(wxString line)
: type(0)
{
id = wxAtoi(line.BeforeFirst(','));
line = line.AfterFirst(',');
quality = wxAtoi(line.BeforeFirst(','));
line = line.AfterFirst(',');
try {
ItemDB::Record r = itemdb.getById(id);
model = r.getInt(ItemDB::ItemDisplayInfo);
itemclass = r.getInt(ItemDB::Itemclass);
subclass = r.getInt(ItemDB::Subclass);
type = r.getInt(ItemDB::InventorySlot);
switch(r.getInt(ItemDB::Sheath)) {
case SHEATHETYPE_MAINHAND: sheath = ATT_LEFT_BACK_SHEATH; break;
case SHEATHETYPE_LARGEWEAPON: sheath = ATT_LEFT_BACK; break;
case SHEATHETYPE_HIPWEAPON: sheath = ATT_LEFT_HIP_SHEATH; break;
case SHEATHETYPE_SHIELD: sheath = ATT_MIDDLE_BACK_SHEATH; break;
default: sheath = SHEATHETYPE_NONE;
}
discovery = false;
name.Printf(wxT("%s [%d] [%d]"), line.c_str(), id, model);
} catch (ItemDB::NotFound) {}
}
示例3: FillChkListHersteller
void ArtikelEdit::FillChkListHersteller(vector< vector< wxString > > data)
{
if(data.size() > 0)
{
if(chklist_herstellerBox)
{
arr_db_list.Clear();
chklist_herstellerBox->Clear();
for(int i = 0; i < data.size(); ++i)
{
arr_db_list.Add(wxAtoi(data[i][0]));
chklist_herstellerBox->Append(data[i][1]);
if(!herstellerSelectionChanged && wxAtoi(data[i][0]) == oldHerstellerId)
{
chklist_herstellerBox->Select(i);
chklist_herstellerBox->Check(i, true);
lastSelectedItem = i;
herstellerIdArrPos = i;
}
}
}
}
}
示例4: wxAtoi
bool szHelpController::InitializeContext(const wxString& filepath)
{
if (wxFileName::FileExists(filepath))
{
m_begin_id = new map_id;
m_begin_id->next=NULL;
map_id *tmp_id = m_begin_id;
wxTextFile *map_file = new wxTextFile;
wxString tmp_str;
map_file->Open(filepath);
for (tmp_str = map_file->GetFirstLine(); !map_file->Eof(); tmp_str = map_file->GetNextLine())
{
tmp_id->id = wxAtoi(tmp_str);
tmp_id->section += tmp_str;
tmp_id->section.Remove(0,(tmp_id->section.Find(_T(" ")))+1);
tmp_id->next = new map_id;
tmp_id = tmp_id->next;
tmp_id->next=NULL;
}
tmp_id->id=wxAtoi(tmp_str);
tmp_id->section += tmp_str;
tmp_id->section.Remove(0,(tmp_id->section.Find(_T(" ")))+1);
map_file->Close();
return TRUE;
}
return FALSE;
}
示例5: towxstring
void PWSGridTable::RestoreSettings(void) const
{
wxString colShown = towxstring(PWSprefs::GetInstance()->GetPref(PWSprefs::ListColumns));
wxString colWidths = towxstring(PWSprefs::GetInstance()->GetPref(PWSprefs::ColumnWidths));
wxArrayString colShownArray = wxStringTokenize(colShown, wxT(" \r\n\t,"), wxTOKEN_STRTOK);
wxArrayString colWidthArray = wxStringTokenize(colWidths, wxT(" \r\n\t,"), wxTOKEN_STRTOK);
if (colShownArray.Count() != colWidthArray.Count() || colShownArray.Count() == 0)
return;
//turn off all the columns first
for(size_t n = 0; n < WXSIZEOF(PWSGridCellData); ++n) {
PWSGridCellData[n].visible = false;
}
//now turn on the selected columns
for( size_t idx = 0; idx < colShownArray.Count(); ++idx) {
const int fieldType = wxAtoi(colShownArray[idx]);
const int fieldWidth = wxAtoi(colWidthArray[idx]);
for(size_t n = 0; n < WXSIZEOF(PWSGridCellData); ++n) {
if (PWSGridCellData[n].ft == fieldType) {
PWSGridCellData[n].visible = true;
PWSGridCellData[n].width = fieldWidth;
PWSGridCellData[n].position = idx;
break;
}
}
}
}
示例6: wxCHECK
/// Updates the contents of the FontSetting object using a delimited string containing the font settings
/// @param string Comma delimited string containing the font settings (FaceName,PointSize,Weight,Italic(T/F),Underline(T/F),StrikeOut(T/F),Color)
/// @return success or failure
bool FontSetting::SetFontSettingFromString(const wxChar* string)
{
//------Last Checked------//
// - Dec 6, 2004
wxCHECK(string != NULL, false);
wxString temp;
// Extract the face name
wxExtractSubString(temp, string, 0, wxT(','));
temp.Trim(false);
temp.Trim();
m_faceName = temp;
if (m_faceName.IsEmpty())
m_faceName = DEFAULT_FACENAME;
// Extract the point size
wxExtractSubString(temp, string, 1, wxT(','));
temp.Trim(false);
temp.Trim();
m_pointSize = wxAtoi(temp);
if (m_pointSize == 0)
m_pointSize = DEFAULT_POINTSIZE;
// Extract the weight
wxExtractSubString(temp, string, 2, wxT(','));
temp.Trim(false);
temp.Trim();
m_weight = wxAtoi(temp);
if ((m_weight % 100) != 0)
m_weight = DEFAULT_WEIGHT;
// Extract the italic setting
wxExtractSubString(temp, string, 3, wxT(','));
temp.Trim(false);
temp.Trim();
m_italic = (wxByte)((::wxStricmp(temp, wxT("T")) == 0) ? true : false);
// Extract the underline setting
wxExtractSubString(temp, string, 4, wxT(','));
temp.Trim(false);
temp.Trim();
m_underline = (wxByte)((::wxStricmp(temp, wxT("T")) == 0) ? true : false);
// Extract the strikeout setting
wxExtractSubString(temp, string, 5, wxT(','));
temp.Trim(false);
temp.Trim();
m_strikeOut = (wxByte)((::wxStricmp(temp, wxT("T")) == 0) ? true : false);
// Extract the color
wxExtractSubString(temp, string, 6, wxT(','));
temp.Trim(false);
temp.Trim();
wxUint32 color = wxAtoi(temp);
m_color = wxColor(LOBYTE(LOWORD(color)), HIBYTE(LOWORD(color)), LOBYTE(HIWORD(color)));
return (true);
}
示例7: bHasChanges
wxGISAcceleratorTable::wxGISAcceleratorTable(wxGISApplicationBase* pApp) : bHasChanges(true)
{
m_AccelEntryArray.reserve(20);
wxGISAppConfig oConfig = GetConfig();
if(!oConfig.IsOk())
return;
wxXmlNode* pAcceleratorsNodeCU = oConfig.GetConfigNode(enumGISHKCU, pApp->GetAppName() + wxString(wxT("/accelerators")));
wxXmlNode* pAcceleratorsNodeLM = oConfig.GetConfigNode(enumGISHKLM, pApp->GetAppName() + wxString(wxT("/accelerators")));
//merge two tables
m_pApp = pApp;
if(!pApp)
return;
//TODO: merge acc tables
//TODO: if user delete key - it must be mark as deleted to avoid adding it fron LM table
if(pAcceleratorsNodeCU)
{
wxXmlNode *child = pAcceleratorsNodeCU->GetChildren();
while(child)
{
wxString sCmdName = child->GetAttribute(wxT("cmd_name"), NON);
unsigned char nSubtype = wxAtoi(child->GetAttribute(wxT("subtype"), wxT("0")));
wxGISCommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
if(pCmd)
{
wxString sFlags = child->GetAttribute(wxT("flags"), wxT("NORMAL"));
wxDword Flags = GetFlags(sFlags);
wxString sKey = child->GetAttribute(wxT("keycode"), wxT("A"));
int nKey = GetKeyCode(sKey);
Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetId()));
}
child = child->GetNext();
}
}
if(pAcceleratorsNodeLM)
{
wxXmlNode *child = pAcceleratorsNodeLM->GetChildren();
while(child)
{
wxString sCmdName = child->GetAttribute(wxT("cmd_name"), NON);
unsigned char nSubtype = wxAtoi(child->GetAttribute(wxT("subtype"), wxT("0")));
wxGISCommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
if(pCmd)
{
wxString sFlags = child->GetAttribute(wxT("flags"), wxT("NORMAL"));
wxDword Flags = GetFlags(sFlags);
wxString sKey = child->GetAttribute(wxT("keycode"), wxT("A"));
int nKey = GetKeyCode(sKey);
Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetId()));
}
child = child->GetNext();
}
}
}
示例8: wxAtoi
int wxSystemOptions::GetOptionInt(const wxString& name)
{
#ifdef _PACC_VER
// work around the PalmOS pacc compiler bug
return wxAtoi (GetOption(name).data());
#else
return wxAtoi (GetOption(name));
#endif
}
示例9: tokenizer
void ViewerWindow::onStatsTimer(wxTimerEvent& event)
{
if(canvas && canvas->conn)
{
VNCConn* c = canvas->conn;
text_ctrl_updrawbytes->Clear();
text_ctrl_updcount->Clear();
text_ctrl_latency->Clear();
text_ctrl_lossratio->Clear();
if(!c->isMulticast())
{
label_lossratio->Show(false);
text_ctrl_lossratio->Show(false);
label_recvbuf->Show(false);
gauge_recvbuf->Show(false);
}
else
{
label_lossratio->Show(true);
text_ctrl_lossratio->Show(true);
label_recvbuf->Show(true);
gauge_recvbuf->Show(true);
}
stats_container->Layout();
if( ! c->getStats().IsEmpty() )
{
// it is imperative here to obey the format of the sample string!
wxStringTokenizer tokenizer(c->getStats().Last(), wxT(","));
tokenizer.GetNextToken(); // skip UTC time
tokenizer.GetNextToken(); // skip conn time
tokenizer.GetNextToken(); // skip rcvd bytes
*text_ctrl_updrawbytes << wxAtoi(tokenizer.GetNextToken())/1024; // inflated bytes
*text_ctrl_updcount << tokenizer.GetNextToken();
int latency = wxAtoi(tokenizer.GetNextToken());
if(latency >= 0)
*text_ctrl_latency << latency;
double lossratio = c->getMCLossRatio();
if(lossratio >= 0) // can be -1 if nothing to measure
*text_ctrl_lossratio << lossratio;
}
gauge_recvbuf->SetRange(c->getMCBufSize());
gauge_recvbuf->SetValue(c->getMCBufFill());
// flash red when buffer full
if(gauge_recvbuf->GetRange() == gauge_recvbuf->GetValue())
label_recvbuf->SetForegroundColour(*wxRED);
else
label_recvbuf->SetForegroundColour(dflt_fg);
}
}
示例10: wxSplit
// return true if version string is older than compare string
bool RenderableEffect::IsVersionOlder(const std::string& compare, const std::string& version)
{
wxArrayString compare_parts = wxSplit(compare, '.');
wxArrayString version_parts = wxSplit(version, '.');
if( wxAtoi(version_parts[0]) < wxAtoi(compare_parts[0]) ) return true;
if( wxAtoi(version_parts[0]) > wxAtoi(compare_parts[0]) ) return false;
if( wxAtoi(version_parts[1]) < wxAtoi(compare_parts[1]) ) return true;
if( wxAtoi(version_parts[1]) > wxAtoi(compare_parts[1]) ) return false;
if( wxAtoi(version_parts[2]) < wxAtoi(compare_parts[2]) ) return true;
return false;
}
示例11: RenderPiano
void PianoEffect::Render(Effect *effect, const SettingsMap &SettingsMap, RenderBuffer &buffer) {
RenderPiano(buffer,
SettingsMap["CHOICE_Piano_Style"],
wxAtoi(SettingsMap["SLIDER_Piano_NumKeys"]),
wxAtoi(SettingsMap["SLIDER_Piano_NumRows"]),
SettingsMap["CHOICE_Piano_Placement"],
SettingsMap["CHECKBOX_Piano_Clipping"] == "1",
SettingsMap["TEXTCTRL_Piano_CueFilename"],
SettingsMap["TEXTCTRL_Piano_MapFilename"],
SettingsMap["TEXTCTRL_Piano_ShapeFilename"]);
}
示例12: bHasChanges
wxGISAcceleratorTable::wxGISAcceleratorTable(IApplication* pApp, IGISConfig* pConf) : bHasChanges(true)
{
m_AccelEntryArray.reserve(20);
m_pConf = pConf;
wxXmlNode* pAcceleratorsNodeCU = m_pConf->GetConfigNode(enumGISHKCU, wxString(wxT("accelerators")));
wxXmlNode* pAcceleratorsNodeLM = m_pConf->GetConfigNode(enumGISHKLM, wxString(wxT("accelerators")));
//merge two tables
m_pApp = pApp;
if(!pApp)
return;
//merge acc tables
//if user delete key - it must be mark as deleted to avoid adding it fron LM table
if(pAcceleratorsNodeCU)
{
wxXmlNode *child = pAcceleratorsNodeCU->GetChildren();
while(child)
{
wxString sCmdName = child->GetPropVal(wxT("cmd_name"), NON);
unsigned char nSubtype = wxAtoi(child->GetPropVal(wxT("subtype"), wxT("0")));
ICommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
if(pCmd)
{
wxString sFlags = child->GetPropVal(wxT("flags"), wxT("NORMAL"));
WXDWORD Flags = GetFlags(sFlags);
wxString sKey = child->GetPropVal(wxT("keycode"), wxT("A"));
int nKey = GetKeyCode(sKey);
Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetID()));
}
child = child->GetNext();
}
}
if(pAcceleratorsNodeLM)
{
wxXmlNode *child = pAcceleratorsNodeLM->GetChildren();
while(child)
{
wxString sCmdName = child->GetPropVal(wxT("cmd_name"), NON);
unsigned char nSubtype = wxAtoi(child->GetPropVal(wxT("subtype"), wxT("0")));
ICommand* pCmd = m_pApp->GetCommand(sCmdName, nSubtype);
if(pCmd)
{
wxString sFlags = child->GetPropVal(wxT("flags"), wxT("NORMAL"));
WXDWORD Flags = GetFlags(sFlags);
wxString sKey = child->GetPropVal(wxT("keycode"), wxT("A"));
int nKey = GetKeyCode(sKey);
Add(wxAcceleratorEntry(Flags, nKey, pCmd->GetID()));
}
child = child->GetNext();
}
}
}
示例13: SeqBlock
bool Sequence::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
{
if (!wxStrcmp(tag, wxT("waveblock"))) {
SeqBlock *wb = new SeqBlock();
wb->f = 0;
wb->start = 0;
// loop through attrs, which is a null-terminated list of
// attribute-value pairs
while(*attrs) {
const wxChar *attr = *attrs++;
const wxChar *value = *attrs++;
if (!value)
break;
if (!wxStrcmp(attr, wxT("start")))
wb->start = wxAtoi(value);
// Handle length tag from legacy project file
if (!wxStrcmp(attr, wxT("len")))
mDirManager->SetLoadingBlockLength(wxAtoi(value));
} // while
mBlock->Add(wb);
mDirManager->SetLoadingTarget(&wb->f);
return true;
}
if (!wxStrcmp(tag, wxT("sequence"))) {
while(*attrs) {
const wxChar *attr = *attrs++;
const wxChar *value = *attrs++;
if (!value)
break;
if (!wxStrcmp(attr, wxT("maxsamples")))
mMaxSamples = wxAtoi(value);
else if (!wxStrcmp(attr, wxT("sampleformat")))
mSampleFormat = (sampleFormat)wxAtoi(value);
else if (!wxStrcmp(attr, wxT("numsamples")))
mNumSamples = wxAtoi(value);
} // while
return true;
}
return false;
}
示例14: while
wxHtmlImageMapAreaCell::wxHtmlImageMapAreaCell( wxHtmlImageMapAreaCell::celltype t, wxString &incoords, double pixel_scale )
{
int i;
wxString x = incoords, y;
type = t;
while ((i = x.Find( ',' )) != wxNOT_FOUND)
{
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.Left( i ).c_str())) );
x = x.Mid( i + 1 );
}
coords.Add( (int)(pixel_scale * (double)wxAtoi( x.c_str())) );
}
示例15: id
NPCRecord::NPCRecord(wxString line)
: id(0), model(0), type(0)
{
if (line.Len() <= 3)
return;
id = wxAtoi(line.BeforeFirst(','));
line = line.AfterFirst(',');
model = wxAtoi(line.BeforeFirst(','));
line = line.AfterFirst(',');
type = wxAtoi(line.BeforeFirst(','));
line = line.AfterFirst(',');
discovery = false;
name.Printf(wxT("%s [%d] [%d]"), line.c_str(), id, model);
}