本文整理汇总了C++中wxString::AfterLast方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::AfterLast方法的具体用法?C++ wxString::AfterLast怎么用?C++ wxString::AfterLast使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::AfterLast方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareTimeString
/* compare strings that contains time periods in format 00:00:00 */
static int CompareTimeString(const wxString& first,const wxString& second) {
long dtFirst,dtSecond;
wxString hours,minutes,seconds;
long lHours,lMinutes,lSeconds;
//converting the first string to long value
hours = first.BeforeFirst(':');
seconds = first.AfterLast(':');
minutes = first.AfterFirst(':').BeforeFirst(':');
hours.ToLong(&lHours);
minutes.ToLong(&lMinutes);
seconds.ToLong(&lSeconds);
dtFirst = lSeconds + lMinutes * 60 + lHours * 3600;
//converting the second string
hours = second.BeforeFirst(':');
seconds = second.AfterLast(':');
minutes = second.AfterFirst(':').BeforeFirst(':');
hours.ToLong(&lHours);
minutes.ToLong(&lMinutes);
seconds.ToLong(&lSeconds);
dtSecond = lSeconds + lMinutes * 60 + lHours * 3600;
if(dtFirst < dtSecond) {
return reverseCompareOrder ? 1 : -1 ;
}
if(dtSecond < dtFirst) {
return reverseCompareOrder ? -1 : 1 ;
}
return 0;
}
示例2: SetFiles
void Thesaurus::SetFiles(wxString idxpath, const wxString datpath)
{
delete m_pT;
m_pT = NULL;
if ( wxFile::Exists(idxpath) && wxFile::Exists(datpath) )
{
m_pT = new wxThes( idxpath, datpath );
}
else
{
Manager::Get()->GetLogManager()->Log(_T("SpellChecker: Thesaurus files '") + idxpath + _T("' not found!"));
if (!wxDirExists(idxpath.BeforeLast(wxFILE_SEP_PATH)) || !wxDirExists(datpath.BeforeLast(wxFILE_SEP_PATH)))
return; // path does not exist, silence invalid directory warnings
wxString altIdx = wxFindFirstFile(idxpath.BeforeLast(wxT('.')) + wxT("*.idx"), wxFILE); // "*_v2.idx"
if (altIdx.IsEmpty()) // try again with more wildcards
{
altIdx = idxpath.AfterLast(wxFILE_SEP_PATH).BeforeLast(wxT('.')) + wxT("*.idx");
altIdx.Replace(wxT("_"), wxT("*"));
altIdx.Replace(wxT("-"), wxT("*"));
altIdx = wxFindFirstFile(idxpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altIdx, wxFILE);
}
if (altIdx.IsEmpty()) // try to find the thesaurus of a related language (something is better than nothing)
{
altIdx = idxpath.AfterLast(wxFILE_SEP_PATH);
altIdx.Replace(wxT("_"), wxT("*"));
altIdx.Replace(wxT("-"), wxT("*"));
altIdx = altIdx.BeforeLast(wxT('*')) + wxT("*.idx");
altIdx = wxFindFirstFile(idxpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altIdx, wxFILE);
}
wxString altDat = wxFindFirstFile(datpath.BeforeLast(wxT('.')) + wxT("*.dat"), wxFILE); // "*_v2.dat"
if (altDat.IsEmpty()) // try again with more wildcards
{
altDat = datpath.AfterLast(wxFILE_SEP_PATH).BeforeLast(wxT('.')) + wxT("*.dat");
altDat.Replace(wxT("_"), wxT("*"));
altDat.Replace(wxT("-"), wxT("*"));
altDat = wxFindFirstFile(datpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altDat, wxFILE);
}
if (altDat.IsEmpty()) // try to find the thesaurus of a related language (something is better than nothing)
{
altDat = datpath.AfterLast(wxFILE_SEP_PATH);
altDat.Replace(wxT("_"), wxT("*"));
altDat.Replace(wxT("-"), wxT("*"));
altDat = altDat.BeforeLast(wxT('*')) + wxT("*.dat");
altDat = wxFindFirstFile(datpath.BeforeLast(wxFILE_SEP_PATH) + wxFILE_SEP_PATH + altDat, wxFILE);
}
if (!altIdx.IsEmpty() && !altDat.IsEmpty() && wxFileExists(altIdx) && wxFileExists(altDat))
{
m_pT = new wxThes(altIdx, altDat);
Manager::Get()->GetLogManager()->Log(wxT("SpellChecker: Loading '") + altIdx + wxT("' instead..."));
}
}
}
示例3: STN_SortNameCompareFunction
//-----------------------------------------------------------------------------
// sorting function for strings, after = is the page #, don't sort by that
//-----------------------------------------------------------------------------
int wxCMPFUNC_CONV STN_SortNameCompareFunction(const wxString& first, const wxString& second)
{
int ret = wxStrcmp(first.BeforeLast(wxT('=')), second.BeforeLast(wxT('=')));
if (ret == 0)
{
// same names, keep the same order
long f = 0, s = 0;
wxCHECK_MSG(first.AfterLast(wxT('=')).ToLong(&f), 0, wxT("Invalid first page name for sorting"));
wxCHECK_MSG(second.AfterLast(wxT('=')).ToLong(&s), 0, wxT("Invalid second page name for sorting"));
ret = f > s ? 1 : -1;
}
return ret;
}
示例4: IsFileFortran
bool FortranFileExt::IsFileFortran(const wxString& filename, FortranSourceForm& fsForm)
{
if (!m_ExtDone)
{
RereadFileExtensions();
m_ExtDone = true;
}
bool isf;
wxString ext = filename.AfterLast(_T('.')).Lower();
if (m_FortranExtFree.count(ext))
{
fsForm = fsfFree;
isf = true;
}
else if (m_FortranExtFixed.count(ext))
{
fsForm = fsfFixed;
isf = true;
}
else
isf = false;
return isf;
}
示例5: AddressMatches
bool PeerID::AddressMatches(const wxString& a)
{
unsigned long porta = DEFAULT_PORT, portb = DEFAULT_PORT;
wxIPV4address addra, addrb;
if (a.Contains(":"))
{
addra.Hostname(a.BeforeLast(':'));
a.AfterLast(':').ToULong(&porta);
addra.Service(porta);
} else {
addra.Hostname(a);
addra.Service(porta);
}
if (this->address.Contains(":"))
{
addrb.Hostname(this->address.BeforeLast(':'));
this->address.AfterLast(':').ToULong(&portb);
addrb.Service(portb);
} else {
addrb.Hostname(this->address);
addrb.Service(portb);
}
return (addra.IPAddress() == addrb.IPAddress() && addra.Service() == addrb.Service());
}
示例6: discardModifier
wxString KeynameConverter::discardModifier( const wxString& keystring )
{
wxString result;
if ( keystring.EndsWith(wxT("+")) ) //handle stuff like numpad+ or ctrl++
{
wxString tmp = keystring;
result = tmp.RemoveLast().AfterLast(wxT('+')) + wxT('+');
}
else if ( keystring.StartsWith(wxT("+")) ) //handle stuff like "+ (numpad)"
{
result = keystring;
}
else
{
size_t lastAdd = keystring.find_last_of(wxT('+'));
if ( ( lastAdd != keystring.npos ) && ( keystring.GetChar(lastAdd - 1) == wxT('+') ) )
{
assert( (lastAdd > 0) && "character '+' found in unexcepted location!" );
result = keystring.substr( lastAdd );
}
else
{
result = keystring.AfterLast(wxT('+'));
}
}
return result;
}
示例7: PaxHeaderPath
wxString wxTarOutputStream::PaxHeaderPath(const wxString& format,
const wxString& path)
{
wxString d = path.BeforeLast(wxT('/'));
wxString f = path.AfterLast(wxT('/'));
wxString ret;
if (d.empty())
d = wxT(".");
ret.reserve(format.length() + path.length() + 16);
size_t begin = 0;
for (;;) {
size_t end;
end = format.find('%', begin);
if (end == wxString::npos || end + 1 >= format.length())
break;
ret << format.substr(begin, end - begin);
switch ( format[end + 1].GetValue() ) {
case 'd': ret << d; break;
case 'f': ret << f; break;
case 'p': ret << wxGetProcessId(); break;
case '%': ret << wxT("%"); break;
}
begin = end + 2;
}
ret << format.substr(begin);
return ret;
}
示例8: DoWriteString
bool wxDatabaseConfig::DoWriteString(const wxString& key, const wxString& szValue)
{
wxString name = key.AfterLast(wxCONFIG_PATH_SEPARATOR);
if (name.StartsWith(wxCONFIG_IMMUTABLE_PREFIX))
{
wxLogError("Immutable entries cannot be changed");
return false;
}
dbentries entries;
if (!FindEntries(key, entries))
{
wxConfigPathChanger path(this, key);
//wxLogTrace(DBLCONF_TRACE_MASK, wxString::Format("Adding Entry '%s' = '%s' to Group '%s'", name, szValue, m_entry.path));
AddEntry(m_entry, name, &szValue);
}
else if (entries[0].isgroup)
{
wxLogError("Can't set value of a group!.");
}
else
{
//wxLogTrace(DBLCONF_TRACE_MASK, wxString::Format("Writing Entry '%s' = '%s' in Group '%s'", name, szValue, entries[0].path));
WriteEntry(entries[0], name, szValue);
}
return true;
}
示例9: Glyph
Maximas::Maximas( const wxString &filename )
: Glyph(),
m_displayType( SLICES ),
m_dataType( 16 )
{
m_fullPath = filename;
m_scalingFactor = 5.0f;
#ifdef __WXMSW__
m_name = filename.AfterLast( '\\' );
#else
m_name = filename.AfterLast( '/' );
#endif
}
示例10: exists
bool MPQFile::exists(wxString filename)
{
if( useLocalFiles ) {
wxString fn1 = wxGetCwd()+SLASH+wxT("Import")+SLASH;
wxString fn2 = fn1;
wxString fn3 = gamePath;
fn1.Append(filename);
fn2.Append(filename.AfterLast(SLASH));
fn3.Append(filename);
wxString fns[] = { fn1, fn2, fn3 };
for(size_t i=0; i<WXSIZEOF(fns); i++) {
wxString fn = fns[i];
if (wxFile::Exists(fn))
return true;
}
}
for(ArchiveSet::iterator i=gOpenArchives.begin(); i!=gOpenArchives.end();++i)
{
HANDLE &mpq_a = *i->second;
#ifndef _MINGW
if( SFileHasFile( mpq_a, filename.fn_str() ) )
#else
if( SFileHasFile( mpq_a, filename.char_str() ) )
#endif
return true;
}
return false;
}
示例11: SetComponentToPlot
//-----------------------------------------------------------------------------
void PlotCanvasFeatureVsTime::SetComponentToPlot( mvIMPACT::acquire::Component comp, const wxString& fullPath /* = wxEmptyString */ )
//-----------------------------------------------------------------------------
{
wxCriticalSectionLocker locker( m_critSect );
m_SelectedComponent = comp;
m_PlotIdentifiers[0] = fullPath.AfterLast( wxT( '.' ) );
if( comp.isValid() )
{
const TComponentType type = comp.type();
switch( type )
{
case ctPropFloat:
case ctPropInt:
case ctPropInt64:
m_dataType = type;
break;
default:
// we don't support other component types for this feature
break;
}
}
else
{
m_dataType = ctPropInt64;
}
ClearCache();
}
示例12: getArchive
wxString MPQFile::getArchive(wxString filename)
{
if( useLocalFiles ) {
wxString fn1 = wxGetCwd()+SLASH+wxT("Import")+SLASH;
wxString fn2 = fn1;
wxString fn3 = gamePath;
fn1.Append(filename);
fn2.Append(filename.AfterLast(SLASH));
fn3.Append(filename);
wxString fns[] = { fn1, fn2, fn3 };
for(size_t i=0; i<WXSIZEOF(fns); i++) {
wxString fn = fns[i];
if (wxFile::Exists(fn)) {
return fn;
}
}
}
for(ArchiveSet::iterator i=gOpenArchives.begin(); i!=gOpenArchives.end();++i)
{
HANDLE &mpq_a = *i->second;
HANDLE fh;
#ifndef _MINGW
if( !SFileOpenFileEx( mpq_a, filename.fn_str(), SFILE_OPEN_PATCHED_FILE, &fh ) )
#else
if( !SFileOpenFileEx( mpq_a, filename.char_str(), SFILE_OPEN_PATCHED_FILE, &fh ) )
#endif
continue;
return i->first;
}
return wxT("unknown");
}
示例13: AppendExtension
wxString wxFileDialogBase::AppendExtension(const wxString &filePath,
const wxString &extensionList)
{
// strip off path, to avoid problems with "path.bar/foo"
wxString fileName = filePath.AfterLast(wxFILE_SEP_PATH);
// if fileName is of form "foo.bar" it's ok, return it
int idx_dot = fileName.Find(wxT('.'), true);
if ((idx_dot != wxNOT_FOUND) && (idx_dot < (int)fileName.length() - 1))
return filePath;
// get the first extension from extensionList, or all of it
wxString ext = extensionList.BeforeFirst(wxT(';'));
// if ext == "foo" or "foo." there's no extension
int idx_ext_dot = ext.Find(wxT('.'), true);
if ((idx_ext_dot == wxNOT_FOUND) || (idx_ext_dot == (int)ext.length() - 1))
return filePath;
else
ext = ext.AfterLast(wxT('.'));
// if ext == "*" or "bar*" or "b?r" or " " then its not valid
if ((ext.Find(wxT('*')) != wxNOT_FOUND) ||
(ext.Find(wxT('?')) != wxNOT_FOUND) ||
(ext.Strip(wxString::both).empty()))
return filePath;
// if fileName doesn't have a '.' then add one
if (filePath.Last() != wxT('.'))
ext = wxT(".") + ext;
return filePath + ext;
}
示例14: Describe
/*---------------------------------------------------------------------------*/
void wxSQLBook::Describe(const wxString& name)
{
wxSQLitePlusFrame* frame;
wxString base, tempname;
if (!name.IsEmpty())
{
tempname = name.AfterLast(('.'));
base = name.BeforeLast(('.'));
frame = (wxSQLitePlusFrame*)wxGetApp().GetTopWindow();
if (frame->ExistDbObject(otTableAndView, tempname, base))
{
wxDescribeDlg describeDlg(wxGetApp().GetTopWindow());
describeDlg.Describe(m_db, tempname, base);
describeDlg.ShowModal();
}
else
{
wxString msg = wxString::Format(_("Table or view \"%s\" not found."),
name.c_str());
wxMessageBox(msg, _("Error"));
}
}
}
示例15: ImportMIDI
bool ImportMIDI(wxString fName, NoteTrack * dest)
{
if (fName.Length() <= 4){
wxMessageBox( _("Could not open file ") + fName + _(": Filename too short."));
return false;
}
bool is_midi = false;
if (fName.Right(4).CmpNoCase(wxT(".mid")) == 0 || fName.Right(5).CmpNoCase(wxT(".midi")) == 0)
is_midi = true;
else if(fName.Right(4).CmpNoCase(wxT(".gro")) != 0) {
wxMessageBox( _("Could not open file ") + fName + _(": Incorrect filetype."));
return false;
}
wxFFile mf(fName, wxT("rb"));
if (!mf.IsOpened()) {
wxMessageBox( _("Could not open file ") + fName + wxT("."));
return false;
}
double offset = 0.0;
Alg_seq_ptr new_seq = new Alg_seq(fName.mb_str(), is_midi, &offset);
//Should we also check if(seq->tracks() == 0) ?
if(new_seq->get_read_error() == alg_error_open){
wxMessageBox( _("Could not open file ") + fName + wxT("."));
mf.Close();
delete new_seq;
return false;
}
dest->SetSequence(new_seq);
dest->SetOffset(offset);
wxString trackNameBase = fName.AfterLast(wxFILE_SEP_PATH).BeforeLast('.');
dest->SetName(trackNameBase);
mf.Close();
// the mean pitch should be somewhere in the middle of the display
Alg_iterator iterator(new_seq, false);
iterator.begin();
// for every event
Alg_event_ptr evt;
int note_count = 0;
int pitch_sum = 0;
while ((evt = iterator.next())) {
// if the event is a note
if (evt->get_type() == 'n') {
Alg_note_ptr note = (Alg_note_ptr) evt;
pitch_sum += (int) note->pitch;
note_count++;
}
}
int mean_pitch = (note_count > 0 ? pitch_sum / note_count : 60);
// initial track is about 27 half-steps high; if bottom note is C,
// then middle pitch class is D. Round mean_pitch to the nearest D:
int mid_pitch = ((mean_pitch - 2 + 6) / 12) * 12 + 2;
dest->SetBottomNote(mid_pitch - 14);
return true;
}