本文整理汇总了C++中wxStringTokenize函数的典型用法代码示例。如果您正苦于以下问题:C++ wxStringTokenize函数的具体用法?C++ wxStringTokenize怎么用?C++ wxStringTokenize使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wxStringTokenize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reHex
void MemoryView::OnUpdate(wxCommandEvent& e)
{
static wxRegEx reHex(wxT("[0][x][0-9a-fA-F][0-9a-fA-F]"));
// extract the text memory from the text control and pass it to the debugger
wxString memory;
wxArrayString lines = wxStringTokenize(m_textCtrlMemory->GetValue(), wxT("\n"), wxTOKEN_STRTOK);
for (size_t i=0; i<lines.GetCount(); i++) {
wxString line = lines.Item(i).AfterFirst(wxT(':')).BeforeFirst(wxT(':')).Trim().Trim(false);
wxArrayString hexValues = wxStringTokenize(line, wxT(" "), wxTOKEN_STRTOK);
for (size_t y=0; y<hexValues.GetCount(); y++) {
wxString hex = hexValues.Item(y);
if (reHex.Matches( hex ) && hex.Len() == 4) {
// OK
continue;
} else {
wxMessageBox(wxString::Format(_("Invalid memory value: %s"), hex), _("CodeLite"), wxICON_WARNING|wxOK);
// update the pane to old value
ManagerST::Get()->UpdateDebuggerPane();
return;
}
}
if (line.IsEmpty() == false) {
memory << line << wxT(" ");
}
}
// set the new memory
memory = memory.Trim().Trim(false);
ManagerST::Get()->SetMemory(m_textCtrlExpression->GetValue(), GetSize(), memory);
// update the view
ManagerST::Get()->UpdateDebuggerPane();
}
示例2: 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;
}
}
}
}
示例3: wxStringTokenize
void ConnectionParams::Deserialize(wxString configStr)
{
Valid = true;
wxArrayString prms = wxStringTokenize( configStr, _T(";") );
if ( prms.Count() < 18 )
{
Valid = false;
return; //Old short format, we dump it
}
Type = (ConnectionType)wxAtoi(prms[0]);
NetProtocol = (NetworkProtocol)wxAtoi(prms[1]);
NetworkAddress = prms[2];
NetworkPort = (ConnectionType)wxAtoi(prms[3]);
Protocol = (DataProtocol)wxAtoi(prms[4]);
Port = prms[5];
Baudrate = wxAtoi(prms[6]);
Wordlen = wxAtoi(prms[7]);
Parity = (ParityType)wxAtoi(prms[8]);
Stopbits = wxAtoi(prms[9]);
RtsCts = !!wxAtoi(prms[10]);
XonXoff = !!wxAtoi(prms[11]);
EOS = (EOSType)wxAtoi(prms[12]);
ChecksumCheck = !!wxAtoi(prms[13]);
Output = !!wxAtoi(prms[14]);
InputSentenceListType = (ListType)wxAtoi(prms[15]);
InputSentenceList = wxStringTokenize(prms[16], _T(","));
OutputSentenceListType = (ListType)wxAtoi(prms[17]);
if (prms.Count() > 18) //If the list is empty, the tokenizer does not produce array item
OutputSentenceList = wxStringTokenize(prms[18], _T(","));
if (prms.Count() > 19)
Priority = wxAtoi(prms[19]);
}
示例4: wxStringTokenize
void ConnectionParams::Deserialize(const wxString &configStr)
{
Valid = true;
wxArrayString prms = wxStringTokenize( configStr, _T(";") );
if (prms.Count() < 17) {
Valid = false;
return;
}
Type = (ConnectionType)wxAtoi(prms[0]);
NetProtocol = (NetworkProtocol)wxAtoi(prms[1]);
NetworkAddress = prms[2];
NetworkPort = (ConnectionType)wxAtoi(prms[3]);
Protocol = (DataProtocol)wxAtoi(prms[4]);
Port = prms[5];
Baudrate = wxAtoi(prms[6]);
ChecksumCheck = !!wxAtoi(prms[7]);
int iotval = wxAtoi(prms[8]);
IOSelect=((iotval <= 2)?static_cast <dsPortType>(iotval):DS_TYPE_INPUT);
InputSentenceListType = (ListType)wxAtoi(prms[9]);
InputSentenceList = wxStringTokenize(prms[10], _T(","));
OutputSentenceListType = (ListType)wxAtoi(prms[11]);
OutputSentenceList = wxStringTokenize(prms[12], _T(","));
Priority = wxAtoi(prms[13]);
Garmin = !!wxAtoi(prms[14]);
GarminUpload = !!wxAtoi(prms[15]);
FurunoGP3X = !!wxAtoi(prms[16]);
bEnabled = true;
if (prms.Count() >= 18)
bEnabled = !!wxAtoi(prms[17]);
}
示例5: packageName
void Web::ParseFile(wxString whaturl)
{
if(whaturl == "/KIKU/packages.txt") {
wxString packageName(wxT("MSW"));
#if defined(__WXGTK__)
packageName = wxT("GTK");
#elif defined(__WXMAC__)
packageName = wxT("MAC");
#endif
wxArrayString lines = wxStringTokenize(m_dataRead, wxT("\n"));
for (size_t i=0; i<lines.GetCount(); i++) {
wxString line = lines.Item(i);
line = line.Trim().Trim(false);
if (line.StartsWith(wxT("#"))) {
//comment line
continue;
}
// parse the line
wxArrayString tokens = wxStringTokenize(line, wxT("|"));
if (tokens.GetCount() > 3) {
// find the entry with our package name
if (tokens.Item(0).Trim().Trim(false) == packageName) {
wxString url = tokens.Item(2).Trim().Trim(false);
wxString rev = tokens.Item(1).Trim().Trim(false);
wxString releaseNotesUrl = tokens.Item(3).Trim().Trim(false);
long currev;
long webrev(0);
// convert strings to long
wxString sCurRev(VERSION);
sCurRev.ToLong(&currev);
wxString sUrlRev(rev);
sUrlRev.ToLong(&webrev);
//wxMessageBox(rev);
if ( webrev > currev ) {
// notify the user that a new version is available
//e.SetClientData(new WebJobData(url.c_str(), releaseNotesUrl.c_str(), currev, webrev, false, m_userRequest));
wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, WEB_ID );
event.SetString(url);
wxGetApp().AddPendingEvent( event );
//m_pHandler->OnWeb(url, releaseNotesUrl, currev, webrev);
}
break;
}
}
}
}
}
示例6: GetName
wxArrayString Project::GetIncludePaths()
{
wxArrayString paths;
BuildMatrixPtr matrix = WorkspaceST::Get()->GetBuildMatrix();
if(!matrix) {
return paths;
}
wxString workspaceSelConf = matrix->GetSelectedConfigurationName();
wxString projectSelConf = matrix->GetProjectSelectedConf(workspaceSelConf, GetName());
BuildConfigPtr buildConf = WorkspaceST::Get()->GetProjBuildConf(this->GetName(), projectSelConf);
// for non custom projects, take the settings from the build configuration
if(buildConf && !buildConf->IsCustomBuild()) {
// Get the include paths and add them
wxString projectIncludePaths = buildConf->GetIncludePath();
wxArrayString projectIncludePathsArr = wxStringTokenize(projectIncludePaths, wxT(";"), wxTOKEN_STRTOK);
for(size_t i=0; i<projectIncludePathsArr.GetCount(); i++) {
wxFileName fn;
if(projectIncludePathsArr.Item(i) == wxT("..")) {
fn = wxFileName(GetFileName().GetPath(), wxT(""));
fn.RemoveLastDir();
} else if(projectIncludePathsArr.Item(i) == wxT(".")) {
fn = wxFileName(GetFileName().GetPath(), wxT(""));
} else {
fn = projectIncludePathsArr.Item(i);
if(fn.IsRelative()) {
fn.MakeAbsolute(GetFileName().GetPath());
}
}
paths.Add( fn.GetFullPath() );
}
// get the compiler options and add them
wxString projectCompileOptions = buildConf->GetCompileOptions();
wxArrayString projectCompileOptionsArr = wxStringTokenize(projectCompileOptions, wxT(";"), wxTOKEN_STRTOK);
for(size_t i=0; i<projectCompileOptionsArr.GetCount(); i++) {
wxString cmpOption (projectCompileOptionsArr.Item(i));
cmpOption.Trim().Trim(false);
// expand backticks, if the option is not a backtick the value remains
// unchanged
wxArrayString includePaths = DoBacktickToIncludePath(cmpOption);
if(includePaths.IsEmpty() == false)
paths.insert(paths.end(), includePaths.begin(), includePaths.end());
}
}
return paths;
}
示例7: sett
void ChatOptionsTab::OnApply( wxCommandEvent& /*unused*/ )
{
sett().SetChatColorNormal ( m_normal_color->GetColor() );
sett().SetChatColorBackground( m_bg_color->GetColor() );
sett().SetChatColorAction( m_action_color->GetColor() );
sett().SetChatColorHighlight( m_highlight_color->GetColor() );
sett().SetChatColorJoinPart( m_joinleave_color->GetColor() );
sett().SetChatColorNotification( m_note_color->GetColor() );
sett().SetChatColorMine( m_my_color->GetColor() );
sett().SetChatColorServer( m_server_color->GetColor() );
sett().SetChatColorClient( m_client_color->GetColor() );
sett().SetChatColorError( m_error_color->GetColor() );
sett().SetChatColorTime( m_ts_color->GetColor() );
sett().SetChatFont( m_chat_font );
sett().SetUseIrcColors( m_irc_colors->IsChecked() );
//m_ui.mw().GetChatTab().ChangeUnreadChannelColour( m_note_color->GetBackgroundColour() );
//m_ui.mw().GetChatTab().ChangeUnreadPMColour( m_note_color->GetBackgroundColour() );
sett().SetHighlightedWords( wxStringTokenize( m_highlight_words->GetValue(), _T( ";" ) ) );
sett().SetRequestAttOnHighlight( m_highlight_req->IsChecked() );
//Chat Log
sett().SetChatLogEnable( m_save_logs->GetValue() );
sett().SetBroadcastEverywhere( m_broadcast_check->GetValue() );
// Behavior
#ifndef DISABLE_SOUND
sett().SetChatPMSoundNotificationEnabled( m_play_sounds->IsChecked() );
#endif
sett().SetAutoloadedChatlogLinesCount( m_num_lines->GetValue() );
}
示例8: GetItem
wxCoord
ClueListBox::OnMeasureItem(size_t n) const
{
XPuzzle::Clue clue = GetItem(n);
// Cache the wrapped clue's text if it isn't already
if (m_cachedClues.at(n).empty())
{
int maxWidth;
GetClientSize(&maxWidth, NULL);
m_cachedClues.at(n) = Wrap(this, clue.Text(),
maxWidth - m_numWidth - GetMargins().x);
}
int height = 0;
const wxArrayString lines = wxStringTokenize(m_cachedClues.at(n), _T("\n"));
for (wxArrayString::const_iterator it = lines.begin();
it != lines.end();
++it)
{
int lineHeight;
GetTextExtent(*it, NULL, &lineHeight);
height += lineHeight;
}
return height;
}
示例9: wxStringTokenize
wxXmlNode *Project::GetVirtualDir(const wxString &vdFullPath)
{
wxArrayString paths = wxStringTokenize( vdFullPath, ":", wxTOKEN_STRTOK );
// test the cache
std::map<wxString, wxXmlNode*>::iterator iter = m_vdCache.find(vdFullPath);
if(iter != m_vdCache.end()) {
return iter->second;
}
wxString filename = m_fileName.GetFullPath();
wxXmlNode *parent = m_doc.GetRoot();
for(size_t i=0; i<paths.GetCount(); ++i) {
wxString curpath = paths.Item(i);
parent = XmlUtils::FindNodeByName(parent, wxT("VirtualDirectory"), curpath);
if ( !parent ) {
m_vdCache[vdFullPath] = NULL;
return NULL;
}
}
// cache the result
m_vdCache[vdFullPath] = parent;
return parent;
}
示例10: wxStringTokenize
wxArrayString QuickDebugDlg::GetStartupCmds()
{
wxString cmds = m_textCtrlCmds->GetValue();
cmds.Trim().Trim(false);
return wxStringTokenize(cmds, wxT("\n\r"), wxTOKEN_STRTOK);
}
示例11: wxStringTokenize
void TagsOptionsDlg::Parse()
{
// Prepate list of files to work on
wxArrayString files = wxStringTokenize(m_textCtrlFilesList->GetValue(), wxT(" \t"), wxTOKEN_STRTOK);
wxArrayString searchPaths = GetCTagsSearchPaths();
wxArrayString fullpathsArr;
for(size_t i = 0; i < files.size(); i++) {
wxString file = files[i].Trim().Trim(false);
if(file.IsEmpty()) continue;
for(size_t xx = 0; xx < searchPaths.size(); xx++) {
wxString fullpath;
fullpath << searchPaths.Item(xx) << wxFileName::GetPathSeparator() << file;
wxFileName fn(fullpath);
if(fn.FileExists()) {
fullpathsArr.Add(fn.GetFullPath());
break;
}
}
}
// Clear the PreProcessor table
PPTable::Instance()->Clear();
for(size_t i = 0; i < fullpathsArr.size(); i++)
PPScan(fullpathsArr.Item(i), true);
// Open an editor and print out the results
IEditor* editor = PluginManager::Get()->NewEditor();
if(editor) {
editor->AppendText(PPTable::Instance()->Export());
CopyData();
EndModal(wxID_OK);
}
}
示例12: main
int main(int argc, char **argv)
{
//Initialize the wxWidgets library
wxInitializer initializer;
wxLog::EnableLogging(false);
//parse the input
wxCmdLineParser parser;
parser.SetCmdLine(argc, argv);
parser.SetDesc(cmdLineDesc);
if (parser.Parse() != 0) {
return -1;
}
for (size_t i=0; i< parser.GetParamCount(); i++) {
wxString argument = parser.GetParam(i);
if( !wxDir::Exists(argument) ){
argument.Replace(wxT("\\"), wxT("/"));
wxArrayString arr = wxStringTokenize(argument, wxT("/"), wxTOKEN_STRTOK);
wxString path;
for(size_t i=0; i<arr.GetCount(); i++){
path << arr.Item(i) << wxT("/");
wxMkdir(path, 0777);
}
}
}
return 0;
}
示例13: s
void SvnConsole::OnReadProcessOutput(wxCommandEvent& event)
{
ProcessEventData *ped = (ProcessEventData *)event.GetClientData();
if (ped) {
m_output.Append(ped->GetData().c_str());
}
wxString s (ped->GetData());
s.MakeLower();
if (m_currCmd.printProcessOutput)
AppendText( ped->GetData() );
static wxRegEx reUsername("username[ \t]*:", wxRE_DEFAULT|wxRE_ICASE);
wxArrayString lines = wxStringTokenize(s, wxT("\n"), wxTOKEN_STRTOK);
if( !lines.IsEmpty() && lines.Last().StartsWith(wxT("password for '")) ) {
m_output.Clear();
wxString pass = wxGetPasswordFromUser(ped->GetData(), wxT("Subversion"));
if(!pass.IsEmpty() && m_process) {
m_process->WriteToConsole(pass);
}
} else if ( !lines.IsEmpty() && reUsername.IsValid() && reUsername.Matches( lines.Last() ) ) {
// Prompt the user for "Username:"
wxString username = ::wxGetTextFromUser(ped->GetData(), "Subversion");
if ( !username.IsEmpty() && m_process ) {
m_process->Write(username + "\n");
}
}
delete ped;
}
示例14: DoMakeRegexFromPattern
wxString ChangeLogPage::DoFormatLinesToUrl(const wxString& text, const wxString& pattern, const wxString& url)
{
wxRegEx re;
DoMakeRegexFromPattern(pattern, re);
wxString tmpPat = pattern.c_str();
tmpPat.Trim().Trim(false);
if(re.IsValid() == false || tmpPat.IsEmpty()) {
return text;
}
wxArrayString lines = wxStringTokenize(text, wxT("\n"), wxTOKEN_STRTOK);
wxString out;
for(size_t i=0; i<lines.size(); i++) {
wxString line = lines.Item(i).Trim().Trim(false);
if(re.Matches(line)) {
wxString bugFrId = re.GetMatch(line, 1);
// Convert the bugFrId into URLs
wxArrayString urls = DoMakeBugFrIdToUrl(bugFrId, url);
if(urls.IsEmpty() == false) {
for(size_t y=0; y<urls.size(); y++) {
out << urls.Item(y) << wxT("\n");
}
} else {
out << line << wxT("\n");
}
} else {
out << line << wxT("\n");
}
}
return out;
}
示例15: compactMsg
wxString SvnLogHandler::Compact(const wxString& message)
{
wxString compactMsg (message);
compactMsg.Replace(wxT("\r\n"), wxT("\n"));
compactMsg.Replace(wxT("\r"), wxT("\n"));
compactMsg.Replace(wxT("\v"), wxT("\n"));
wxArrayString lines = wxStringTokenize(compactMsg, wxT("\n"), wxTOKEN_STRTOK);
compactMsg.Clear();
for(size_t i=0; i<lines.GetCount(); i++) {
wxString line = lines.Item(i);
line.Trim().Trim(false);
if(line.IsEmpty())
continue;
if(line.StartsWith(wxT("----------"))) {
continue;
}
if(line == wxT("\"")) {
continue;
}
static wxRegEx reRevisionPrefix(wxT("^(r[0-9]+)"));
if(reRevisionPrefix.Matches(line)) {
continue;
}
compactMsg << line << wxT("\n");
}
if(compactMsg.IsEmpty() == false) {
compactMsg.RemoveLast();
}
return compactMsg;
}