本文整理汇总了C++中StString::isStartsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ StString::isStartsWith方法的具体用法?C++ StString::isStartsWith怎么用?C++ StString::isStartsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StString
的用法示例。
在下文中一共展示了StString::isStartsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: getAbsolutePath
StString StProcess::getAbsolutePath(const StString& thePath) {
StString aPath;
if(thePath.isStartsWith(ST_FILE_PROTOCOL)) {
const StString aData = thePath.subString(ST_FILE_PROTOCOL.getLength(), thePath.getLength());
aPath.fromUrl(aData);
} else {
aPath = thePath;
}
if(StFileNode::isAbsolutePath(aPath)) {
return aPath;
}
return StProcess::getWorkingFolder() + aPath; // make absolute path
}
示例3: setOpenPath
void StAndroidGlue::setOpenPath(const jstring theOpenPath,
const jstring theMimeType,
const jboolean theIsLaunchedFromHistory) {
JNIEnv* aJniEnv = myActivity->env;
StString anOpenPath = stStringFromJava(aJniEnv, theOpenPath);
StString aMimeType = stStringFromJava(aJniEnv, theMimeType);
const StString ST_FILE_PROTOCOL("file://");
if(anOpenPath.isStartsWith(ST_FILE_PROTOCOL)) {
const size_t aCutFrom = ST_FILE_PROTOCOL.getLength();
const StString aPath = anOpenPath.subString(aCutFrom, (size_t )-1);
anOpenPath.fromUrl(aPath);
}
StMutexAuto aLock(myFetchLock);
if(myCreatePath.isEmpty()) {
myCreatePath = anOpenPath;
}
// ignore outdated intent from history list - use C++ recent list instead
if(!theIsLaunchedFromHistory) {
myDndPath = anOpenPath;
}
}
示例4: StOpenInfo
StHandle<StOpenInfo> StApplication::parseProcessArguments() {
StHandle<StOpenInfo> anInfo = new StOpenInfo();
StArrayList<StString> anArguments = StProcess::getArguments();
StArgumentsMap anOpenFileArgs;
size_t aFilesCount = 0;
bool isFilesSection = false;
const StString ARGUMENT_FILES_SECTION = '-';
const StString ARGUMENT_ANY = "--";
const StString ARGUMENT_HELP = "help";
const StString ARGUMENT_FILE = "file";
const StString ARGUMENT_LEFT_VIEW = "left";
const StString ARGUMENT_RIGHT_VIEW = "right";
// parse extra parameters
for(size_t aParamIter = 1; aParamIter < anArguments.size(); ++aParamIter) {
StString aParam = anArguments[aParamIter];
///ST_DEBUG_LOG("aParam= '" + aParam + "'");
if(isFilesSection) {
// file name
StString aFilePath = StProcess::getAbsolutePath(aParam);
anOpenFileArgs.add(StArgument(ARGUMENT_FILE + aFilesCount++, aFilePath));
if(!anInfo->hasPath()) {
// first file determines MIME type (needed to autoselect Drawer plugin)
anInfo->setPath(aFilePath);
}
} else if(aParam == ARGUMENT_FILES_SECTION) {
isFilesSection = true;
} else if(aParam.isStartsWith(ARGUMENT_ANY)) {
// argument
StArgument anArg; anArg.parseString(aParam.subString(2, aParam.getLength())); // cut suffix --
if(anArg.getKey().isEqualsIgnoreCase(ARGUMENT_HELP)) {
return NULL;
} else if(anArg.getKey().isEqualsIgnoreCase(ARGUMENT_LEFT_VIEW)) {
// left view
anArg.setValue(StProcess::getAbsolutePath(anArg.getValue()));
anOpenFileArgs.add(anArg);
anInfo->setPath(anArg.getValue()); // left file always determines MIME type
} else if(anArg.getKey().isEqualsIgnoreCase(ARGUMENT_RIGHT_VIEW)) {
// right view
anArg.setValue(StProcess::getAbsolutePath(anArg.getValue()));
anOpenFileArgs.add(anArg);
if(!anInfo->hasPath()) {
anInfo->setPath(anArg.getValue());
}
} else {
// pass argument unchanged
anOpenFileArgs.add(anArg);
}
} else {
// file name
StString aFilePath = StProcess::getAbsolutePath(aParam);
anOpenFileArgs.add(StArgument(ARGUMENT_FILE + aFilesCount++, aFilePath));
if(!anInfo->hasPath()) {
// first file determines MIME type (needed to autoselect Drawer plugin)
anInfo->setPath(aFilePath);
}
}
}
anInfo->setArgumentsMap(anOpenFileArgs);
return anInfo;
}