当前位置: 首页>>代码示例>>C++>>正文


C++ StString::toUtfWide方法代码示例

本文整理汇总了C++中StString::toUtfWide方法的典型用法代码示例。如果您正苦于以下问题:C++ StString::toUtfWide方法的具体用法?C++ StString::toUtfWide怎么用?C++ StString::toUtfWide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StString的用法示例。


在下文中一共展示了StString::toUtfWide方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mySettingsSet

StSettings::StSettings(const StHandle<StResourceManager>& /*theResMgr*/,
                       const StString&                    theSettingsSet)
: mySettingsSet(theSettingsSet.toUtfWide()),
  myRegisterPath(StStringUtfWide("SOFTWARE\\sView\\") + theSettingsSet.toUtfWide()),
  myToFlush(false) {
    //
}
开发者ID:angelstudio,项目名称:sview,代码行数:7,代码来源:StRegisterImpl.cpp

示例2: saveString

bool StSettings::saveString(const StString& theParam,
                            const StString& theValue) {
    StRegKey aKey;
    if(!aKey.create(myRegisterPath)) {
        return false; // No write registry success!
    }

    StStringUtfWide aValue = theValue.toUtfWide();
    return RegSetValueExW(aKey, theParam.toUtfWide().toCString(), 0,
                          REG_SZ, (LPBYTE )aValue.toCString(), DWORD(aValue.getSize() + sizeof(stUtfWide_t))) == ERROR_SUCCESS;
}
开发者ID:angelstudio,项目名称:sview,代码行数:11,代码来源:StRegisterImpl.cpp

示例3: loadStringFromRegister

bool loadStringFromRegister(const StString& theRegisterPath, const StString& theParamPath, StString& theOutValue) {
    // TODO (Kirill Gavrilov) parse ERROR_MORE_DATA error (increase buffer)
    stUtfWide_t* aDataOut = new stUtfWide_t[4096U];
    HKEY hKey = NULL;
    DWORD aValueSize = sizeof(stUtfWide_t) * 4096U;
    RegOpenKeyExW(HKEY_CURRENT_USER, theRegisterPath.toUtfWide().toCString(), 0, KEY_READ, &hKey);
    if(RegQueryValueExW(hKey, theParamPath.toUtfWide().toCString(), NULL, NULL, (LPBYTE )aDataOut, &aValueSize) == ERROR_SUCCESS) {
        RegCloseKey(hKey);
        theOutValue = StString(aDataOut);
        delete[] aDataOut;
        return true;
    }
    RegCloseKey(hKey);
    delete[] aDataOut;
    return false;
}
开发者ID:angelstudio,项目名称:sview,代码行数:16,代码来源:StProcess.cpp

示例4: loadString

bool StSettings::loadString(const StString& theParam,
                            StString&       theValue) {
    const StStringUtfWide aParam = theParam.toUtfWide();
    StRegKey aKey;
    if(!aKey.open(myRegisterPath)) {
        return false;
    }

    // request size
    DWORD aValueSize = 0;
    if(RegQueryValueExW(aKey, aParam.toCString(), NULL, NULL, NULL, &aValueSize) != ERROR_SUCCESS) {
        return false;
    }

    if(aValueSize == 0) {
        theValue = "";
        return true;
    }

    DWORD aValueSizeRead = aValueSize;
    stUtfWide_t* aDataOut = new stUtfWide_t[aValueSize / sizeof(stUtfWide_t) + 1];
    if(RegQueryValueExW(aKey, aParam.toCString(), NULL, NULL, (LPBYTE )aDataOut, &aValueSizeRead) != ERROR_SUCCESS) {
        return false;
    }

    aDataOut[aValueSize / sizeof(stUtfWide_t)] = L'\0'; // NULL-terminate
    theValue = StString(aDataOut);
    return true;
}
开发者ID:angelstudio,项目名称:sview,代码行数:29,代码来源:StRegisterImpl.cpp

示例5: getCompatibleName

StString StFileNode::getCompatibleName(const StString& theFileName) {
#ifdef _WIN32
    stUtfWide_t aShortNameWide[MAX_PATH];
    GetShortPathNameW(theFileName.toUtfWide().toCString(), aShortNameWide, MAX_PATH);
    return *aShortNameWide != L'\0' ? StString(aShortNameWide) : theFileName;
#else
    return theFileName;
#endif
}
开发者ID:angelstudio,项目名称:sview,代码行数:9,代码来源:StFileNode.cpp

示例6: getCompatibleName

StString StFileNode::getCompatibleName(const StString& theFileName) {
#ifdef _WIN32
    /// TODO (Kirill Gavrilov#1) if result is empty - not a filesystem element or no DOS-names enabled
    stUtfWide_t aShortNameWide[MAX_PATH];
    GetShortPathName(theFileName.toUtfWide().toCString(), aShortNameWide, MAX_PATH);
    return *aShortNameWide != L'\0' ? StString(aShortNameWide) : theFileName;
#else
    return theFileName;
#endif
}
开发者ID:KindDragon,项目名称:sview,代码行数:10,代码来源:StFileNode.cpp

示例7: RegSetValueExW

bool StSettings::saveInt32(const StString& theParam,
                           const int32_t&  theValue) {
    StRegKey aKey;
    if(!aKey.create(myRegisterPath)) {
        return false; // No write registry success!
    }

    DWORD aData = theValue;
    return RegSetValueExW(aKey, theParam.toUtfWide().toCString(), 0,
                          REG_DWORD, (LPBYTE )&aData, sizeof(DWORD)) == ERROR_SUCCESS;
}
开发者ID:angelstudio,项目名称:sview,代码行数:11,代码来源:StRegisterImpl.cpp

示例8: DLibLoadFull

HMODULE StLibrary::DLibLoadFull(const StString& theLibName) {
#ifdef _WIN32
    HMODULE aModule = LoadLibraryW(theLibName.toUtfWide().toCString());
    if(aModule == NULL) {
        ST_DEBUG_LOG("Failed to load library: \"" + theLibName + "\" (" + (int )GetLastError() + ')');
    } else {
    #ifdef ST_DEBUG_LIBS
        ST_DEBUG_LOG("Loaded library: \"" + theLibName + "\" " + DLibGetVersion(theLibName.toUtfWide()));
    #endif
    }
    return aModule;
#else
    HMODULE aModule = dlopen(theLibName.toCString(), RTLD_NOW);
    if(aModule == NULL) {
        ST_DEBUG_LOG("Failed to load library: \"" + theLibName + "\" (" + dlerror() + ')');
    } else {
    #ifdef ST_DEBUG_LIBS
        ST_DEBUG_LOG("Loaded library: \"" + theLibName + '\"');
    #endif
    }
    return aModule;
#endif
}
开发者ID:angelstudio,项目名称:sview,代码行数:23,代码来源:StLibrary.cpp

示例9: myMutex

StLogger::StLogger(const StString&       theLogFile,
                   const StLogger::Level theFilter,
                   const int             theOptions)
: myMutex((theOptions & StLogger::ST_OPT_LOCK) ? new StMutexSlim() : (StMutexSlim* )NULL),
#ifdef _WIN32
  myFilePath(theLogFile.toUtfWide()),
#else
  myFilePath(theLogFile),
#endif
  myFileHandle(NULL),
  myFilter(theFilter),
  myToLogCout(theOptions & StLogger::ST_OPT_COUT) {
    //
}
开发者ID:KindDragon,项目名称:sview,代码行数:14,代码来源:StLogger.cpp

示例10: Error

void StMessageBox::Error(const StString& theMessage) {
    StLogger::GetDefault().write(theMessage, StLogger::ST_ERROR);
#ifdef _WIN32
    MessageBoxW(NULL, theMessage.toUtfWide().toCString(), L"Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND | MB_TOPMOST);
#elif defined(__linux__)
    if(initGlobals()) {
        gdk_threads_enter();
        GtkWidget* dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", theMessage.toCString());
        gtk_dialog_run(GTK_DIALOG(dialog));
        gtk_widget_destroy(dialog);
        gdk_flush(); // we need this call!
        gdk_threads_leave();
    }
#endif
}
开发者ID:KindDragon,项目名称:sview,代码行数:15,代码来源:StLogger.cpp

示例11: openURL

void StProcess::openURL(const StString& theUrl) {
#if defined(_WIN32)
    ShellExecuteW(NULL, L"open", theUrl.toUtfWide().toCString(), NULL, NULL, SW_SHOWNORMAL);
#elif(defined(__linux__) || defined(__linux))
    // we use nice script tool from Xdg-utils package
    // http://portland.freedesktop.org/wiki/
    StArrayList<StString> anArguments(1);
    anArguments.add(theUrl);
    if(!StProcess::execProcess("/usr/bin/xdg-open", anArguments)) {
        ST_DEBUG_LOG("/usr/bin/xdg-open is not found!");
    }
    // also we could use GTK function
    //gtk_show_uri(NULL, uri, gtk_get_current_event_time(), &err);
#endif
}
开发者ID:angelstudio,项目名称:sview,代码行数:15,代码来源:StProcess.cpp

示例12: Question

bool StMessageBox::Question(const StString& theMessage) {
#ifdef _WIN32
    return MessageBoxW(NULL, theMessage.toUtfWide().toCString(), L"Question", MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TOPMOST) == IDYES;
#elif defined(__linux__)
    if(initGlobals()) {
        gdk_threads_enter();
        GtkWidget* aDialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "%s", theMessage.toCString());
        gint anAnswer = gtk_dialog_run(GTK_DIALOG(aDialog));
        gtk_widget_destroy(aDialog);
        gdk_flush(); // we need this call!
        gdk_threads_leave();
        return anAnswer == GTK_RESPONSE_YES;
    }
    return false;
#endif
}
开发者ID:KindDragon,项目名称:sview,代码行数:16,代码来源:StLogger.cpp

示例13: sizeof

bool StSettings::loadInt32(const StString& theParam,
                           int32_t&        theValue) {
    StRegKey aKey;
    if(!aKey.open(myRegisterPath)) {
        return false;
    }

    DWORD aValueSize = sizeof(DWORD);
    DWORD aData = 0;
    if(RegQueryValueExW(aKey, theParam.toUtfWide().toCString(), NULL, NULL, (LPBYTE )&aData, &aValueSize) != ERROR_SUCCESS) {
        return false;
    }

    theValue = aData;
    return true;
}
开发者ID:angelstudio,项目名称:sview,代码行数:16,代码来源:StRegisterImpl.cpp

示例14: init

void StFolder::init(const StArrayList<StString>& theExtensions, int theDeep) {
    // clean up old list...
    clear();
    StString aSearchFolderPath = getPath();
#ifdef _WIN32
    WIN32_FIND_DATAW aFindFile;
    StString aStrSearchMask = getPath() + StString(SYS_FS_SPLITTER) + '*';

    HANDLE hFind = FindFirstFileW(aStrSearchMask.toUtfWide().toCString(), &aFindFile);
    for(BOOL hasFile = (hFind != INVALID_HANDLE_VALUE); hasFile == TRUE;
        hasFile = FindNextFileW(hFind, &aFindFile)) {
        //
        StString aCurrItemName(aFindFile.cFileName);
        addItem(theExtensions, theDeep, aSearchFolderPath, aCurrItemName);
    }
    FindClose(hFind);
#else
    DIR* aSearchedFolder = opendir(aSearchFolderPath.toCString());
    if(aSearchedFolder == NULL) {
        return;
    }
    for(dirent* aDirItem = readdir(aSearchedFolder); aDirItem != NULL;
        aDirItem = readdir(aSearchedFolder)) {
        //
    #if (defined(__APPLE__))
        // automatically convert filenames from decomposed form used by Mac OS X file systems
        StString aCurrItemName = stFromUtf8Mac(aDirItem->d_name);
    #else
        StString aCurrItemName(aDirItem->d_name);
    #endif
        addItem(theExtensions, theDeep, aSearchFolderPath, aCurrItemName);
    }
    closedir(aSearchedFolder);
#endif
    // perform sorting...
    sort();
}
开发者ID:KindDragon,项目名称:sview,代码行数:37,代码来源:StFolder.cpp

示例15: execProcess

bool StProcess::execProcess(const StString&          theExecutablePath,
                            const StArray<StString>& theArguments) {
    if(!StFileNode::isFileExists(theExecutablePath)) {
        return false;
    }
#ifdef _WIN32
    // convert to wide strings
    StStringUtfWide anExecutablePathW = theExecutablePath.toUtfWide();
    StArrayList<StStringUtfWide> anArgumentsW(theArguments.size());
    StStringUtfWide aSplitter = ' ';
    StStringUtfWide aCmdLineW = StStringUtfWide('\"') + anExecutablePathW + StStringUtfWide("\" ");
    for(size_t anElem = 0;;) {
        // TODO (Kirill Gavrilov#9) we should probably quote arguments with spaces...
        // how to correctly deal this in the same way for UNIX / Windows?
        aCmdLineW += theArguments[anElem++].toUtfWide();
        if(anElem >= theArguments.size()) {
            break;
        }
        aCmdLineW += aSplitter;
    }

    STARTUPINFOW aStartInfo;
    PROCESS_INFORMATION aProcessInfo;
    stMemSet(&aStartInfo, 0, sizeof(aStartInfo));
    aStartInfo.cb = sizeof(aStartInfo);
    stMemSet(&aProcessInfo, 0, sizeof(aProcessInfo));

    // start the process
    if(!CreateProcessW(anExecutablePathW.toCString(), (wchar_t* )aCmdLineW.toCString(),
        NULL, NULL, FALSE, 0, NULL, NULL, &aStartInfo, &aProcessInfo)) {
        return false;
    }

    // close process and thread handles
    CloseHandle(aProcessInfo.hProcess);
    CloseHandle(aProcessInfo.hThread);
    return true;
#else
    char** anArgList = new char*[theArguments.size() + 2];
    anArgList[0] = (char* )theExecutablePath.toCString();
    for(size_t anArgId = 0; anArgId < theArguments.size(); ++anArgId) {
        anArgList[anArgId + 1] = (char* )theArguments.getValue(anArgId).toCString();
    }
    anArgList[theArguments.size() + 1] = NULL;

    pid_t aChildPid = vfork();
    if(aChildPid == -1) {
        // fork fail
        delete[] anArgList;
        return false;
    } else if(aChildPid != 0) {
        // parent process give the control only after child
        // calls exit() or exec() functions
        delete[] anArgList;
        return true;
    }

    // child process
    execv(theExecutablePath.toCString(), anArgList);
    // fail
    _exit(1);
#endif
}
开发者ID:angelstudio,项目名称:sview,代码行数:63,代码来源:StProcess.cpp


注:本文中的StString::toUtfWide方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。