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


C++ StringStorage::format方法代码示例

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


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

示例1: 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;
}
开发者ID:Aliceljm1,项目名称:TightVNC-1,代码行数:30,代码来源:ViewerConfig.cpp

示例2: waitForReconnect

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());
  }
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:33,代码来源:ReconnectingChannel.cpp

示例3: setFbProperties

void RemoteViewerCore::setFbProperties(const Dimension *fbDimension,
                                       const PixelFormat *fbPixelFormat)
{
  const PixelFormat &pxFormat = *fbPixelFormat;
  StringStorage pxString;
  pxString.format(_T("[bits-per-pixel: %d, depth: %d, big-endian-flag: %d, ")
                  _T("true-color-flag: is set, ") // true color always is set
                  _T("red-max: %d, green-max: %d, blue-max: %d, ")
                  _T("red-shift: %d, green-shift: %d, blue-shift: %d]"),
                  pxFormat.bitsPerPixel, pxFormat.colorDepth, pxFormat.bigEndian,
                  pxFormat.redMax, pxFormat.greenMax, pxFormat.blueMax,
                  pxFormat.redShift, pxFormat.greenShift, pxFormat.blueShift);

  m_logWriter.detail(_T("Setting frame buffer properties..."));
  m_logWriter.info(_T("Frame buffer dimension: (%d, %d)"),
                   fbDimension->width, fbDimension->height);
  m_logWriter.info(_T("Frame buffer pixel format: %s"), pxString.getString());

  if (!m_frameBuffer.setProperties(fbDimension, fbPixelFormat) ||
      !m_rectangleFb.setProperties(fbDimension, fbPixelFormat)) {
    StringStorage error;
    error.format(_T("Failed to set property frame buffer. ")
                 _T("Dimension: (%d, %d), Pixel format: %s"),
                 fbDimension->width, fbDimension->height,
                 pxString.getString());
    throw Exception(error.getString());
  }
  m_rectangleFb.setColor(0, 0, 0);
  m_frameBuffer.setColor(0, 0, 0);
  refreshFrameBuffer();
  m_fbUpdateNotifier.onPropertiesFb();
  m_logWriter.debug(_T("Frame buffer properties set"));
}
开发者ID:mkingzhu,项目名称:JustsyVNC-Controller,代码行数:33,代码来源:RemoteViewerCore.cpp

示例4: parseOptionsFile

void ViewerCmdLine::parseOptionsFile()
{
  StringStorage pathToIniFile = m_options[OPTIONS_FILE];
  if (pathToIniFile.findChar(_T('\\')) == -1) {
    StringStorage newPathToIniFile;
    newPathToIniFile.format(_T(".\\%s"), pathToIniFile.getString());
    pathToIniFile = newPathToIniFile;
  }
  IniFileSettingsManager sm(pathToIniFile.getString());
  sm.setApplicationName(_T("connection"));

  StringStorage host;
  if (!sm.getString(_T("host"), &host)) {
    throw CommandLineFormatException(_T("Could not read options file."));
  }
  StringStorage port;
  if (sm.getString(_T("port"), &port)) {
    StringStorage hostString;
    hostString.format(_T("%s:%s"), host.getString(), port.getString());
    m_conData->setHost(&hostString);
  } else {
    m_conData->setHost(&host);
  }

  StringStorage password;
  sm.getString(_T("password"), &password);
  if (!password.isEmpty()) {
    m_conData->setCryptedPassword(&password);
  } else {
    parsePassword();
  }
  
  sm.setApplicationName(_T("options"));
  m_conConf->loadFromStorage(&sm);
}
开发者ID:sim0629,项目名称:tightvnc,代码行数:35,代码来源:ViewerCmdLine.cpp

示例5: IOException

Channel *ReconnectingChannel::getChannel(const TCHAR *funName)
{
  if (m_isClosed) {
    StringStorage errMess;
    errMess.format(_T("The %s() function has failed:")
                   _T(" connection has already been closed."),
                   funName);
    throw IOException(errMess.getString());
  }
  Channel *channel;
  {
    AutoLock al(&m_chanMut);
    if (m_oldChannel != 0) {
      delete m_oldChannel;
      m_oldChannel = 0;
    }
    if (m_chanWasChanged) {
      m_chanWasChanged = false;
      StringStorage errMess;
      errMess.format(_T("Transport was reconnected outside from")
                     _T(" the %s() function. The %s()")
                     _T(" function at this time will be aborted."),
                     funName,
                     funName);
      throw ReconnectException(errMess.getString());
    }
    channel = m_channel;
  }
  return channel;
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:30,代码来源:ReconnectingChannel.cpp

示例6: updateTimeoutLabel

void QueryConnectionDialog::updateTimeoutLabel()
{
  StringStorage labelText;

  if (m_acceptByDefault) {
    labelText.format(StringTable::getString(IDS_AUTO_ACCEPT_CONNECTION_FORMAT), m_timeout);
  } else {
    labelText.format(StringTable::getString(IDS_AUTO_REJECT_CONNECTION_FORMAT), m_timeout);
  }

  m_timeoutLabel.setText(labelText.getString());
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:12,代码来源:QueryConnectionDialog.cpp

示例7: checkPixelFormat

void DesktopServerProto::checkPixelFormat(const PixelFormat *pf)
{
  StringStorage errMess;
  if (pf->bitsPerPixel != 16 && pf->bitsPerPixel != 32) {
    errMess.format(_T("Wrong value of bits per pixel (%d)"),
                   (int)pf->bitsPerPixel);
    throw Exception(errMess.getString());
  }
  if (pf->colorDepth > pf->bitsPerPixel) {
    errMess.format(_T("Wrong value (color depth (%d) > bits per pixel (%d))"),
                   (int)pf->colorDepth, (int)pf->bitsPerPixel);
    throw Exception(errMess.getString());
  }
}
开发者ID:heroyin,项目名称:qmlvncviewer,代码行数:14,代码来源:DesktopServerProto.cpp

示例8: formatWindowName

StringStorage ViewerWindow::formatWindowName() const
{
	StringStorage desktopName = m_viewerCore->getRemoteDesktopName();
	if (desktopName.isEmpty() && !m_conData->getHost().isEmpty()) {
		desktopName = m_conData->getHost();
	}
	StringStorage windowName;
	if (!desktopName.isEmpty()) {
		windowName.format(_T("%s - %s"), desktopName.getString(), ProductNames::VIEWER_PRODUCT_NAME);
	}
	else {
		windowName.format(_T("%s"), ProductNames::VIEWER_PRODUCT_NAME);
	}
	return windowName;
}
开发者ID:Aliceljm1,项目名称:TightVNC-1,代码行数:15,代码来源:ViewerWindow.cpp

示例9: close

void AnonymousPipe::close()
{
  AutoLock al(&m_hPipeMutex);

  bool wrSuc = true;
  bool rdSuc = true;
  StringStorage wrErrText, rdErrText;
  if (m_hWrite != INVALID_HANDLE_VALUE && m_neededToClose) {
    if (CloseHandle(m_hWrite) == 0) {
      Environment::getErrStr(_T("Cannot close anonymous pipe write handle."),
                             &wrErrText);
      wrSuc = false;
    }
    m_log->debug(_T("Closed m_hWrite(%p) AnonymousPipe handle"),
               m_hWrite);
  }
  m_hWrite = INVALID_HANDLE_VALUE;
  if (m_hRead != INVALID_HANDLE_VALUE && m_neededToClose) {
    if (CloseHandle(m_hRead) == 0) {
      Environment::getErrStr(_T("Cannot close anonymous pipe read handle."),
                             &wrErrText);
      rdSuc = false;
    }
    m_log->debug(_T("Closed m_hRead(%p) AnonymousPipe handle"),
               m_hRead);
  }
  m_hRead = INVALID_HANDLE_VALUE;
  if (!wrSuc || !rdSuc) {
    StringStorage errMess;
    errMess.format(_T("AnonymousPipe::close() funciton has failed (%s %s)"),
                   wrErrText.getString(), rdErrText.getString());
    throw Exception(errMess.getString());
  }
}
开发者ID:heroyin,项目名称:qmlvncviewer,代码行数:34,代码来源:AnonymousPipe.cpp

示例10: dialogConnectionInfo

void ViewerWindow::dialogConnectionInfo()
{
	StringStorage host = m_conData->getHost();
	std::vector<TCHAR> kbdName;
	kbdName.resize(KL_NAMELENGTH);
	memset(&kbdName[0], 0, sizeof(TCHAR) * KL_NAMELENGTH);
	if (!GetKeyboardLayoutName(&kbdName[0])) {
		kbdName[0] = _T('?');
		kbdName[1] = _T('?');
		kbdName[2] = _T('?');
	}

	Rect geometry;
	int pixelSize = 0;
	m_dsktWnd.getServerGeometry(&geometry, &pixelSize);
	StringStorage str;
	str.format(StringTable::getString(IDS_CONNECTION_INFO_FORMAT),
		host.getString(),
		m_viewerCore->getRemoteDesktopName().getString(),
		m_viewerCore->getProtocolString().getString(),
		geometry.getWidth(),
		geometry.getHeight(),
		pixelSize,
		&kbdName[0]);
	MessageBox(getHWnd(),
		str.getString(),
		StringTable::getString(IDS_CONNECTION_INFO_CAPTION),
		MB_OK | MB_ICONINFORMATION);
}
开发者ID:Aliceljm1,项目名称:TightVNC-1,代码行数:29,代码来源:ViewerWindow.cpp

示例11: onInitDialog

BOOL AboutDialog::onInitDialog()
{

  Control versionLabel;

  versionLabel.setWindow(GetDlgItem(m_ctrlThis.getWindow(), IDC_STATIC_VERSION));

  StringStorage binaryPath;
  StringStorage versionText;
  StringStorage versionString(_T("unknown"));

  Environment::getCurrentModulePath(&binaryPath);

  try {
    VersionInfo productInfo(binaryPath.getString());
    versionString.setString(productInfo.getProductVersionString());
  } catch (SystemException &ex) {
    MessageBox(m_ctrlThis.getWindow(),
      ex.getMessage(),
      StringTable::getString(IDS_MBC_TVNCONTROL),
      MB_OK | MB_ICONEXCLAMATION);
  }

  versionText.format(StringTable::getString(IDS_PRODUCT_VERSION_FORMAT),
    versionString.getString(),
    BuildTime::DATE);

  versionLabel.setText(versionText.getString());

  return FALSE;
}
开发者ID:newmind,项目名称:tvnc_rds,代码行数:31,代码来源:AboutDialog.cpp

示例12: onRequest

void UserInputServer::onRequest(UINT8 reqCode, BlockingGate *backGate)
{
  switch (reqCode) {
  case POINTER_POS_CHANGED:
    applyNewPointerPos(backGate);
    break;
  case CLIPBOARD_CHANGED:
    applyNewClipboard(backGate);
    break;
  case KEYBOARD_EVENT:
    applyKeyEvent(backGate);
    break;
  case USER_INFO_REQ:
    ansUserInfo(backGate);
    break;
  case USER_INPUT_INIT:
    serverInit(backGate);
    break;
  default:
    StringStorage errMess;
    errMess.format(_T("Unknown %d protocol code received")
                   _T(" from a UserInputClient"), reqCode);
    throw Exception(errMess.getString());
    break;
  }
}
开发者ID:kaseya,项目名称:tightvnc2,代码行数:26,代码来源:UserInputServer.cpp

示例13: setInt

bool IniFileSettingsManager::setInt(const TCHAR *name, int value)
{
  StringStorage stringVal;
  stringVal.format(_T("%d"), value);

  return setString(name, stringVal.getString());
}
开发者ID:Aliceljm1,项目名称:TightVNC-1,代码行数:7,代码来源:IniFileSettingsManager.cpp

示例14: 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;
  }
}
开发者ID:Aliceljm1,项目名称:TightVNC-1,代码行数:26,代码来源:WsConfigRunner.cpp

示例15: getServerInfoMsgRcvd

void ControlClient::getServerInfoMsgRcvd()
{
  bool acceptFlag = false;
  bool serviceFlag = false;

  StringStorage logPath;
  StringStorage statusText;

  TvnServerInfo info;

  TvnServer::getInstance()->getServerInfo(&info);

  StringStorage status;
  {
    AutoLock al(&m_tcpDispValuesMutex);
    if (m_tcpDispId != 0) {
      status.format(_T("[ID = %u] %s"),
                    m_tcpDispId,
                    info.m_statusText.getString());
    } else {
      status.setString(info.m_statusText.getString());
    }
  }

  m_gate->writeUInt32(ControlProto::REPLY_OK);

  m_gate->writeUInt8(info.m_acceptFlag ? 1 : 0);
  m_gate->writeUInt8(info.m_serviceFlag ? 1 : 0);
  m_gate->writeUTF8(status.getString());
}
开发者ID:heroyin,项目名称:qmlvncviewer,代码行数:30,代码来源:ControlClient.cpp


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