本文整理汇总了C++中StHandle类的典型用法代码示例。如果您正苦于以下问题:C++ StHandle类的具体用法?C++ StHandle怎么用?C++ StHandle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aGlobalSettings
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;
}
示例2: addAction
void StApplication::addAction(const int theActionId,
StHandle<StAction>& theAction,
const unsigned int theHotKey1,
const unsigned int theHotKey2) {
theAction->setDefaultHotKey1(theHotKey1);
theAction->setDefaultHotKey2(theHotKey2);
addAction(theActionId, theAction);
}
示例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: StApplication
void StTestEmbed::embedAppLoop() {
StHandle<StApplication> anApp = new StApplication(new StResourceManager(), myParent);
if(!anApp->open()) {
return;
}
anApp->exec();
}
示例5: aParentWin
void StActiveXCtrl::stWindowLoop() {
// do not load plugin until it is placed on screen
StWindow aParentWin(myResMgr, myParentWin);
for(;;) {
if(aParentWin.isParentOnScreen()) {
break;
}
StThread::sleep(10);
if(myToQuit) {
return;
}
}
myStApp = new StImageViewer(myResMgr, myParentWin, new StOpenInfo());
if(!myStApp->open()) {
myStApp.nullify();
return;
}
bool isFullscreen = false;
myIsActive = true;
for(;;) {
if(myStApp->closingDown()) {
myStApp.nullify();
myIsActive = false;
return;
}
myIsActive = myStApp->isActive();
if(myToQuit) {
myStApp->exit(0);
} else if(myOpenEvent.check()
&& myStApp->isActive()) {
// load the image
myStApp->open(myOpenInfo);
myOpenEvent.reset();
}
StHandle<StWindow> aWin = myStApp->getMainWindow();
if(myIsActive) {
aWin->show();
} else {
aWin->hide();
}
myStApp->processEvents();
if(aWin->isFullScreen()) {
if(!isFullscreen) {
PostMessage(WM_TIMER, 1);
isFullscreen = true;
}
} else if(isFullscreen) {
PostMessage(WM_TIMER, 0);
isFullscreen = false;
}
}
}
示例6: StFileNode
StHandle<StFileNode> StFileNode::detach() const {
StHandle<StFileNode> aCopy = new StFileNode(getPath());
aCopy->setMIME(getMIME());
for(size_t aSubId = 0; aSubId < size(); ++aSubId) {
const StFileNode* aSubNode = getValue(aSubId);
aCopy->add(new StFileNode(aSubNode->getSubPath(), aCopy.access()));
}
return aCopy;
}
示例7: 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);
}
}
}
示例8: size_t
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;
}
示例9: 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();
}
示例10: getAdapterCount
bool StDXManager::checkAqbsSupport(const HWND theWinHandle) {
if(!initDxLib()) {
return false;
}
const UINT aD3dAdaptersNb = getAdapterCount();
D3DADAPTER_IDENTIFIER9 anAdapterInfo;
for(UINT anAdapterIter = 0; anAdapterIter < aD3dAdaptersNb; ++anAdapterIter) {
getAdapterIdentifier(anAdapterIter, 0, &anAdapterInfo);
if(anAdapterInfo.VendorId != ST_DX_VENDOR_AMD) {
continue;
}
// setup the present parameters
if(getAdapterDisplayMode(anAdapterIter, &myCurrMode) == D3D_OK) {
myD3dParams.BackBufferFormat = myCurrMode.Format;
myRefreshRate = myCurrMode.RefreshRate;
}
// create temporary video device
myD3dParams.hDeviceWindow = theWinHandle;
myD3dDevice = createAqbsTmpDevice(anAdapterIter, theWinHandle, myD3dParams);
if(myD3dDevice == NULL) {
continue;
}
// create a surface to be used to communicate with the driver
StHandle<StDXAqbsControl> anAqbsControl = new StDXAqbsControl(myD3dDevice);
if(!anAqbsControl->isValid()) {
myD3dDevice->Release();
myD3dDevice = NULL;
return false;
}
// send the command to the driver using the temporary surface
if(!anAqbsControl->enableStereo()) {
anAqbsControl.nullify();
myD3dDevice->Release();
myD3dDevice = NULL;
return false;
}
myWithAqbs = true;
anAqbsControl.nullify();
myD3dDevice->Release();
myD3dDevice = NULL;
return true;
}
return false;
}
示例11: 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);
}
}
示例12: 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);
}
示例13: parseImage
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;
}
示例14: removePhysically
bool StPlayList::removePhysically(const StHandle<StFileNode>& theFileNode) {
StString aPath = theFileNode->getPath();
StPlayItem* aRemItem = NULL;
StMutexAuto anAutoLock(myMutex);
if(myCurrent == NULL) {
// empty playlist
return false;
} else if(aPath != myCurrent->getPath()) {
// search play item
for(StPlayItem* anItem = myFirst; anItem != NULL; anItem = anItem->getNext()) {
if(aPath == anItem->getPath()) {
aRemItem = anItem;
break;
}
}
} else {
// walk to another playlist position
aRemItem = myCurrent;
const bool aPlayedFlag = aRemItem->getPlayedFlag();
if(myCurrent->hasNext()) {
myCurrent = myCurrent->getNext();
} else if(myCurrent->hasPrev()) {
myCurrent = myCurrent->getPrev();
} else {
myCurrent = NULL;
myPlayedCount = 0;
}
if(myCurrent != NULL) {
if(aRemItem->getPlayedFlag() != aPlayedFlag) {
// the item has not been played yet - mark it as such
aRemItem->setPlayedFlag(aPlayedFlag);
} else {
// one played item has been removed
--myPlayedCount;
}
}
}
// remove item itself
const bool isDeleted = aRemItem != NULL
&& StFileNode::removeFile(aPath);
if(isDeleted) {
delPlayItem(aRemItem);
delete aRemItem;
}
anAutoLock.unlock();
signals.onPlaylistChange();
return isDeleted;
}
示例15: StGLOpenFile
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);
}