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


C++ XString::length方法代码示例

本文整理汇总了C++中XString::length方法的典型用法代码示例。如果您正苦于以下问题:C++ XString::length方法的具体用法?C++ XString::length怎么用?C++ XString::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XString的用法示例。


在下文中一共展示了XString::length方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: EndsWith

	bool EndsWith(const XString& str,const XString& substr)
	{
		if(substr.length() > str.length()) return false;
		for (XString::size_type i=str.length()-1,j=substr.length()-1;j>0;--i,--j)
		{
			if(substr[j] != str[i]) return false;
		}
		return true;
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:9,代码来源:CXString.cpp

示例2: IsEqual

	bool IsEqual(const XString& str1,const XString& str2)
	{
		if(str1.length() != str2.length()) return false;
		XString v1(str1);
		XString v2(str2);
		ToLower(v1);
		ToLower(v2);
		return v1 == v2;
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:9,代码来源:CXString.cpp

示例3: StartsWith

	bool StartsWith(const XString& str,const XString& substr)
	{
		if(substr.length() > str.length()) return false;
		for (XString::size_type i=0;i<substr.length();++i)
		{
			if(substr[i] != str[i]) return false;
		}
		return true;
	}
开发者ID:yuechuanbingzhi163,项目名称:myduilib,代码行数:9,代码来源:CXString.cpp

示例4: getFilenameWithoutPath

XString getFilenameWithoutPath(XString s)
{       
  int i = s.findRev('\\');
  if (i == -1){
    i = s.findRev('/');
  }
  s = s.right(s.length() - i - 1);
  return s; 
}
开发者ID:DamianSuess,项目名称:kbasic,代码行数:9,代码来源:main.cpp

示例5: _GetTMPName

XString TranscodeExport::_GetTMPName( const XString& fileName ) const
{
    if( !fileName.Contains(".") )
        X_THROW(("No extension in file name!"));

    if( !fileName.Contains(PATH_SLASH) )
        X_THROW(("Need full path to file for export."));

    vector<XString> parts;
    fileName.Split( PATH_SLASH, parts );

    if( parts.size() < 2 )
        X_THROW(("Invalid export path: %s",fileName.c_str()));;

    XString path;

    for( int i = 0; i < ((int)parts.size() - 1); i++ )
        path += XString::Format( "%s%s", PATH_SLASH, parts[i].c_str() );

    XString mediaFileName = parts[parts.size()-1];

    XString fileBaseName = mediaFileName.substr(0, mediaFileName.find("."));
    XString extension = mediaFileName.substr(mediaFileName.find(".")+1);

    XMD5 hash;
    hash.Update( (uint8_t*)fileBaseName.c_str(), fileBaseName.length() );
    hash.Finalize();

    XString fileBaseNameHash = hash.GetAsString();

    return XString::Format( "%s%sexport-tmp-%s.%s",
                            path.c_str(),
                            PATH_SLASH,
                            fileBaseNameHash.c_str(),
                            extension.c_str() );
}
开发者ID:MultiSight,项目名称:exporty,代码行数:36,代码来源:TranscodeExport.cpp

示例6: kbc


//.........这里部分代码省略.........
        f.close();
      }
    }

    if (my_cache){
      my_cache->setMode(bSilent, bDebug); // important, setting right file name for caching

      // sort input files so that non-cached files are at the end, otherwise IDs of classes will collide
      if (bUseCache){

        #define MAX_INPUTFILES 512

        struct inputfile {
          XString sFilename;
          int nDate;
        };
        inputfile files[MAX_INPUTFILES];

        int nCounter = 0;
        
  
        int n = 0;
        int n0 = 0;

        bool bFirst = true;
        do {
          if (nCounter >= MAX_INPUTFILES){
            nCounter = 0;
            CONSOLE printError("too many input files to compile (> 512)");
            break;
          }

          n = sFiles.find("\n", n);
          XString s = sFiles.mid(n0, n >= 0 ? n - n0 : sFiles.length());
          if (n == -1 & bFirst == false) break;

          XFileInfo k(s.ascii());
          int r = k.lastModified();

          files[nCounter].sFilename = s;
          files[nCounter].nDate = r;
          nCounter++;
          
          n0 = n + 1;
          n++;

          if (bFirst) bFirst = false;

        } while (true);

        bool bRedo = false;
        do {
          bRedo = false;

          for (int i = 0; i < nCounter; i++){

            if (i + 1 < nCounter){
              if (files[i].nDate > files[i + 1].nDate){
                inputfile file = files[i + 1];
                files[i + 1] = files[i];
                files[i] = file;

                bRedo = true;
                break;
              }
            }
开发者ID:DamianSuess,项目名称:kbasic,代码行数:67,代码来源:main.cpp

示例7: if

char *prepareSourceCode(const char *acFile, const char *acText, const XString & sFile)
{
  static XString sText;
  XString sClass = "";
  bool bReport = false;
  bool bModule = false;
  bool bClass = false;

  if (sFile.endsWith(".kbasic_form")){
    sClass = "Form";
  } else if (sFile.endsWith(".kbasic_menubar")){
    sClass = "MenuBar";
  } else if (sFile.endsWith(".kbasic_toolbar")){
    sClass = "ToolBar";
  } else if (sFile.endsWith(".kbasic_module")){
    bModule = true;
  } else if (sFile.endsWith(".kbasic_class")){
    bClass = true;
  } else if (sFile.endsWith(".kbasic_report")){
    sClass = "Report";
    bReport = true;
  }

  XString sHeader = "";

  if (bModule){
    sText = acText; sText = sText.replace("\r", "");
    if (sText.contains("\nEnd Module ", false)) return (char *) sText.ascii();
    if (sText.contains("\nEnd Module\n", false)) return (char *) sText.ascii();
    if (sText.contains("\nEnd Module'", false)) return (char *) sText.ascii();
    if (sText.contains("\nEnd Module/*", false)) return (char *) sText.ascii();
    if (sText.endsWith("End Module", false)) return (char *) sText.ascii();
    if (sText.startsWith("Module ", false)) return (char *) sText.ascii();
    if (sText.startsWith("\nModule ", false)) return (char *) sText.ascii();

    sHeader = sHeader.append("Module ");
    sHeader = sHeader.append(getFilenameWithoutPathAndExtension(acFile));
    sHeader = sHeader.append(" : ");
    
    sText = sText.prepend(sHeader);

    sText = sText.append("\nEnd Module\n");
  } else if (bClass){
    sText = acText; sText = sText.replace("\r", "");
    if (sText.contains("\nEnd Class ", false)) return (char *) sText.ascii();
    if (sText.contains("\nEnd Class\n", false)) return (char *) sText.ascii();
    if (sText.contains("\nEnd Class'", false)) return (char *) sText.ascii();
    if (sText.contains("\nEnd Class/*", false)) return (char *) sText.ascii();
    if (sText.endsWith("End Class", false)) return (char *) sText.ascii();
    if (sText.startsWith("Class ", false)) return (char *) sText.ascii();
    if (sText.startsWith("\nClass ", false)) return (char *) sText.ascii();

    sHeader = sHeader.append("Class ");
    sHeader = sHeader.append(getFilenameWithoutPathAndExtension(acFile));
    if (sFile.endsWith("myEvent.kbasic_class", false)){
      sHeader = sHeader.append(" Inherits Event ");
    }
    sHeader = sHeader.append(" : ");

    
    sText = sText.prepend(sHeader);

    sText = sText.append("\nEnd Class\n");
  } else {

    XString sFind = "\nEnd " + sClass + "\n";
    sText = acText; sText = sText.replace("\r", "");
    sText = sText.mid(sText.find(sFind) + sFind.length());
    
    sHeader = sHeader.append("Class ");
    sHeader = sHeader.append(getFilenameWithoutPathAndExtension(acFile));
    sHeader = sHeader.append(" Inherits ");
    sHeader = sHeader.append(bReport ? "Form" : sClass); // actually Report is a form
    sHeader = sHeader.append("\n");

    sText = sText.prepend(sHeader);

    XString sDefinition = "";
    

    if (sFile.endsWith(".kbasic_form")){
      sDefinition = prepareSourceCodeDefinition(acFile, acText, true);  
    } else if (sFile.endsWith(".kbasic_report")){
      sDefinition = prepareSourceCodeDefinition(acFile, acText, false);  
    }

    sText = sText.append(sDefinition);
    sText = sText.append("\nEnd Class\n");
  }

  return (char *) sText.ascii();

}
开发者ID:DamianSuess,项目名称:kbasic,代码行数:93,代码来源:main.cpp


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