本文整理汇总了C++中StringStorage类的典型用法代码示例。如果您正苦于以下问题:C++ StringStorage类的具体用法?C++ StringStorage怎么用?C++ StringStorage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StringStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MessageBox
int ControlApplication::checkServicePasswords(bool isRunAsRequested)
{
// FIXME: code duplication.
if (IsUserAnAdmin() == FALSE) {
// If admin rights already requested and application still don't have them,
// then show error message and exit.
if (isRunAsRequested) {
MessageBox(0,
StringTable::getString(IDS_ADMIN_RIGHTS_NEEDED),
StringTable::getString(IDS_MBC_TVNCONTROL),
MB_OK | MB_ICONERROR);
return 1;
}
// Path to tvnserver binary.
StringStorage pathToBinary;
// Command line for child process.
StringStorage childCommandLine;
// Get path to tvnserver binary.
Environment::getCurrentModulePath(&pathToBinary);
// Set -dontelevate flag to tvncontrol know that admin rights already requested.
childCommandLine.format(_T("%s -dontelevate"), m_commandLine.getString());
// Start child.
try {
Shell::runAsAdmin(pathToBinary.getString(), childCommandLine.getString());
return 0;
} catch (SystemException &sysEx) {
if (sysEx.getErrorCode() != ERROR_CANCELLED) {
MessageBox(0,
sysEx.getMessage(),
StringTable::getString(IDS_MBC_TVNCONTROL),
MB_OK | MB_ICONERROR);
}
return 1;
} // try / catch.
return 0;
}
checkServicePasswords();
return 0;
}
示例2: l
void ControlTrayIcon::onShutdownServerMenuItemClick()
{
// Promt user if any client is connected to rfb server.
// FIXME: Bad way to determinate connected clients.
bool someoneConnected = (getIcon() == m_iconWorking);
if (someoneConnected) {
TvnServerInfo serverInfo = {0};
{
AutoLock l(&m_serverInfoMutex);
serverInfo = m_lastKnownServerInfo;
}
StringStorage userMessage;
UINT stringId = serverInfo.m_serviceFlag ? IDS_TVNSERVER_SERVICE : IDS_TVNSERVER_APP;
userMessage.format(
StringTable::getString(IDS_SHUTDOWN_NOTIFICATION_FORMAT),
StringTable::getString(stringId));
if (MessageBox(
getWindow(),
userMessage.getString(),
StringTable::getString(IDS_MBC_TVNCONTROL),
MB_YESNO | MB_ICONQUESTION) == IDNO) {
return;
}
}
// Shutdown TightVNC server.
ShutdownCommand unsafeCommand(m_serverControl);
ControlCommand safeCommand(&unsafeCommand, m_notificator);
safeCommand.execute();
}
示例3: listener
void UploadOperation::processFolder()
{
StringStorage message;
// Try list files from folder
FolderListener listener(m_pathToSourceFile.getString());
if (listener.list()) {
m_toCopy->setChild(listener.getFilesInfo(), listener.getFilesCount());
} else {
// Logging
StringStorage message;
message.format(_T("Error: failed to get file list in local folder '%s'"),
m_pathToSourceFile.getString());
notifyError(message.getString());
}
// Send request to create folder
m_sender->sendMkDirRequest(m_pathToTargetFile.getString());
}
示例4: local
void DownloadOperation::processFolder()
{
File local(m_pathToTargetFile.getString());
if (local.exists() && local.isDirectory()) {
} else {
if (!local.mkdir()) {
StringStorage message;
message.format(_T("Error: failed to create local '%s' folder"),
m_pathToTargetFile.getString());
notifyError(message.getString());
gotoNext();
return ;
}
}
m_sender->sendFileListRequest(m_pathToSourceFile.getString(),
m_replyBuffer->isCompressionSupported());
}
示例5: addDialog
void PortMappingDialog::onAddButtonClick()
{
EditPortMappingDialog addDialog(EditPortMappingDialog::Add);
PortMapping newPM;
addDialog.setMapping(&newPM);
addDialog.setParent(&m_ctrlThis);
if (addDialog.showModal() == IDOK) {
{
StringStorage mappingString;
newPM.toString(&mappingString);
m_exPortsListBox.addString(mappingString.getString());
}
m_extraPorts->pushBack(newPM);
((ConfigDialog *)m_parent)->updateApplyButtonState();
}
}
示例6: m_dxgiAdapter
WinDxgiAdapter::WinDxgiAdapter(WinDxgiDevice *winDxgiDevice, int iAdapter)
: m_dxgiAdapter(0)
{
winDxgiDevice->getAdapter(&m_dxgiAdapter);
IDXGIFactory *m_dxgiFactory;
HRESULT hr = m_dxgiAdapter->GetParent( __uuidof( IDXGIFactory ), (void**) (&m_dxgiFactory) );
if (FAILED(hr)) {
throw WinDxCriticalException(_T("Can't get IDXGIAdapter parent factory (%ld)"), (long)hr);
}
hr = m_dxgiFactory->EnumAdapters(iAdapter, &m_dxgiAdapter);
m_dxgiFactory->Release();
if (hr == DXGI_ERROR_NOT_FOUND) {
StringStorage errMess;
errMess.format(_T("IDXGIAdapter not found for iAdapter = %u"), iAdapter);
throw WinDxRecoverableException(errMess.getString(), hr);
}
if (FAILED(hr)) {
throw WinDxCriticalException(_T("Can't IDXGIFactory::EnumAdapters()"), hr);
}
}
示例7: decFoldersToCalcSizeCount
void DownloadOperation::onLastRequestFailedReply(DataInputStream *input)
{
//
// This LRF message received from get folder size request
// we do need to download next file
//
if (m_foldersToCalcSizeLeft > 0) {
decFoldersToCalcSizeCount();
} else {
// Logging
StringStorage message;
m_replyBuffer->getLastErrorMessage(&message);
notifyFailedToDownload(message.getString());
// Download next file
gotoNext();
}
}
示例8: clear
void IpAccessControl::deserialize(DataInputStream *input)
{
clear();
size_t count = input->readUInt32();
StringStorage string;
for (size_t i = 0; i < count; i++) {
input->readUTF8(&string);
IpAccessRule *rule = new IpAccessRule();
if (!IpAccessRule::parse(string.getString(), rule)) {
delete rule;
continue;
}
push_back(rule);
}
}
示例9: m_recListener
DesktopServerWatcher::DesktopServerWatcher(ReconnectionListener *recListener, LogWriter *log)
: m_recListener(recListener),
m_process(0),
m_log(log)
{
// Desktop server folder.
StringStorage currentModulePath;
Environment::getCurrentModulePath(¤tModulePath);
// Path to desktop server application.
StringStorage path;
// FIXME: To think: is quotes needed?
path.format(_T("\"%s\""), currentModulePath.getString());
try {
m_process = new CurrentConsoleProcess(m_log, path.getString());
} catch (...) {
if (m_process) delete m_process;
throw;
}
}
示例10: truncate
void CommentHistory::truncate()
{
StringStorage valueName;
StringStorage value;
size_t i = (size_t)m_limit;
while (true) {
valueName.format(_T("%u"), i);
if (i >= getCommCount()) {
return ;
}
removeCom(getCom(i));
if (!m_key->getValueAsString(valueName.getString(), &value)) {
break;
}
m_key->deleteSubKey(value.getString());
m_key->deleteValue(valueName.getString());
i++;
}
load();
}
示例11: folder
Logger *ViewerConfig::initLog(const TCHAR logDir[], const TCHAR logName[])
{
m_logName = logName;
StringStorage logFileFolderPath;
StringStorage appDataPath;
// After that logFilePath variable will contain path to folder
// where tvnviewer.log must be located
if (Environment::getSpecialFolderPath(Environment::APPLICATION_DATA_SPECIAL_FOLDER, &appDataPath)) {
logFileFolderPath.format(_T("%s\\%s"), appDataPath.getString(), logDir);
} else {
logFileFolderPath.format(_T("%s"), logDir);
}
// Create TightVNC folder
{
File folder(logFileFolderPath.getString());
folder.mkdir();
}
// Path to log file
AutoLock l(&m_cs);
m_pathToLogFile = logFileFolderPath;
if (m_logger != 0) {
delete m_logger;
}
m_logger = new FileLogger(m_pathToLogFile.getString(), logName, m_logLevel, false);
return m_logger;
}
示例12: while
void ReconnectingChannel::waitForReconnect(const TCHAR *funName,
Channel *channel)
{
DateTime startTime = DateTime::now();
bool success = false;
while (!success) {
unsigned int timeForWait = max((int)m_timeOut -
(int)(DateTime::now() -
startTime).getTime(),
0);
if (timeForWait == 0 || m_isClosed) {
StringStorage errMess;
errMess.format(_T("The ReconnectingChannel::%s() function")
_T(" failed."), funName);
throw IOException(errMess.getString());
}
m_timer.waitForEvent(timeForWait);
AutoLock al(&m_chanMut);
if (m_channel != channel) {
m_chanWasChanged = false;
success = true;
}
}
Log::info(_T("ReconnectingChannel was successfully reconnected."));
if (channel != 0) {
StringStorage errMess;
errMess.format(_T("Transport was reconnected in the")
_T(" %s() function. The %s()")
_T(" function() at this time will be aborted"),
funName, funName);
throw ReconnectException(errMess.getString());
}
}
示例13: execute
void WsConfigRunner::execute()
{
Process *process = 0;
try {
// Prepare path to executable.
StringStorage pathToBin;
Environment::getCurrentModulePath(&pathToBin);
pathToBin.quoteSelf();
// Prepare arguments.
StringStorage args;
args.format(_T("%s %s"),
m_serviceMode ? ControlCommandLine::CONTROL_SERVICE :
ControlCommandLine::CONTROL_APPLICATION,
ControlCommandLine::SLAVE_MODE);
// Start process.
process = new Process(pathToBin.getString(), args.getString());
process->start();
} catch (Exception &e) {
m_log.error(_T("Cannot start the WsControl process (%s)"), e.getMessage());
}
if (process != 0) {
delete process;
}
}
示例14: GetDC
void Screen::getBMI(BMI *bmi, HDC dc)
{
HDC bitmapDC = dc;
if (bitmapDC == 0) {
bitmapDC = GetDC(0);
if (bitmapDC == NULL) {
throw Exception(_T("Can't get a bitmap dc"));
}
}
memset(bmi, 0, sizeof(BMI));
bmi->bmiHeader.biBitCount = 0;
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
HBITMAP hbm;
hbm = (HBITMAP)GetCurrentObject(bitmapDC, OBJ_BITMAP);
if (GetDIBits(bitmapDC, hbm, 0, 0, NULL, (LPBITMAPINFO)bmi, DIB_RGB_COLORS) == 0) {
StringStorage errMess;
Environment::getErrStr(_T("Can't get a DIBits"), &errMess);
DeleteObject(hbm);
DeleteDC(bitmapDC);
throw Exception(errMess.getString());
}
// The color table is filled only if it is used BI_BITFIELDS
if (bmi->bmiHeader.biCompression == BI_BITFIELDS) {
if (GetDIBits(bitmapDC, hbm, 0, 0, NULL, (LPBITMAPINFO)bmi, DIB_RGB_COLORS) == 0) {
StringStorage errMess;
Environment::getErrStr(_T("Can't get a DIBits"), &errMess);
DeleteObject(hbm);
DeleteDC(bitmapDC);
throw Exception(errMess.getString());
}
}
DeleteObject(hbm);
if (dc == 0) {
DeleteDC(bitmapDC);
}
}
示例15: connectStringAnsi
void ControlClient::addClientMsgRcvd()
{
m_gate->writeUInt32(ControlProto::REPLY_OK);
//
// Read parameters.
//
StringStorage connectString;
m_gate->readUTF8(&connectString);
bool viewOnly = m_gate->readUInt8() == 1;
//
// Parse host and port from connection string.
//
AnsiStringStorage connectStringAnsi(&connectString);
HostPath hp(connectStringAnsi.getString(), 5500);
if (!hp.isValid()) {
return;
}
StringStorage host;
AnsiStringStorage ansiHost(hp.getVncHost());
ansiHost.toStringStorage(&host);
//
// Make outgoing connection in separate thread.
//
OutgoingRfbConnectionThread *newConnectionThread =
new OutgoingRfbConnectionThread(host.getString(),
hp.getVncPort(), viewOnly,
m_rfbClientManager, m_log);
newConnectionThread->resume();
ZombieKiller::getInstance()->addZombie(newConnectionThread);
}