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


C++ EndsWith函数代码示例

本文整理汇总了C++中EndsWith函数的典型用法代码示例。如果您正苦于以下问题:C++ EndsWith函数的具体用法?C++ EndsWith怎么用?C++ EndsWith使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: LoadFromFile

//==============================================================
// 로드
void CDIB::LoadFromFile(wstring file_name) {
	if (!FileExists(file_name)) return;
	file_name=ToUpper(file_name);	
	if (EndsWith(file_name, L".BMP")) LoadBMPFile(file_name); else
	if (EndsWith(file_name, L".PNG")) LoadPNGFile(file_name);
	if (EndsWith(file_name, L".JPG") || EndsWith(file_name, L".JPEG")) LoadJPEGFile(file_name);
}
开发者ID:codebachi,项目名称:ProjectDirectX,代码行数:9,代码来源:DIB.cpp

示例2: UriToProtocolInfo

/*
 *	Given a URI, determine it's protocolInfo.
 */
enum MR_SupportedProtocolInfo UriToProtocolInfo(const char* targetUri)
{
	enum MR_SupportedProtocolInfo protInfo;

	/*
	 *	Determine protocolInfo based on file extension.
	 *
	 *	TODO: need more robust means of determining protocolInfo.
	 */

	if (EndsWith(targetUri, ".mp3", 1) != 0)
	{
		protInfo = MR_PROTINFO_HTTP_AUDIO_MPEG;
	}
	else if (EndsWith(targetUri, ".wma", 1) != 0)
	{
		protInfo = MR_PROTINFO_HTTP_AUDIO_WMA;
	}
	else if (EndsWith(targetUri, ".mpeg", 1) != 0)
	{
		protInfo = MR_PROTINFO_HTTP_VIDEO_MPEG;
	}
	else if (EndsWith(targetUri, ".wmv", 1) != 0)
	{
		protInfo = MR_PROTINFO_HTTP_VIDEO_WMV;
	}
	else
	{
		/* just assume something http. */
		protInfo = MR_PROTINFO_HTTP_UNKNOWN;
	}

	return protInfo;
}
开发者ID:optman,项目名称:upnpstack,代码行数:37,代码来源:Emulator_Methods.c

示例3: auia_click

//*
//* ONCLICK
//*
byte auia_click(AUI_VARSP v) {
  char * fl = afbox_getselectedfile(v->hFile);
  byte dtype = afbox_dtype(v->hFile);
  
  if (((dtype == 4) || (dtype == 24)) && (fl != NULL)) {
    aui_setpath(&v->path, v->path, fl, 1);
    v->reshow = 1;
    return 0;
  } 
  else if (strstr(fl, ".zip") != NULL) {
        if (EndsWith(fl,".zip")){
          char * full_fl = NULL;
          aui_setpath(&full_fl, v->path, fl, 0);
          choose_kernel(full_fl, 1);
          free(full_fl);
          v->reshow = 1;
          return 0;
        }
  } 
  else if (strstr(fl, ".img") != NULL) {
        if (EndsWith(fl,".img")){
          char * full_fl = NULL;
          aui_setpath(&full_fl, v->path, fl, 0);
          choose_kernel(full_fl,0);
          free(full_fl);
          v->reshow = 1;
          return 0;
      }
  } 
  else if (fl != NULL) {
    printf("File  [%i]: %s\n", dtype, fl);
  }
  
  return 1;
}
开发者ID:Pauliecoon,项目名称:AROMA-Filemanager,代码行数:38,代码来源:aroma_handler.c

示例4: getGameReadWritePath

string getGameReadWritePath(string lookupKey) {
	string path = "";

	if(lookupKey != "") {
        std::map<string,string> &pathCache = CacheManager::getCachedItem< std::map<string,string> >(GameConstants::pathCacheLookupKey);
        std::map<string,string>::const_iterator iterFind = pathCache.find(lookupKey);
        if(iterFind != pathCache.end()) {
            path = iterFind->second;

            if(path != "" && EndsWith(path, "/") == false && EndsWith(path, "\\") == false) {
                path += "/";
            }

            //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path to be used for [%s] files [%s]\n",__FILE__,__FUNCTION__,__LINE__,lookupKey.c_str(),path.c_str());
        }
	}

    if(path == "") {
        path = safeCharPtrCopy(getenv("GLESTHOME"),8095);
        if(path != "" && EndsWith(path, "/") == false && EndsWith(path, "\\") == false) {
            path += "/";
        }

        //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path to be used for read/write files [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
    }

    return path;
}
开发者ID:MegaGlest,项目名称:megaglest-source,代码行数:28,代码来源:game_util.cpp

示例5: AddChildrenFromPath

ZipEntry *
ZipEntry::AddChildrenFromPath(zip_t *zipFile, wxMutex *mutex,
                              std::map<wxString, ZipEntry *> &entryMap,
                              const wxString &innerPath) {
  auto iter = entryMap.find(innerPath);
  if (iter != entryMap.end())
    return iter->second;

  auto path = innerPath;
  bool dir = false;
  if (path.EndsWith("/")) {
    dir = true;
    path = path.BeforeLast('/');
  }

  auto parentPath = path.BeforeLast('/');
  if (parentPath != "")
    parentPath += "/";

  auto parent = AddChildrenFromPath(zipFile, mutex, entryMap, parentPath);
  auto child = new ZipEntry(zipFile, mutex, innerPath);

  parent->AddChild(child);
  entryMap[innerPath] = child;

  return child;
}
开发者ID:tmwatchanan,项目名称:ZipPicViewWx,代码行数:27,代码来源:ZipEntry.cpp

示例6: DeleteFolderDeep

bool GatherTpp::MakeHtml(const char *folder, Gate2<int, int> progress) {
	DeleteFolderDeep(folder);
	DirectoryCreate(folder);

	for(int i = 0; i < tt.GetCount(); i++) {
		String topic = tt.GetKey(i);
		links.Add(topic, topic == indexTopic ? "index.html" :
		                 memcmp(topic, "topic://", 8) ? topic : TopicFileNameHtml(topic));
	}
	for(int i = 0; i < reflink.GetCount(); i++) {
		String l = reflink.GetKey(i);
		String lbl = Filter(l, CharFilterLbl);
		String f = links.Get(reflink[i], Null) + '#' + lbl;
		links.Add(l, f);
		static const char *x[] = { "::struct", "::class", "::union" };
		for(int ii = 0; ii < 3; ii++) {
			String e = x[ii];
			if(EndsWith(l, e)) {
				links.Add(l.Mid(0, l.GetLength() - e.GetLength()), f);
			}
		}
		labels.Add(l, lbl);
	}

	for(int i = 0; i < tt.GetCount(); i++) {
		if (progress(i+1, tt.GetCount()))
			return false;
		ExportPage(i, folder);
	}
	return true;
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:31,代码来源:GatherTpp.cpp

示例7: ShouldBypassWithEntry

static bool ShouldBypassWithEntry(URI& uri, SharedPtr<BypassEntry> entry)
{
    const std::string& uriHost = uri.getHost();
    const std::string& uriScheme = uri.getScheme();
    unsigned short uriPort = uri.getPort();
    const std::string& entryHost = entry->host;
    const std::string& entryScheme = entry->scheme;
    unsigned short entryPort = entry->port;

    GetLogger()->Debug("bypass entry: scheme='%s' host='%s' port='%i'",
                       entry->scheme.c_str(), entry->host.c_str(), entry->port);

    // An empty bypass entry equals an unconditional bypass.
    if (entry.isNull())
    {
        return true;
    }
    else
    {
        if (entryHost == "<local>" && uriHost.find(".") == string::npos)
        {
            return true;
        }
        else if (EndsWith(uriHost, entryHost) &&
                 (entryScheme.empty() || entryScheme == uriScheme) &&
                 (entryPort == 0 || entryPort == uriPort))
        {
            return true;
        }
    }

    return false;
}
开发者ID:toisoftware,项目名称:TideSDK,代码行数:33,代码来源:proxy_config.cpp

示例8: switch

bool
TrackerString::Matches(const char* string, bool caseSensitivity,
	TrackerStringExpressionType expressionType) const
{
	switch (expressionType) {
		default:
		case kNone:
			return false;

		case kStartsWith:
			return StartsWith(string, caseSensitivity);

		case kEndsWith:
			return EndsWith(string, caseSensitivity);

		case kContains:
			return Contains(string, caseSensitivity);

		case kGlobMatch:
			return MatchesGlob(string, caseSensitivity);

		case kRegexpMatch:
			return MatchesRegExp(string, caseSensitivity);
	}
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:25,代码来源:TrackerString.cpp

示例9: ILibFileDir_GetDirEntryCount

int ILibFileDir_GetDirEntryCount(const char* fullPath, char *dirDelimiter)
{
	char fn[MAX_PATH_LENGTH];
	void *dirObj;
	int retVal = 0;
	int ewDD;
	int nextFile;

	dirObj = ILibFileDir_GetDirFirstFile(fullPath, fn, MAX_PATH_LENGTH, NULL);

	if (dirObj != NULL)
	{
		ewDD = EndsWith(fullPath, dirDelimiter, 0);

		do
		{
			retVal++;
			nextFile = ILibFileDir_GetDirNextFile(dirObj,fullPath,fn,MAX_PATH_LENGTH, NULL);
		}
		while (nextFile != 0);

		ILibFileDir_CloseDir(dirObj);
	}

	return retVal;
}
开发者ID:ebichu,项目名称:dd-wrt,代码行数:26,代码来源:FileIoAbstraction.c

示例10: OpenReader

XmlReaderPtr OgreXmlSerializer::OpenReader(Assimp::IOSystem *pIOHandler, const std::string &filename)
{
    if (!EndsWith(filename, ".skeleton.xml", false))
    {
        DefaultLogger::get()->error("Imported Mesh is referencing to unsupported '" + filename + "' skeleton file.");
        return XmlReaderPtr();
    }

    if (!pIOHandler->Exists(filename))
    {
        DefaultLogger::get()->error("Failed to find skeleton file '" + filename + "' that is referenced by imported Mesh.");
        return XmlReaderPtr();
    }

    std::unique_ptr<IOStream> file(pIOHandler->Open(filename));
    if (!file.get()) {
        throw DeadlyImportError("Failed to open skeleton file " + filename);
    }

    std::unique_ptr<CIrrXML_IOStreamReader> stream(new CIrrXML_IOStreamReader(file.get()));
    XmlReaderPtr reader = XmlReaderPtr(irr::io::createIrrXMLReader(stream.get()));
    if (!reader.get()) {
        throw DeadlyImportError("Failed to create XML reader for skeleton file " + filename);
    }
    return reader;
}
开发者ID:EmilNorden,项目名称:candle,代码行数:26,代码来源:OgreXmlSerializer.cpp

示例11: while

void Data::InitFeatureMap(const string& str)
{
  string buf = str;
  string substr;
  string features = "";
  string tmp_name = "";
  size_t tmp_index = 0;

  while (!buf.empty()) {
    getNextPound(buf, substr);

    // string ending with "=" are skipped, because they are the names of the features
    if (!EndsWith(substr, "=")) {
      stringstream ss;
      ss << tmp_name << "_" << tmp_index << " ";
      features.append(ss.str());

      tmp_index++;
    } else if (substr.find("_") != string::npos) {
      // ignore sparse feature name and its value
      getNextPound(buf, substr);
    } else {                              // update current feature name
      tmp_index = 0;
      tmp_name = substr.substr(0, substr.size() - 1);
    }
  }
  m_feature_data->setFeatureMap(features);
}
开发者ID:840462307cn,项目名称:mosesdecoder,代码行数:28,代码来源:Data.cpp

示例12: loadScenarioStrings

void Lang::loadScenarioStrings(const string &scenarioDir, const string &scenarioName){
	SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scenarioDir = [%s] scenarioName = [%s]\n",__FILE__,__FUNCTION__,__LINE__,scenarioDir.c_str(),scenarioName.c_str());

	string scenarioFolder = scenarioDir + "/" + scenarioName + "/";
	string path = scenarioFolder + scenarioName + "_" + language + ".lng";
	if(EndsWith(scenarioDir, ".xml") == true) {
		scenarioFolder = extractDirectoryPathFromFile(scenarioDir);
		path = scenarioFolder + scenarioName + "_" + language + ".lng";

		SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
	}

	scenarioStrings.clear();

	//try to load the current language first
	if(fileExists(path)) {
		scenarioStrings.load(path);
	}
	else{
		SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path not found [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());

		//try english otherwise
		path = scenarioFolder + scenarioName + "_english.lng";
		SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());

		if(fileExists(path)){
			scenarioStrings.load(path);
		}
	}
}
开发者ID:log-n,项目名称:Megaglest-AI,代码行数:30,代码来源:lang.cpp

示例13: if

	bool Proxy::ShouldBypass(URI& uri)
	{
		const std::string& uriHost = uri.getHost();
		const std::string& uriScheme = uri.getScheme();
		unsigned short uriPort = uri.getPort();
		for (size_t i = 0; i < bypassList.size(); i++)
		{
			SharedURI entry = bypassList.at(i);

			// An empty bypass entry equals an unconditional bypass.
			if (entry.isNull())
			{
				return true;
			}
			else
			{
				const std::string& entryHost = entry->getHost();
				const std::string& entryScheme = entry->getScheme();
				unsigned short entryPort = entry->getPort();

				if (entryHost == "<local>" && uriHost.find(".") == string::npos)
				{
					return true;
				}
				else if (EndsWith(uriHost, entryHost) &&
					(entryScheme.empty() || entryScheme == uriScheme) &&
					(entryPort == 0 || entryPort == uriPort))
				{
					return true;
				}
			}
		}

		return false;
	}
开发者ID:jonnymind,项目名称:kroll,代码行数:35,代码来源:proxy_config.cpp

示例14: PCGetGetDirEntryCount

int PCGetGetDirEntryCount(const char* fullPath, char *dirDelimiter)
{
	char fn[MAX_PATH_LENGTH];
	void *dirObj;
	int retVal = 0;
	int ewDD;
	int nextFile;

	dirObj = PCGetDirFirstFile(fullPath, fn, MAX_PATH_LENGTH, NULL);

	if (dirObj != NULL)
	{
		ewDD = EndsWith(fullPath, dirDelimiter, 0);

		do
		{
			if (ProceedWithDirEntry(fullPath, fn, MAX_PATH_LENGTH) != 0)
			{
				retVal++;
			}

			nextFile = PCGetDirNextFile(dirObj,fullPath,fn,MAX_PATH_LENGTH, NULL);
		}
		while (nextFile != 0);

		PCCloseDir(dirObj);
	}

	return retVal;
}
开发者ID:okertanov,项目名称:Developer-Tools-for-UPnP-Technologies,代码行数:30,代码来源:PortingFunctions.c

示例15: ImportSkeleton

bool OgreXmlSerializer::ImportSkeleton(Assimp::IOSystem *pIOHandler, MeshXml *mesh)
{
    if (!mesh || mesh->skeletonRef.empty())
        return false;

    // Highly unusual to see in read world cases but support
    // XML mesh referencing a binary skeleton file.
    if (EndsWith(mesh->skeletonRef, ".skeleton", false))
    {
        if (OgreBinarySerializer::ImportSkeleton(pIOHandler, mesh))
            return true;

        /** Last fallback if .skeleton failed to be read. Try reading from
            .skeleton.xml even if the XML file referenced a binary skeleton.
            @note This logic was in the previous version and I don't want to break
            old code that might depends on it. */
        mesh->skeletonRef = mesh->skeletonRef + ".xml";
    }

    XmlReaderPtr reader = OpenReader(pIOHandler, mesh->skeletonRef);
    if (!reader.get())
        return false;

    Skeleton *skeleton = new Skeleton();
    OgreXmlSerializer serializer(reader.get());
    serializer.ReadSkeleton(skeleton);
    mesh->skeleton = skeleton;
    return true;
}
开发者ID:EmilNorden,项目名称:candle,代码行数:29,代码来源:OgreXmlSerializer.cpp


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