本文整理汇总了C++中wxString::EndsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::EndsWith方法的具体用法?C++ wxString::EndsWith怎么用?C++ wxString::EndsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::EndsWith方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MatchDpSuffix
int PNS_TOPOLOGY::MatchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
{
int rv = 0;
if( aNetName.EndsWith( "+" ) )
{
aComplementNet = "-";
rv = 1;
}
else if( aNetName.EndsWith( "_P" ) )
{
aComplementNet = "_N";
rv = 1;
}
else if( aNetName.EndsWith( "-" ) )
{
aComplementNet = "+";
rv = -1;
}
else if( aNetName.EndsWith( "_N" ) )
{
aComplementNet = "_P";
rv = -1;
}
if( rv != 0 )
{
aBaseDpName = aNetName.Left( aNetName.Length() - aComplementNet.Length() );
aComplementNet = aBaseDpName + aComplementNet;
}
return rv;
}
示例2: MatchDpSuffix
int PCBNEW_PAIRING_RESOLVER::MatchDpSuffix(wxString aNetName, wxString &aComplementNet, wxString &aBaseDpName) const
{
int rv = 0;
if( aNetName.EndsWith( "+" ) )
{
aComplementNet = "-";
rv = 1;
}
else if( aNetName.EndsWith( "_P" ) )
{
aComplementNet = "_N";
rv = 1;
}
else if( aNetName.EndsWith( "-" ) )
{
aComplementNet = "+";
rv = -1;
}
else if( aNetName.EndsWith( "_N" ) )
{
aComplementNet = "_P";
rv = -1;
}
if( rv != 0 )
{
aBaseDpName = aNetName.Left( aNetName.Length() - aComplementNet.Length() );
aComplementNet = aBaseDpName + aComplementNet;
}
return rv;
}
示例3: matchDpSuffix
int PNS_DIFF_PAIR_PLACER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
{
int rv = 0;
if( aNetName.EndsWith( "+" ) )
{
aComplementNet = "-";
rv = 1;
}
else if( aNetName.EndsWith( "_P" ) )
{
aComplementNet = "_N";
rv = 1;
}
else if( aNetName.EndsWith( "-" ) )
{
aComplementNet = "+";
rv = -1;
}
else if( aNetName.EndsWith( "_N" ) )
{
aComplementNet = "_P";
rv = -1;
}
if( rv != 0 )
{
aBaseDpName = aNetName.Left( aNetName.Length() - aComplementNet.Length() );
}
return rv;
}
示例4: CopyDirWithFilebackupRename
bool CopyDirWithFilebackupRename( wxString from, wxString to, bool overwrite )
{
wxString sep = wxFileName::GetPathSeparator();
// append a slash if there is not one (for easier parsing)
// because who knows what people will pass to the function.
if ( !to.EndsWith( sep ) ) {
to += sep;
}
// for both dirs
if ( !from.EndsWith( sep ) ) {
from += sep;
}
// first make sure that the source dir exists
if(!wxDir::Exists(from)) {
wxLogError(from + _T(" does not exist. Can not copy directory.") );
return false;
}
if (!wxDirExists(to))
wxMkdir(to);
wxDir dir(from);
wxString filename;
bool bla = dir.GetFirst(&filename);
if (bla){
do {
if (wxDirExists(from + filename) )
{
wxMkdir(to + filename);
CopyDir(from + filename, to + filename, overwrite);
}
else{
//if files exists move it to backup, this way we can use this func on windows to replace 'active' files
if ( wxFileExists( to + filename ) ) {
//delete prev backup
if ( wxFileExists( to + filename + _T(".old") ) ) {
wxRemoveFile( to + filename + _T(".old") );
}
//make backup
if ( !wxRenameFile( to + filename, to + filename + _T(".old") ) ) {
wxLogError( _T("could not rename %s, copydir aborted"), (to + filename).c_str() );
return false;
}
}
//do the actual copy
if ( !wxCopyFile(from + filename, to + filename, overwrite) ) {
wxLogError( _T("could not copy %s to %s, copydir aborted"), (from + filename).c_str(), (to + filename).c_str() );
return false;
}
}
}
while (dir.GetNext(&filename) );
}
return true;
}
示例5: guIsValidImageFile
// -------------------------------------------------------------------------------- //
bool guIsValidImageFile( const wxString &filename )
{
return filename.EndsWith( wxT( ".jpg" ) ) ||
filename.EndsWith( wxT( ".jpeg" ) ) ||
filename.EndsWith( wxT( ".png" ) ) ||
filename.EndsWith( wxT( ".bmp" ) ) ||
filename.EndsWith( wxT( ".gif" ) );
}
示例6: isSCMdir
virtual bool isSCMdir(const wxString& dirname) const
{
if(dirname.EndsWith(wxString(wxT("CVS")) + wxFileName::GetPathSeparator()) ||
dirname.EndsWith(wxString(wxT(".svn")) + wxFileName::GetPathSeparator()) ) {
return true;
}
return false;
}
示例7: matchDpSuffix
int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, wxString& aBaseDpName )
{
int rv = 0;
if( aNetName.EndsWith( "+" ) )
{
aComplementNet = "-";
rv = 1;
}
else if( aNetName.EndsWith( "P" ) )
{
aComplementNet = "N";
rv = 1;
}
else if( aNetName.EndsWith( "-" ) )
{
aComplementNet = "+";
rv = -1;
}
else if( aNetName.EndsWith( "N" ) )
{
aComplementNet = "P";
rv = -1;
}
// Match P followed by 2 digits
else if( aNetName.Right( 2 ).IsNumber() && aNetName.Right( 3 ).Left( 1 ) == "P" )
{
aComplementNet = "N" + aNetName.Right( 2 );
rv = 1;
}
// Match P followed by 1 digit
else if( aNetName.Right( 1 ).IsNumber() && aNetName.Right( 2 ).Left( 1 ) == "P" )
{
aComplementNet = "N" + aNetName.Right( 1 );
rv = 1;
}
// Match N followed by 2 digits
else if( aNetName.Right( 2 ).IsNumber() && aNetName.Right( 3 ).Left( 1 ) == "N" )
{
aComplementNet = "P" + aNetName.Right( 2 );
rv = -1;
}
// Match N followed by 1 digit
else if( aNetName.Right( 1 ).IsNumber() && aNetName.Right( 2 ).Left( 1 ) == "N" )
{
aComplementNet = "P" + aNetName.Right( 1 );
rv = -1;
}
if( rv != 0 )
{
aBaseDpName = aNetName.Left( aNetName.Length() - aComplementNet.Length() );
aComplementNet = aBaseDpName + aComplementNet;
}
return rv;
}
示例8: stripZeros
void SPICE_VALUE::stripZeros( wxString& aString )
{
if ( aString.Find( ',' ) >= 0 || aString.Find( '.' ) >= 0 )
{
while( aString.EndsWith( '0' ) )
aString.RemoveLast();
if( aString.EndsWith( '.' ) || aString.EndsWith( ',' ) )
aString.RemoveLast();
}
}
示例9: GetSizeFromText
// Return the size in KiB from a string with either KiB or MiB suffix.
int GetSizeFromText(const wxString& text) const
{
wxString size;
unsigned factor = 1;
if ( text.EndsWith(" MiB", &size) )
factor = 1024;
else if ( !text.EndsWith(" KiB", &size) )
return 0;
unsigned long n = 0;
size.ToULong(&n);
return n*factor;
}
示例10: commandLineCleanOption
/**
* FUNCTION: commandLineCleanOption
* INPUTS:
* option - input string needs to be reformatted
* schemaObject - Is this an object related to schema?
* PURPOSE:
* - Fixup a (double-quoted) string for use on the command line
*/
wxString commandLineCleanOption(const wxString &option, bool schemaObject)
{
wxString tmp = option;
if (schemaObject)
{
// Replace double-quote with slash & double-quote
tmp.Replace(wxT("\""), wxT("\\\""));
}
else
{
// If required, clean the string to know the real object name
if (option.StartsWith(wxT("\"")) && option.EndsWith(wxT("\"")))
tmp = option.AfterFirst((wxChar)'"').BeforeLast((wxChar)'"');
// Replace single splash to double-splash
tmp.Replace(wxT("\\"), wxT("\\\\"));
// Replace double-quote with slash & double-quote
tmp.Replace(wxT("\""), wxT("\\\""));
// Replace double (slash & double-quote) combination to single (slash & double-quote) combination
tmp.Replace(wxT("\\\"\\\""), wxT("\\\""));
// Add the double quotes
tmp = wxT("\"") + tmp + wxT("\"");
}
return tmp;
}
示例11: 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;
}
示例12: GetParam
bool
wxHtmlTag::GetParamAsIntOrPercent(const wxString& par,
int* value,
bool& isPercent) const
{
const wxString param = GetParam(par);
if ( param.empty() )
return false;
wxString num;
if ( param.EndsWith("%", &num) )
{
isPercent = true;
}
else
{
isPercent = false;
num = param;
}
long lValue;
if ( !num.ToLong(&lValue) )
return false;
if ( lValue > INT_MAX || lValue < INT_MIN )
return false;
*value = static_cast<int>(lValue);
return true;
}
示例13: OnFile
//! @param filepath - path to file, either original or backup
//!
virtual wxDirTraverseResult OnFile(const wxString& filepath) {
wxString destinationFilepath;
wxString sourceFilepath;
// Check if the filename finishes with ".original"
// If so it's the backup else the original to restore
if (filepath.EndsWith(_(".original"), &destinationFilepath)) {
sourceFilepath = filepath;
}
else {
destinationFilepath = filepath;
sourceFilepath = filepath+_(".original");
}
cerr << "Info: Restoring \n"
<< " => " << destinationFilepath.ToAscii() <<"\n"
<< " <= " << sourceFilepath.ToAscii() << "\n";
if (!wxFileExists(sourceFilepath)) {
cerr << "Warning: No backup exists - skipping restoration\n";
return wxDIR_CONTINUE;
}
if (!wxRenameFile(sourceFilepath, destinationFilepath, true)) {
cerr << "Error: Failed to restore" << destinationFilepath.ToAscii() << "\n";
return wxDIR_STOP;
}
cerr << "Done\n";
return wxDIR_CONTINUE;
}
示例14: setImage
void setImage(wxString path)
{
m_image_path = path;
if(path.EndsWith(wxT(".icns"))) {
wxExecute(wxT("sips -s format png '") + path + wxT("' --out /tmp/tmpicon.png"), wxEXEC_SYNC);
path = wxT("/tmp/tmpicon.png");
}
m_image.LoadFile(path, wxBITMAP_TYPE_ANY);
if(m_image.IsOk()) {
if(m_image.GetWidth() > 50 or m_image.GetHeight() > 50) {
wxImage tmp = m_image.ConvertToImage();
tmp.Rescale(50, 50, wxIMAGE_QUALITY_HIGH);
m_image = wxBitmap(tmp);
}
const int w = m_image.GetWidth();
const int h = m_image.GetHeight();
SetMinSize(wxSize(w + 20, h + 20));
SetMaxSize(wxSize(w + 20, h + 20));
Refresh(); // repaint needed to see change
} else {
wxMessageBox(_("Failed to load image"));
}
}
示例15: modList
Instance::Instance(const wxString &rootDir)
: modList(this), m_running(false)
{
if (!rootDir.EndsWith("/"))
this->rootDir = wxFileName::DirName(rootDir + "/");
else
this->rootDir = wxFileName::DirName(rootDir);
config = new wxFileConfig(wxEmptyString, wxEmptyString, GetConfigPath().GetFullPath(), wxEmptyString,
wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
evtHandler = NULL;
MkDirs();
// initialize empty mod lists - they are filled later and only if requested (see apropriate Get* methods)
modList.SetDir(GetInstModsDir().GetFullPath());
mlModList.SetDir(GetMLModsDir().GetFullPath());
coreModList.SetDir(GetCoreModsDir().GetFullPath());
worldList.SetDir(GetSavesDir().GetFullPath());
tpList.SetDir(GetTexturePacksDir().GetFullPath());
modloader_list_inited = false;
coremod_list_inited = false;
jar_list_inited = false;
world_list_initialized = false;
tp_list_initialized = false;
parentModel = nullptr;
UpdateVersion();
}