本文整理汇总了C++中StString::isEndsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ StString::isEndsWith方法的具体用法?C++ StString::isEndsWith怎么用?C++ StString::isEndsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StString
的用法示例。
在下文中一共展示了StString::isEndsWith方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: streamNew
NPError StBrowserPlugin::streamNew(NPMIMEType ,
NPStream* theStream,
NPBool ,
uint16_t* theStreamType) {
*theStreamType = NP_ASFILEONLY;
// here we got MIME from server header (not object MIME-type!)
// because jps/pns/mpo are actually jpeg/png files - we ignore returned MIME here
//myOpenInfo.setMIME(StString(mimeString) + ST_TEXT(":*:*"));
if(myToLoadFull) {
// load full-size image only when switched to fullscreen
return NPERR_NO_ERROR;
}
// notice that some browsers (Chromium) returns NOT the same string as requested by NPNFuncs.geturl()!
// instead here we got URL with decoded Unicode characters
const StString anUrl((theStream->url != NULL) ? theStream->url : "");
if(myPreviewUrl.isEmpty()
|| anUrl.isEndsWith(myPreviewUrl)
|| anUrl.isEndsWith(myPreviewUrlUtf8)) {
return NPERR_NO_ERROR;
}
myFullUrl = anUrl;
// block wrong streams
return NPERR_INVALID_URL;
}
示例2: streamAsFile
void StBrowserPlugin::streamAsFile(NPStream* theStream,
const char* theFileName) {
if(theFileName == NULL) {
///ST_DEBUG_LOG("streamAsFile ERROR");
return;
}
const StString anUrl((theStream->url != NULL) ? theStream->url : "");
const bool isPreview = !myPreviewUrl.isEmpty()
&& (anUrl.isEndsWith(myPreviewUrl) || anUrl.isEndsWith(myPreviewUrlUtf8));
StString aFileName = StString(theFileName);
StString aFolder, aDummy;
StFileNode::getFolderAndFile(aFileName, aFolder, aDummy);
if(aFileName.isStartsWith(StProcess::getTempFolder())) {
// Some browsers (Safari) returns file copies in temporary folder
// and imidiatly remove it after function execution.
// sView load image async, so we need to copy file until it will be read.
StString aFileNameNew = aFileName + ".sView.tmp";
if(StFileNode::moveFile(aFileName, aFileNameNew)) {
aFileName = aFileNameNew;
myTmpFiles.add(aFileName);
}
}
StMutexAuto aLock(myMutex);
if(isPreview) {
myPreviewPath = aFileName;
} else {
myFullPath = aFileName;
}
}
示例3: getStCoreFolder
StString StProcess::getStCoreFolder() {
StString aCoreEnvValue = getEnv(ST_ENV_NAME_STCORE_PATH);
#ifdef _WIN32
if(aCoreEnvValue.isEmpty()) {
// read env. value directly from registry (before first log off / log in)
const StString aRegisterPath = "Environment";
loadStringFromRegister(aRegisterPath, ST_ENV_NAME_STCORE_PATH, aCoreEnvValue);
}
#endif
// repair filesystem splitter
if(!aCoreEnvValue.isEmpty() && !aCoreEnvValue.isEndsWith(SYS_FS_SPLITTER)) {
aCoreEnvValue += StString(SYS_FS_SPLITTER);
}
if(isValidStCorePath(aCoreEnvValue)) {
// environment variable is correctly set
return aCoreEnvValue;
}
const StString aProcessPath = getProcessFolder();
if(isValidStCorePath(aProcessPath)) {
return aProcessPath;
}
return StString();
}