本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}