本文整理汇总了C++中StHandle::isNull方法的典型用法代码示例。如果您正苦于以下问题:C++ StHandle::isNull方法的具体用法?C++ StHandle::isNull怎么用?C++ StHandle::isNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StHandle
的用法示例。
在下文中一共展示了StHandle::isNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int , char** ) { // force console output
#else
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { // prevent console output
#endif
setlocale(LC_ALL, ".OCP"); // we set default locale for console output (useful only for debug)
#else
int main(int , char** ) {
#endif
StOutPageFlip::initGlobalsAsync();
if(!StVersionInfo::checkTimeBomb("sView")) {
return 1;
}
// setup environment variables
const StString ST_ENV_NAME_STCORE_PATH =
#if defined(_WIN64) || defined(_LP64) || defined(__LP64__)
"StCore64";
#else
"StCore32";
#endif
const StString aProcessPath = StProcess::getProcessFolder();
StString aProcessUpPath = StFileNode::getFolderUp(aProcessPath);
if(!aProcessUpPath.isEmpty()) {
aProcessUpPath += SYS_FS_SPLITTER;
}
StProcess::setEnv(ST_ENV_NAME_STCORE_PATH, aProcessPath);
if(StFolder::isFolder(aProcessPath + "textures")) {
StProcess::setEnv("StShare", aProcessPath);
} else if(StFolder::isFolder(aProcessUpPath + "textures")) {
StProcess::setEnv("StShare", aProcessUpPath);
}
StString aResDir = StProcess::getStShareFolder();
StProcess::setEnv("CSF_UnitsLexicon", aResDir + "UnitsAPI" ST_FILE_SPLITTER "Lexi_Expr.dat");
StProcess::setEnv("CSF_UnitsDefinition", aResDir + "UnitsAPI" ST_FILE_SPLITTER "Units.dat");
StProcess::setEnv("CSF_ShadersDirectory", aResDir + "shaders" ST_FILE_SPLITTER "StCADViewer");
StProcess::setEnv("CSF_SHMessage", aResDir + "lang");
StProcess::setEnv("CSF_MDTVTexturesDirectory", aResDir + "textures");
StHandle<StOpenInfo> anInfo;
if(anInfo.isNull()
|| (!anInfo->hasPath() && !anInfo->hasArgs())) {
anInfo = StApplication::parseProcessArguments();
}
if(anInfo.isNull()) {
// show help
StString aShowHelpString = getAbout();
st::cout << aShowHelpString;
stInfo(aShowHelpString);
return 0;
}
StHandle<StResourceManager> aResMgr = new StResourceManager();
StHandle<StCADViewer> anApp = new StCADViewer(aResMgr, NULL, anInfo);
if(!anApp->open()) {
return 1;
}
return anApp->exec();
}
示例2: setLanguage
void StTranslations::setLanguage(const int32_t theNewLang) {
if(size_t(theNewLang) >= params.language->getValues().size()) {
return;
}
// save global setting
const StString& aFolderName = myLangFolderList[theNewLang];
StSettings aGlobalSettings(myResMgr, ST_GLOBAL_SETTINGS_GROUP);
aGlobalSettings.saveString(ST_SETTING_LANGUAGE, aFolderName);
updateLangCode(theNewLang);
// reload translation file
StLangMap::clear();
const StString aResName = StString()
+ "lang" ST_FILE_SPLITTER
+ aFolderName + SYS_FS_SPLITTER
+ myModuleName + StTranslations::DEFAULT_SUFFIX;
StHandle<StResource> aRes = myResMgr->getResource(aResName);
if(!aRes.isNull()
&& aRes->read()) {
const char* aSrc = (const char* )aRes->getData();
const int aLen = aRes->getSize();
read(aSrc, aLen);
}
myWasReloaded = true;
}
示例3: createReference
void StImageFileCounter::createReference(StHandle<StBufferCounter>& theOther) const {
StHandle<StImageFileCounter> anImgFileRef = StHandle<StImageFileCounter>::downcast(theOther);
if(anImgFileRef.isNull()) {
anImgFileRef = new StImageFileCounter();
theOther = anImgFileRef;
}
anImgFileRef->myImageFile = myImageFile;
}
示例4: StGLMenuActionItem
ST_LOCAL StGLMenuActionItem(StGLMenu* theParent,
const StHandle<StAction>& theAction,
StGLMenu* theSubMenu)
: StGLMenuItem(theParent, 0, 0, theSubMenu),
myAction(theAction) {
ST_ASSERT(!theAction.isNull(), "StGLMenuActionItem - Unexpected empty action makes no sense!");
StGLMenuItem::signals.onItemClick.connect(this, &StGLMenuActionItem::doItemClick);
}
示例5: fillDictionary
void StJpegParser::fillDictionary(StDictionary& theDict,
const bool theToShowUnknown) const {
for(StHandle<StJpegParser::Image> anImg = myImages;
!anImg.isNull(); anImg = anImg->Next) {
for(size_t anExifId = 0; anExifId < anImg->Exif.size(); ++anExifId) {
anImg->Exif[anExifId]->fillDictionary(theDict, theToShowUnknown);
}
}
}
示例6: insertSection
bool StJpegParser::insertSection(const uint8_t theMarker,
const uint16_t theSectLen,
const ptrdiff_t theOffset) {
const size_t aDiff = size_t(theSectLen) + 2; // 2 bytes for marker
const size_t aNewSize = myLength + aDiff;
if(aNewSize > myBuffSize) {
myBuffSize = aNewSize + 256;
stUByte_t* aNewData = stMemAllocAligned<stUByte_t*>(myBuffSize);
if(aNewData == NULL) {
return false;
}
stMemCpy(aNewData, myBuffer, myLength);
if(myIsOwnData) {
stMemFreeAligned(myBuffer);
}
myIsOwnData = true;
// update pointers of image(s) data
for(StHandle<StJpegParser::Image> anImg = myImages;
!anImg.isNull(); anImg = anImg->Next) {
ptrdiff_t anOffset = anImg->Data - myBuffer;
if(anOffset >= theOffset) {
anOffset += aDiff;
}
anImg->Data = aNewData + anOffset;
if(!anImg->Thumb.isNull()) {
anOffset = anImg->Thumb->Data - myBuffer;
if(anOffset >= theOffset) {
anOffset += aDiff;
}
anImg->Thumb->Data = aNewData + anOffset;
}
}
myBuffer = aNewData;
}
myLength = aNewSize;
// update offset table
for(size_t anIter = 0; anIter < OffsetsNb; ++anIter) {
if(myOffsets[anIter] >= theOffset) {
myOffsets[anIter] += aDiff;
}
}
// initialize new section
const size_t aTailSize = myLength - theOffset;
std::memmove(myBuffer + theOffset + 2 + size_t(theSectLen),
myBuffer + theOffset,
aTailSize);
stUByte_t* aData = myBuffer + theOffset;
aData[0] = 0xFF;
aData[1] = theMarker;
StAlienData::Set16uBE(aData + 2, theSectLen);
return true;
}
示例7: addAction
void StApplication::addAction(const int theActionId,
const StHandle<StAction>& theAction) {
myActions[theActionId] = theAction;
if(!theAction.isNull()) {
StString aNameLower = theAction->getName();
aNameLower.toLowerCase();
const std::string aName(aNameLower.toCString());
myActionLookup[aName] = theActionId;
}
}
示例8: registerHotKeys
void StApplication::registerHotKeys() {
myKeyActions.clear();
for(std::map< int, StHandle<StAction> >::iterator anIter = myActions.begin();
anIter != myActions.end(); ++anIter) {
const StHandle<StAction>& anAction = anIter->second;
if(anAction->getHotKey1() != 0) {
StHandle<StAction> anOldAction = getActionForKey(anAction->getHotKey1());
if(!anOldAction.isNull()) {
anOldAction->setHotKey1(0);
}
myKeyActions[anAction->getHotKey1()] = anAction;
}
if(anAction->getHotKey2() != 0) {
StHandle<StAction> anOldAction = getActionForKey(anAction->getHotKey2());
if(!anOldAction.isNull()) {
anOldAction->setHotKey2(0);
}
myKeyActions[anAction->getHotKey2()] = anAction;
}
}
}
示例9: addRenderer
void StApplication::addRenderer(const StHandle<StWindow>& theRenderer) {
if(theRenderer.isNull()) {
return;
}
StHandle<StWindow> aRenderer = theRenderer;
aRenderer->params.VSyncMode = params.VSyncMode; // share VSync mode between renderers
aRenderer->setMessagesQueue(myMsgQueue);
myRenderers.add(aRenderer);
size_t aDevIter = myDevices.size();
aRenderer->getDevices(myDevices);
for(; aDevIter < myDevices.size(); ++aDevIter) {
params.ActiveDevice->changeValues().add(myDevices[aDevIter]->Name);
}
}
示例10: parse
bool StJpegParser::parse() {
if(myBuffer == NULL) {
return false;
}
int aCount = 0;
myImages = parseImage(++aCount, 1, myBuffer, false);
if(myImages.isNull()) {
return false;
}
// continue reading the file (MPO may contains more than 1 image)
for(StHandle<StJpegParser::Image> anImg = myImages;
!anImg.isNull(); anImg = anImg->Next) {
anImg->Next = parseImage(++aCount, 1, anImg->Data + anImg->Length, true);
}
return true;
}
示例11: loadRecentList
void StPlayList::loadRecentList(const StString theString) {
StMutexAuto anAutoLock(myMutex);
StArgumentsMap aMap;
aMap.parseString(theString);
myRecent.clear();
for(size_t anIter = 0; anIter < myRecentLimit; ++anIter) {
const StArgument anArgFile = aMap[StString("file") + anIter];
const StArgument anArgLeft = aMap[StString("left") + anIter];
const StArgument anArgRight = aMap[StString("right") + anIter];
const StArgument anArgTime = aMap[StString("time") + anIter];
StHandle<StRecentItem> aRecent;
if(anArgLeft.isValid() && anArgRight.isValid()) {
StHandle<StFileNode> aFileNode = new StFileNode(StString());
aFileNode->add(new StFileNode(anArgLeft.getValue(), aFileNode.access()));
aFileNode->add(new StFileNode(anArgRight.getValue(), aFileNode.access()));
aRecent = addRecentFile(*aFileNode, false);
} else if(anArgFile.isValid()) {
StHandle<StFileNode> aFileNode = new StFileNode(anArgFile.getValue());
const StArgument anArgPos = aMap[StString("pos") + anIter];
if(anArgPos.isValid()) {
aFileNode->add(new StFileNode(anArgPos.getValue(), aFileNode.access()));
}
aRecent = addRecentFile(*aFileNode, false);
}
if(aRecent.isNull()) {
continue;
}
if(anArgTime.isValid()) {
if(aRecent->Params.isNull()) {
aRecent->Params = new StStereoParams();
}
std::stringstream aStream;
aStream.imbue(std::locale("C"));
aStream << anArgTime.getValue().toCString();
aStream >> aRecent->Params->Timestamp;
}
}
}
示例12: updateRecent
void StPlayList::updateRecent(const StHandle<StFileNode>& theFile,
const StHandle<StStereoParams>& theParams) {
if(theFile.isNull()) {
return;
}
StMutexAuto anAutoLock(myMutex);
if(!myPlsFile.isNull()
&& myPlsFile->File == theFile) {
// remember properties of last played file
myPlsFile->Params = theParams;
return;
}
for(size_t anIter = 0; anIter < myRecent.size(); ++anIter) {
StHandle<StRecentItem>& aRecent = myRecent[anIter];
if(stAreSameRecent(*theFile, *aRecent->File)) {
aRecent->Params = theParams;
return;
}
}
}
示例13: doOpenFile
void StCADViewerGUI::doOpenFile(const size_t ) {
StGLOpenFile* aDialog = new StGLOpenFile(this, tr(DIALOG_OPEN_FILE), tr(BUTTON_CLOSE));
aDialog->setMimeList(StCADLoader::ST_CAD_MIME_LIST);
#if defined(_WIN32)
//
#else
aDialog->addHotItem("/", "Root");
#endif
aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_SdCard));
aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_Downloads));
aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_Pictures));
aDialog->addHotItem(getResourceManager()->getFolder(StResourceManager::FolderId_Photos));
aDialog->signals.onFileSelected = stSlot(myPlugin, &StCADViewer::doOpen1FileFromGui);
if(myPlugin->params.LastFolder.isEmpty()) {
StHandle<StFileNode> aCurrFile = myPlugin->myPlayList->getCurrentFile();
if(!aCurrFile.isNull()) {
myPlugin->params.LastFolder = aCurrFile->isEmpty() ? aCurrFile->getFolderPath() : aCurrFile->getValue(0)->getFolderPath();
}
}
aDialog->openFolder(myPlugin->params.LastFolder);
setModalDialog(aDialog);
}
示例14: copyResource
/**
* Copy OCCT resource file.
*/
ST_LOCAL bool copyResource(const StHandle<StResourceManager>& theResMgr,
const StString& theResFolder,
const StString& theDestFolder,
const StString& theFileName) {
StString aFileResPath = theResFolder + SYS_FS_SPLITTER + theFileName;
StHandle<StResource> aRes = theResMgr->getResource(aFileResPath);
if( aRes.isNull()
|| !aRes->read()) {
ST_ERROR_LOG(StString("Can not read resource file ") + aFileResPath);
return false;
}
StRawFile aFileOut;
StString aFileOutPath = theDestFolder + SYS_FS_SPLITTER + theFileName;
if(!aFileOut.openFile(StRawFile::WRITE, aFileOutPath)) {
ST_ERROR_LOG(StString("Can not create resource file ") + aFileOutPath);
return false;
}
if(!aFileOut.write((const char* )aRes->getData(), aRes->getSize()) != aRes->getSize()) {
ST_ERROR_LOG(StString("Can not write resource file ") + aFileOutPath);
return false;
}
return true;
}
示例15: reload
void StTranslations::reload() {
params.language->changeValues().clear();
// detect available translations
StArrayList<StString> aFolders;
myResMgr->listSubFolders("lang", aFolders);
for(size_t aNodeId = 0; aNodeId < aFolders.size(); ++aNodeId) {
myLangFolderList.add(aFolders[aNodeId]);
const StString aNameFile = StString("lang" ST_FILE_SPLITTER) + aFolders[aNodeId] + ST_FILE_SPLITTER "language.lng";
StHandle<StResource> aRes = myResMgr->getResource(aNameFile);
StString aName;
if(!aRes.isNull()
&& aRes->read()) {
const char* aSrc = (const char* )aRes->getData();
const size_t aLen = (size_t )aRes->getSize();
aName = StString(aSrc, aLen);
}
params.language->changeValues().add(aName.isEmpty() ? aFolders[aNodeId] : aName);
}
#if defined(__ANDROID__)
if(params.language->getValues().isEmpty()) {
// no way to list sub-folder on Android - check known translations
if(myResMgr->isResourceExist(StString("lang" ST_FILE_SPLITTER "English" ST_FILE_SPLITTER) + myModuleName + StTranslations::DEFAULT_SUFFIX)) {
params.language->changeValues().add("English");
myLangFolderList.add("English");
}
if(myResMgr->isResourceExist(StString("lang" ST_FILE_SPLITTER "Russian" ST_FILE_SPLITTER) + myModuleName + StTranslations::DEFAULT_SUFFIX)) {
params.language->changeValues().add("русский");
myLangFolderList.add("Russian");
}
if(myResMgr->isResourceExist(StString("lang" ST_FILE_SPLITTER "French" ST_FILE_SPLITTER) + myModuleName + StTranslations::DEFAULT_SUFFIX)) {
params.language->changeValues().add("français");
myLangFolderList.add("French");
}
if(myResMgr->isResourceExist(StString("lang" ST_FILE_SPLITTER "German" ST_FILE_SPLITTER) + myModuleName + StTranslations::DEFAULT_SUFFIX)) {
params.language->changeValues().add("Deutsch");
myLangFolderList.add("German");
}
if(myResMgr->isResourceExist(StString("lang" ST_FILE_SPLITTER "Korean" ST_FILE_SPLITTER) + myModuleName + StTranslations::DEFAULT_SUFFIX)) {
params.language->changeValues().add("한국어");
myLangFolderList.add("Korean");
}
if(myResMgr->isResourceExist(StString("lang" ST_FILE_SPLITTER "ChineseS" ST_FILE_SPLITTER) + myModuleName + StTranslations::DEFAULT_SUFFIX)) {
params.language->changeValues().add("简体中文");
myLangFolderList.add("ChineseS");
}
if(myResMgr->isResourceExist(StString("lang" ST_FILE_SPLITTER "Czech" ST_FILE_SPLITTER) + myModuleName + StTranslations::DEFAULT_SUFFIX)) {
params.language->changeValues().add("Čeština");
myLangFolderList.add("Czech");
}
}
#endif
if(params.language->getValues().isEmpty()) {
// add built-in language
params.language->changeValues().add("English");
myLangFolderList.add("English");
}
size_t anIdInList = 0;
StString aLangParam("English");
StSettings aGlobalSettings(myResMgr, ST_GLOBAL_SETTINGS_GROUP);
bool isLangSet = false;
if(!aGlobalSettings.loadString(ST_SETTING_LANGUAGE, aLangParam)) {
// try to use system-wide language settings
const StString& aLang = myResMgr->getSystemLanguage();
if(aLang.isEqualsIgnoreCase(stCString("ru"))) {
if(myLangFolderList.contains(stCString("Russian"), anIdInList)
|| myLangFolderList.contains(stCString("русский"), anIdInList)) {
params.language->setValue(int32_t(anIdInList));
isLangSet = true;
}
} else if(aLang.isEqualsIgnoreCase(stCString("de"))) {
if(myLangFolderList.contains(stCString("German"), anIdInList)
|| myLangFolderList.contains(stCString("Deutsch"), anIdInList)) {
params.language->setValue(int32_t(anIdInList));
isLangSet = true;
}
} else if(aLang.isEqualsIgnoreCase(stCString("fr"))) {
if(myLangFolderList.contains(stCString("French"), anIdInList)
|| myLangFolderList.contains(stCString("français"), anIdInList)) {
params.language->setValue(int32_t(anIdInList));
isLangSet = true;
}
} else if(aLang.isEqualsIgnoreCase(stCString("ko"))) {
if(myLangFolderList.contains(stCString("Korean"), anIdInList)) {
params.language->setValue(int32_t(anIdInList));
isLangSet = true;
}
} else if(aLang.isEqualsIgnoreCase(stCString("zh"))) {
if(myLangFolderList.contains(stCString("ChineseS"), anIdInList)) {
params.language->setValue(int32_t(anIdInList));
isLangSet = true;
}
} else if(aLang.isEqualsIgnoreCase(stCString("cs"))) {
if(myLangFolderList.contains(stCString("Čeština"), anIdInList)) {
params.language->setValue(int32_t(anIdInList));
isLangSet = true;
}
//.........这里部分代码省略.........