当前位置: 首页>>代码示例>>C++>>正文


C++ wxString::EndsWith方法代码示例

本文整理汇总了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;
}
开发者ID:RyuKojiro,项目名称:kicad-source-mirror,代码行数:33,代码来源:pns_topology.cpp

示例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;
}
开发者ID:chgans,项目名称:kicad,代码行数:33,代码来源:pns_router.cpp

示例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;
}
开发者ID:blairbonnett-mirrors,项目名称:kicad,代码行数:32,代码来源:pns_diff_pair_placer.cpp

示例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;
}
开发者ID:tizbac,项目名称:springlobby,代码行数:59,代码来源:platform.cpp

示例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" ) );
}
开发者ID:Hreinnjons,项目名称:guayadeque,代码行数:9,代码来源:Utils.cpp

示例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;
	}
开发者ID:niziak,项目名称:ethernut-4.9,代码行数:8,代码来源:nutconfdoc.cpp

示例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;
}
开发者ID:cpavlina,项目名称:kicad,代码行数:56,代码来源:pns_kicad_iface.cpp

示例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();
    }
}
开发者ID:blairbonnett-mirrors,项目名称:kicad,代码行数:11,代码来源:spice_value.cpp

示例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;
    }
开发者ID:ruifig,项目名称:nutcracker,代码行数:15,代码来源:treelist.cpp

示例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;
}
开发者ID:swflb,项目名称:pgadmin3,代码行数:38,代码来源:misc.cpp

示例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;
}
开发者ID:Mailaender,项目名称:springlobby,代码行数:27,代码来源:KeynameConverter.cpp

示例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;
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:31,代码来源:htmltag.cpp

示例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;
   }
开发者ID:Gibbon1,项目名称:usbdm-eclipse-makefiles-build,代码行数:30,代码来源:mergeFiles.cpp

示例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"));
        }
    }
开发者ID:capturePointer,项目名称:codelite,代码行数:27,代码来源:macbundler.cpp

示例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();
}
开发者ID:Glought,项目名称:MultiMC4,代码行数:26,代码来源:instance.cpp


注:本文中的wxString::EndsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。