本文整理汇总了C++中wxString::Prepend方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::Prepend方法的具体用法?C++ wxString::Prepend怎么用?C++ wxString::Prepend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::Prepend方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddComment
void CRCppEmitter::AddComment (wxString str)
{
wxArrayString COMMENT_BREAK_CHARS;
COMMENT_BREAK_CHARS.Add (_T(" "));
COMMENT_BREAK_CHARS.Add (_T(","));
COMMENT_BREAK_CHARS.Add (_T("."));
COMMENT_BREAK_CHARS.Add (_T(":"));
COMMENT_BREAK_CHARS.Add (_T("!"));
COMMENT_BREAK_CHARS.Add (_T("?"));
wxString pre = m_tab + _T("// ");
const unsigned int MIN_CONTENT_LEN = 20;
str.Prepend (pre);
unsigned int idx;
do {
m_newFile.AddLine (this->BreakString (str, COMMENT_BREAK_CHARS, idx,
pre.Length () + MIN_CONTENT_LEN));
if (idx != 0) {
str = str.Mid (idx);
str.Prepend (pre);
}
} while (idx != 0);
// Again, flush current file status (but not finished yet):
m_newFile.Write ();
}
示例2: AddCode
void CRCppEmitter::AddCode (wxString str)
{
wxArrayString CODE_BREAK_CHARS;
CODE_BREAK_CHARS.Add (_T(" "));
CODE_BREAK_CHARS.Add (_T(","));
CODE_BREAK_CHARS.Add (_T("."));
CODE_BREAK_CHARS.Add (_T("("));
CODE_BREAK_CHARS.Add (_T("::"));
CODE_BREAK_CHARS.Add (_T("->"));
wxString pre = m_tab;
const unsigned int MIN_CONTENT_LEN = 20;
str.Prepend (pre);
bool isInString = false;
unsigned int idx;
do {
wxString line = this->BreakString (str, CODE_BREAK_CHARS, idx,
pre.Length () + MIN_CONTENT_LEN, true);
// Don't break line within string constants, use line splicing instead:
isInString = this->HasBrokenInString (line);
if (isInString) {
line.Append (_T("\""));
}
m_newFile.AddLine (line);
if (idx != 0) {
str = str.Mid (idx);
// Change string literal line splicing from appending "\" to end with
// "\"" and start next line with "\"":
if (isInString) {
str.Prepend (_T("\""));
}
for (int i = 0; i < 3; i++) {
str.Prepend (pre);
}
}
} while (idx != 0);
// Again, flush current file status (but not finished yet):
m_newFile.Write ();
}
示例3: wxAssocQueryString
// Helper wrapping AssocQueryString() Win32 function: returns the value of the
// given associated string for the specified extension (which may or not have
// the leading period).
//
// Returns empty string if the association is not found.
static
wxString wxAssocQueryString(ASSOCSTR assoc,
wxString ext,
const wxString& verb = wxString())
{
typedef HRESULT (WINAPI *AssocQueryString_t)(ASSOCF, ASSOCSTR,
LPCTSTR, LPCTSTR, LPTSTR,
DWORD *);
static AssocQueryString_t s_pfnAssocQueryString = (AssocQueryString_t)-1;
static wxDynamicLibrary s_dllShlwapi;
if ( s_pfnAssocQueryString == (AssocQueryString_t)-1 )
{
if ( !s_dllShlwapi.Load(wxT("shlwapi.dll"), wxDL_VERBATIM | wxDL_QUIET) )
s_pfnAssocQueryString = NULL;
else
wxDL_INIT_FUNC_AW(s_pfn, AssocQueryString, s_dllShlwapi);
}
if ( !s_pfnAssocQueryString )
return wxString();
DWORD dwSize = MAX_PATH;
TCHAR bufOut[MAX_PATH] = { 0 };
if ( ext.empty() || ext[0] != '.' )
ext.Prepend('.');
HRESULT hr = s_pfnAssocQueryString
(
wxASSOCF_NOTRUNCATE,// Fail if buffer is too small.
assoc, // The association to retrieve.
ext.t_str(), // The extension to retrieve it for.
verb.empty() ? NULL
: static_cast<const TCHAR*>(verb.t_str()),
bufOut, // The buffer for output value.
&dwSize // And its size
);
// Do not use SUCCEEDED() here as S_FALSE could, in principle, be returned
// but would still be an error in this context.
if ( hr != S_OK )
{
// The only really expected error here is that no association is
// defined, anything else is not expected. The confusing thing is that
// different errors are returned for this expected error under
// different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7
// returns ERROR_NO_ASSOCIATION. Just check for both to be sure.
if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) &&
hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) )
{
wxLogApiError("AssocQueryString", hr);
}
return wxString();
}
return wxString(bufOut);
}
示例4: WrapXRC
// static
void TopLevelWinWrapper::WrapXRC(wxString& text)
{
wxString prefix, sifa;
prefix << wxT("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>")
<< wxT("<resource xmlns=\"http://www.wxwidgets.org/wxxrc\">");
sifa << wxT("</resource>");
text.Prepend(prefix).Append(sifa);
}
示例5: viewODT
void Boat::viewODT( wxString path,wxString layout,bool mode )
{
if ( parent->logbookPlugIn->opt->filterLayout[LogbookDialog::BOAT] )
layout.Prepend( parent->logbookPlugIn->opt->layoutPrefix[LogbookDialog::BOAT] );
toODT( path, layout, mode );
if ( layout != _T( "" ) )
{
wxString fn = data_locn;
fn.Replace( _T( "txt" ),_T( "odt" ) );
parent->startApplication( fn,_T( ".odt" ) );
}
}
示例6: viewHTML
void Boat::viewHTML( wxString path, wxString layout, bool mode )
{
if ( parent->logbookPlugIn->opt->filterLayout[LogbookDialog::BOAT] )
layout.Prepend( parent->logbookPlugIn->opt->layoutPrefix[LogbookDialog::BOAT] );
toHTML( path, layout, mode );
if ( layout != _T( "" ) )
{
wxString fn = data_locn;
fn.Replace( _T( "txt" ),_T( "html" ) );
parent->startBrowser( fn );
}
}
示例7: Sanitise
void UsrGlblMgrEditDialog::Sanitise(wxString& s)
{
s.Trim().Trim(true);
if (s.IsEmpty())
{
s = _T("[?empty?]");
return;
}
for (unsigned int i = 0; i < s.length(); ++i)
#if wxCHECK_VERSION(3, 0, 0)
s[i] = wxIsalnum(s.GetChar(i)) ? s.GetChar(i) : wxUniChar('_');
#else
s[i] = wxIsalnum(s.GetChar(i)) ? s.GetChar(i) : _T('_');
#endif
if (s.GetChar(0) == _T('_'))
s.Prepend(_T("set"));
if (s.GetChar(0) >= _T('0') && s.GetChar(0) <= _T('9'))
s.Prepend(_T("set_"));
}
示例8: viewHTML
void OverView::viewHTML(wxString path,wxString layout,int mode)
{
wxString fn;
if(opt->filterLayout)
layout.Prepend(opt->layoutPrefix[LogbookDialog::OVERVIEW]);
fn = toHTML(path, layout, mode);
if(layout != _T(""))
{
fn.Replace(_T("txt"),_T("html"));
parent->startBrowser(fn);
}
}
示例9: viewODT
void OverView::viewODT(wxString path,wxString layout,int mode)
{
wxString fn;
if(opt->filterLayout)
layout.Prepend(opt->layoutPrefix[LogbookDialog::OVERVIEW]);
fn = toODT(path, layout, mode);
if(layout != _T(""))
{
fn.Replace(_T("txt"),_T("odt"));
parent->startApplication(fn,_T(".odt"));
}
}
示例10: OnInit
bool GenerateHelp::OnInit() {
InitializeHtmlEntities();
imayle = _T("[email protected]");
imayle += _T("ozic.net");
imayle.Prepend(_T("appe"));
wxArrayString localeCodes;
localeCodes.Add(_T("en"));
localeCodes.Add(_T("fr"));
localeCodes.Add(_T("de"));
for (int i = 0; i < localeCodes.Count(); i++) {
wxString localeCode = localeCodes[i];
const wxLanguageInfo* info = wxLocale::FindLanguageInfo(localeCode);
if (!info) {
wxLogDebug(_T("CANNOT GET LANGUAGE INFO"));
continue;
}
wxLocale locale;
locale.Init(info->Language);
locale.AddCatalogLookupPathPrefix(_T("Data/Help"));
locale.AddCatalog(_T("appetizer_help"));
wxString htmlString = GenerateHTMLString();
wxRegEx imageRegEx(_T("\\[([^\\s]+(\\.png|\\.gif|\\.jpg))\\]"), wxRE_ADVANCED);
wxRegEx urlRegEx(_T("\\[((ftp|http|https)://[^\\s]+)\\s([^\\]]+)\\]"), wxRE_ADVANCED);
wxRegEx strongRegEx(_T("\\[b\\](.*?)\\[\\/b\\]"), wxRE_ADVANCED);
wxRegEx internalUrlRegEx(_T("\\[(#[^\\s]+)\\s([^\\]]+)\\]"), wxRE_ADVANCED);
imageRegEx.ReplaceAll(&htmlString, _T("<img src='\\1'/>"));
urlRegEx.ReplaceAll(&htmlString, _T("<a href='\\1'>\\3</a>"));
strongRegEx.ReplaceAll(&htmlString, _T("<b>\\1</b>"));
internalUrlRegEx.ReplaceAll(&htmlString, _T("<a href='\\1'>\\2</a>"));
htmlString.Replace(imayle, wxString::Format(_T("<a href='mailto:%s'>%s</a>"), imayle, imayle));
WriteHelp(_T("Data/Help/") + localeCode + _T("/Appetizer.html"), htmlString);
}
return false;
}
示例11: wxAssocQueryString
// Helper wrapping AssocQueryString() Win32 function: returns the value of the
// given associated string for the specified extension (which may or not have
// the leading period).
//
// Returns empty string if the association is not found.
static
wxString wxAssocQueryString(ASSOCSTR assoc,
wxString ext,
const wxString& verb = wxString())
{
DWORD dwSize = MAX_PATH;
TCHAR bufOut[MAX_PATH] = { 0 };
if ( ext.empty() || ext[0] != '.' )
ext.Prepend('.');
HRESULT hr = ::AssocQueryString
(
wxASSOCF_NOTRUNCATE,// Fail if buffer is too small.
assoc, // The association to retrieve.
ext.t_str(), // The extension to retrieve it for.
verb.empty() ? NULL
: static_cast<const TCHAR*>(verb.t_str()),
bufOut, // The buffer for output value.
&dwSize // And its size
);
// Do not use SUCCEEDED() here as S_FALSE could, in principle, be returned
// but would still be an error in this context.
if ( hr != S_OK )
{
// The only really expected error here is that no association is
// defined, anything else is not expected. The confusing thing is that
// different errors are returned for this expected error under
// different Windows versions: XP returns ERROR_FILE_NOT_FOUND while 7
// returns ERROR_NO_ASSOCIATION. Just check for both to be sure.
if ( hr != HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION) &&
hr != HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) )
{
wxLogApiError("AssocQueryString", hr);
}
return wxString();
}
return wxString(bufOut);
}
示例12: CreateFilter
wxString CreateFilter(wxString s)
{
wxString Result;
size_t i;
if (s.IsEmpty())
return wxT("");
s.Prepend(wxT("*"));
// Uppercase
s = s.Upper();
// Replace whitespace with kleene stars for better matching
s.Replace(wxT(' '), wxT('*'));
s += wxT("*");
return s;
}
示例13: runTest
void modeltest::runTest(wxCommandEvent& event)
{
wxString cmd, cmd2, pa, ssize = "-n";
int dL, sS, nT;
wxArrayString output, errors;
string cmdstr, cmdstr2;
if(fileSelected == "")
{
wxMessageBox("Please select a file before running. \nClick on Select File button");
}
else
{
BIC = this->checkBIC->GetValue();
if(BIC == true)
{
wxTextEntryDialog* samplesize = new wxTextEntryDialog(this, "Please enter the sample size:", "", "", wxOK, wxDefaultPosition);
if (samplesize->ShowModal() == wxID_OK)
{
ssize += samplesize->GetValue();
}
}
#ifdef __WXMSW__
ofstream batchfile("m.bat");
cmd = modelP;
cmd2 = modelP;
cmd.Append("\""); cmd2.Append("\"");
#else
ofstream batchfile("m.sh");
cmd = "modeltest3.7 ";
cmd2 = "modeltest3.7 ";
#endif
if(debugL > 0)
{
cmd += " -d";
cmd2 += " -d";
dL = debugL;
pa.Printf("%d", dL);
cmd += pa;
cmd2 += pa;
}
if(alphaL > 0)
{
cmd += " -a";
cmd2 += " -a";
pa.Printf("%lf", alphaL);
cmd += pa;
cmd2 += pa;
}
if(sampleSize > 0)
{
cmd += " -n";
cmd2 += " -n";
sS = sampleSize;
pa.Printf("%d", sS);
cmd += pa;
cmd2 += pa;
}
if(numberTaxa > 0)
{
cmd += " -t";
cmd2 += " -t";
nT = numberTaxa;
pa.Printf("%d", nT);
cmd += pa;
cmd2 += pa;
}
if(BIC == true)
{
cmd2 += " -b " + ssize;
}
cmd += " < ";
cmd2 += " < ";
if(filePathSelected == "")
{
filePathSelected = fileSelected;
}
#ifdef __WXMSW__
filePathSelected.Append("\"");
filePathSelected.Prepend("\"");
cmd.Prepend("\"");
cmd2.Prepend("\"");
#endif
cmd += filePathSelected;
cmd2 += filePathSelected;
//cmd += "model.scores";
//cmd2 += "model.scores";
//wxMessageBox(cmd2);
cmdstr = cmd;
cmdstr2 = cmd2;
batchfile << cmdstr << "\n";
if(BIC == true)
{
batchfile << cmdstr2;
}
batchfile.close();
#ifdef __WXMSW__
long exec = wxExecute("m.bat", output, errors);
//.........这里部分代码省略.........
示例14: paupfile
void modeltest::runP2(wxCommandEvent& event)
{
string toinclude1 = "\nBEGIN PAUP;\nexecute \'";
string toinclude2 = "\';\nEnd;";
string toinclude3 = "\nBEGIN PAUP;\nquit warntsave=no;\nEnd;";
wxArrayString output, errors;
wxString directory;
string temp;
wxFileDialog* openFileDialog = new wxFileDialog ( this, "Select NEXUS file to test in PAUP", "", "", FILETYPES3, wxOPEN, wxDefaultPosition);
if (openFileDialog->ShowModal() == wxID_OK)
{
readBlock();
ofstream paupfile("paupfile.txt");
wxString fileP = openFileDialog->GetPath();
directory = openFileDialog->GetDirectory();
string to = toinclude1;
string to2 = "log file=\'";
to2 += fileP;
to2 += ".log\' replace;\n";
to += + fileP;
to += toinclude2;
mrbl.insert(7, to);
mrbl.insert(7+to.length()-4, to2);
mrbl.insert(mrbl.length()-1, toinclude3);
paupfile << mrbl;
paupfile.close();
#ifdef __WXMSW__
ofstream pbat("p.bat");
paupP.Prepend("\"");
paupP.Append("\"");
temp = paupP;
pbat << paupP << " paupfile.txt";
pbat.close();
#endif
this->outputText->Clear();
this->outputText->WriteText("PAUP is running on a separate process, please be patient.\n");
this->outputText->WriteText("When it finishes this display will be updated.\n");
//"C:\wxWidgets\projects\modelGUI\modeltest3.7\Modeltest3.7 folder\bin\Modeltest3.7.win.exe" < "C:\wxWidgets\projects\modelGUI\model.scores"
#ifdef __WXMSW__
long exec = wxExecute("p.bat", wxEXEC_SYNC);
#else
//long exec = wxExecute("ls", wxEXEC_SYNC);
long exec = wxExecute("paup paupfile.txt", wxEXEC_SYNC);
#endif
remove("paupfile.txt");
mrbl.clear();
this->outputText->Clear();
this->outputText->WriteText("PAUP run has finished.\nYou can save the scores file and automatically run MrModelTest.");
wxMessageDialog dialog( NULL, _T("Your scores file is ready.\nDo you want to run MrModelTest? Click Yes to start the analysis\nor No to perform other actions (do not forget to save your scores file)."),_T("Run MrModelTest??"), wxYES_DEFAULT|wxYES_NO|wxICON_QUESTION);
if(dialog.ShowModal() == wxID_YES)
{
fileSelectedMr = paupDir + "mrmodel.scores";
//fileSelected = fileP + "model.scores";
modeltest::runTestMr(event);
}
else
{
fileToSave = fileP + ".scores";
}
this->saveScoresMr->Enable(true);
}
}
示例15: replacePlaceholder
wxString LogbookHTML::replacePlaceholder(wxString html,wxString htmlHeader,int grid, int row, int col, bool mode)
{
static wxString route;
wxString s;
wxGrid* g = parent->logGrids[grid];
if(row == 0 && col == 0 && grid == 0)
route = _T("");
switch(grid)
{
case 0:
switch(col)
{
case ROUTE: if(route != replaceNewLine(g->GetCellValue(row,col),mode))
{
htmlHeader.Replace(wxT("#ROUTE#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Prepend(htmlHeader);
}
html.Replace(wxT("#LROUTE#"),g->GetColLabelValue(col));
route = replaceNewLine(g->GetCellValue(row,col),mode);
break;
case RDATE: html.Replace(wxT("#DATE#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LDATE#"),g->GetColLabelValue(col));
html.Replace(wxT("#NO.#"),wxString::Format(_T("%i"),row+1));
break;
case RTIME: html.Replace(wxT("#TIME#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LTIME#"),g->GetColLabelValue(col));
break;
case SIGN: html.Replace(wxT("#SIGN#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LSIGN#"),g->GetColLabelValue(col));
break;
case WAKE: html.Replace(wxT("#WAKE#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LWAKE#"),g->GetColLabelValue(col));
break;
case DISTANCE: html.Replace(wxT("#DISTANCE#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LDISTANCE#"),g->GetColLabelValue(col));
break;
case DTOTAL: html.Replace(wxT("#DTOTAL#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LDTOTAL#"),g->GetColLabelValue(col));
break;
case POSITION: html.Replace(wxT("#POSITION#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LPOSITION#"),g->GetColLabelValue(col));
break;
case COG: html.Replace(wxT("#COG#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LCOG#"),g->GetColLabelValue(col));
break;
case COW: html.Replace(wxT("#COW#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LCOW#"),g->GetColLabelValue(col));
break;
case SOG: html.Replace(wxT("#SOG#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LSOG#"),g->GetColLabelValue(col));
break;
case SOW: html.Replace(wxT("#SOW#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LSOW#"),g->GetColLabelValue(col));
break;
case DEPTH: html.Replace(wxT("#DEPTH#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LDEPTH#"),g->GetColLabelValue(col));
break;
case REMARKS: html.Replace(wxT("#REMARKS#"),replaceNewLine(replaceNewLine(g->GetCellValue(row,col),mode),mode));
html.Replace(wxT("#LREMARKS#"),g->GetColLabelValue(col));
break;
}
break;
case 1:
switch(col)
{
case BARO: html.Replace(wxT("#BARO#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LBARO#"),g->GetColLabelValue(col));
break;
case WIND: html.Replace(wxT("#WIND#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LWIND#"),g->GetColLabelValue(col));
break;
case WSPD: html.Replace(wxT("#WSPD#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LWSPD#"),g->GetColLabelValue(col));
break;
case CURRENT: html.Replace(wxT("#CUR#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LCUR#"),g->GetColLabelValue(col));
break;
case CSPD: html.Replace(wxT("#CSPD#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LCSPD#"),g->GetColLabelValue(col));
break;
case WAVE: html.Replace(wxT("#WAVE#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LWAVE#"),g->GetColLabelValue(col));
break;
case SWELL: html.Replace(wxT("#SWELL#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LSWELL#"),g->GetColLabelValue(col));
break;
case WEATHER: html.Replace(wxT("#WEATHER#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LWEATHER#"),g->GetColLabelValue(col));
break;
case CLOUDS: html.Replace(wxT("#CLOUDS#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LCLOUDS#"),g->GetColLabelValue(col));
break;
case VISIBILITY:html.Replace(wxT("#VISIBILITY#"),replaceNewLine(g->GetCellValue(row,col),mode));
html.Replace(wxT("#LVISIBILITY#"),g->GetColLabelValue(col));
break;
}
break;
case 2:
//.........这里部分代码省略.........