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


C++ FormatString函数代码示例

本文整理汇总了C++中FormatString函数的典型用法代码示例。如果您正苦于以下问题:C++ FormatString函数的具体用法?C++ FormatString怎么用?C++ FormatString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: DepthWriteMaskFromString

	DEPTH_WRITE_MASK DepthWriteMaskFromString(const char* str)
	{
		if (!str)
			return DEPTH_WRITE_MASK_ALL;
		if (_stricmp(str, "DEPTH_WRITE_MASK_ZERO") == 0)
		{
			return DEPTH_WRITE_MASK_ZERO;
		}

		if (_stricmp(str, "DEPTH_WRITE_MASK_ALL") == 0)
		{
			return DEPTH_WRITE_MASK_ALL;
		}

		Logger::Log(FB_ERROR_LOG_ARG, FormatString("%s is not valid DepthWriteMask", str).c_str());
		return DEPTH_WRITE_MASK_ALL;
	}
开发者ID:fastbird,项目名称:fastbirdEngine,代码行数:17,代码来源:RendererEnums.cpp

示例2: FormatString

void T3DObjectClock::render_exec_calendar(Trendercontext *rc, TSC_time &disptime, double size)
{
	try{
		QString content,monthstring;

		monthnames->get(disptime.G_month()-1)->tostring(monthstring,0);

		FormatString(content,_qstr("^1 "),disptime.G_day());
		content+=_TRL(monthstring);

		render_exec_string(rc,content);
	}
	catch(QError &)
	{
		throw QError(_text("Error while constructing calendar info"));
	}
}
开发者ID:pvaut,项目名称:Z-Flux,代码行数:17,代码来源:3dclock.cpp

示例3: python_call_function

int python_call_function(void)
{
    if( !python_is_initialised_check() )
        return 0;

    if( check_args( 1, 1+EmacsPythonCallCommand::MAX_ARGS ) )
        return 0;

    EmacsPythonCallCommand py_command;
    if( !string_arg( 1 ) )
        return 0;

    py_command.python_function = ml_value.asString();

    const int first_arg = 2;
    py_command.num_args = cur_exec->p_nargs - 1;
    for( int arg=first_arg; !ml_err && arg<=cur_exec->p_nargs; arg++ )
    {
        if( !eval_arg( arg ) )
            return 0;

        switch( ml_value.exp_type() )
        {
        case ISINTEGER:
        case ISSTRING:
            py_command.python_args[ arg - first_arg ] = ml_value;
            break;

        case ISVOID:
        case ISMARKER:
        case ISWINDOWS:
        case ISARRAY:
            error( FormatString("Python-call - unsupported expression type for arg %d") << arg );
            return 0;
        }
    }

    py_command.executeCommand();

    if( py_command.failed() )
        error( py_command.failureReason() );
    else
        ml_value = py_command.getResult();

    return 0;
}
开发者ID:barry-scott,项目名称:BarrysEmacs,代码行数:46,代码来源:emacs_python_interface.cpp

示例4: output

static void output(bool traceInDebugOnly, DebugTraceOutputType outputType, const char *format, va_list vararg)
{
#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
    static std::vector<char> buffer(512);

    if (perfActive())
    {
        size_t len = FormatStringIntoVector(format, vararg, buffer);
        std::wstring formattedWideMessage(buffer.begin(), buffer.begin() + len);

        switch (outputType)
        {
            case DebugTraceOutputTypeNone:
                break;
            case DebugTraceOutputTypeBeginEvent:
                g_DebugAnnotationWrapper->beginEvent(formattedWideMessage);
                break;
            case DebugTraceOutputTypeSetMarker:
                g_DebugAnnotationWrapper->setMarker(formattedWideMessage);
                break;
        }
    }
#endif // ANGLE_ENABLE_DEBUG_ANNOTATIONS

#if defined(ANGLE_ENABLE_DEBUG_TRACE)
#if defined(NDEBUG)
    if (traceInDebugOnly)
    {
        return;
    }
#endif // NDEBUG
    std::string formattedMessage = FormatString(format, vararg);

    static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
    if (file)
    {
        file.write(formattedMessage.c_str(), formattedMessage.length());
        file.flush();
    }

#if defined(ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER)
    OutputDebugStringA(formattedMessage.c_str());
#endif // ANGLE_ENABLE_DEBUG_TRACE_TO_DEBUGGER

#endif // ANGLE_ENABLE_DEBUG_TRACE
}
开发者ID:AOSC-Dev,项目名称:Pale-Moon,代码行数:46,代码来源:debug.cpp

示例5: Lock

bool C4Network2IRCClient::OnConn(const C4NetIO::addr_t &AddrPeer, const C4NetIO::addr_t &AddrConnect, const addr_t *pOwnAddr, C4NetIO *pNetIO)
	{
	// Security checks
	if(!fConnecting || fConnected || !AddrEqual(AddrConnect, ServerAddr)) return false;
	CStdLock Lock(&CSec);
	// Save connection data
	fConnected = true;
	fConnecting = false;
	C4Network2IRCClient::PeerAddr = AddrPeer;
	// Send welcome message
	if(!Password.isNull())
		Send("PASS", Password.getData());
	Send("NICK", Nick.getData());
	Send("USER", FormatString("clonk x x :%s", RealName.getData()).getData());
	// Okay
	return true;
	}
开发者ID:Marko10-000,项目名称:clonk-rage,代码行数:17,代码来源:C4Network2IRC.cpp

示例6: GetCallbackScript

C4Value C4Effect::DoCall(C4PropList *pObj, const char *szFn, const C4Value &rVal1, const C4Value &rVal2, const C4Value &rVal3, const C4Value &rVal4, const C4Value &rVal5, const C4Value &rVal6, const C4Value &rVal7)
{
	C4PropList * p = GetCallbackScript();
	if (!p)
	{
		C4AulFunc * fn = GetFunc(szFn);
		if (fn) return fn->Exec(this, &C4AulParSet(rVal1, rVal2, rVal3, rVal4, rVal5, rVal6, rVal7));
	}
	else
	{
		// old variant
		// compose function name
		C4AulFunc * fn = p->GetFunc(FormatString(PSF_FxCustom, GetName(), szFn).getData());
		if (fn) return fn->Exec(p, &C4AulParSet(Obj(pObj), this, rVal1, rVal2, rVal3, rVal4, rVal5, rVal6, rVal7));
	}
	return C4Value();
}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:17,代码来源:C4Effect.cpp

示例7: catch

void CapturedAPICalls::PlayOverride(CaptureOverride* pCO)
{
    unsigned int i = 0;

    try
    {
        for (CaptureList::iterator iter = m_captureList.begin(); iter != m_captureList.end(); ++iter)
        {
            (*iter)->PlayOverride(pCO);
            ++i;
        }
    }
    catch (...)
    {
        OSWrappers::MessageBox(FormatString("Exception on %i", i).c_str(), (const char*)"exception!", 0);
    }
}
开发者ID:PlusChie,项目名称:CodeXL,代码行数:17,代码来源:CaptureStream.cpp

示例8: C4ControlScript

C4GUI::Edit::InputResult C4ChatInputDialog::OnChatInput(C4GUI::Edit *edt,
                                                        bool fPasting,
                                                        bool fPastingMore) {
  // no double processing
  if (fProcessed) return C4GUI::Edit::IR_CloseDlg;
  // get edit text
  C4GUI::Edit *pEdt = reinterpret_cast<C4GUI::Edit *>(edt);
  char *szInputText = const_cast<char *>(pEdt->GetText());
  // Store to back buffer
  Game.MessageInput.StoreBackBuffer(szInputText);
  // script queried input?
  if (fObjInput) {
    fProcessed = true;
    // check if the target input is still valid
    C4Player *pPlr = Game.Players.Get(iPlr);
    if (!pPlr) return C4GUI::Edit::IR_CloseDlg;
    if (!pPlr->MarkMessageBoardQueryAnswered(pTarget)) {
      // there was no associated query!
      return C4GUI::Edit::IR_CloseDlg;
    }
    // then do a script callback, incorporating the input into the answer
    if (fUppercase) SCapitalize(szInputText);
    StdStrBuf sInput;
    sInput.Copy(szInputText);
    sInput.EscapeString();
    Game.Control.DoInput(
        CID_Script,
        new C4ControlScript(
            FormatString("OnMessageBoardAnswer(Object(%d), %d, \"%s\")",
                         pTarget ? pTarget->Number : 0, iPlr,
                         sInput.getData()).getData()),
        CDT_Decide);
    return C4GUI::Edit::IR_CloseDlg;
  } else
    // reroute to message input class
    Game.MessageInput.ProcessInput(szInputText);
  // safety: message board commands may do strange things
  if (!C4GUI::IsGUIValid() || this != pInstance) return C4GUI::Edit::IR_Abort;
  // select all text to be removed with next keypress
  // just for pasting mode; usually the dlg will be closed now anyway
  pEdt->SelectAll();
  // avoid dlg close, if more content is to be pasted
  if (fPastingMore) return C4GUI::Edit::IR_None;
  fProcessed = true;
  return C4GUI::Edit::IR_CloseDlg;
}
开发者ID:ev1313,项目名称:yaC,代码行数:46,代码来源:C4MessageInput.cpp

示例9: registrateMethods

GraphicEngine::GraphicEngine(Game *game)
{
	this->game = game;
	needSaveScreenShot = false;
	renderWhireFrame = false;	  
	registrateMethods("game");
	blockDebugTexts = false;
	lightingEnabled = true;
	renderFilter = new PlatformerRenderFilter(CVector(500, 400));

#ifndef IPHONE_OS
	GLenum err = glewInit();
	if (GLEW_OK != err) {
	  Log::error(FormatString("Error: %s\n", glewGetErrorString(err)));
	}
#endif
}
开发者ID:muhaos,项目名称:MHEngine,代码行数:17,代码来源:GraphicEngine.cpp

示例10: C4FileSelDlg

C4PortraitSelDlg::C4PortraitSelDlg(C4FileSel_BaseCB *pSelCallback,
                                   bool fSetPicture, bool fSetBigIcon)
    : C4FileSelDlg(Config.General.ExePath,
                   FormatString(LoadResStr("IDS_MSG_SELECT"),
                                LoadResStr("IDS_TYPE_PORTRAIT")).getData(),
                   pSelCallback, false),
      pCheckSetPicture(NULL),
      pCheckSetBigIcon(NULL),
      fDefSetPicture(fSetPicture),
      fDefSetBigIcon(fSetBigIcon) {
  char path[_MAX_PATH + 1];
  // add common picture locations
  StdStrBuf strLocation;
  SCopy(Config.AtUserPath(""), path, _MAX_PATH);
  TruncateBackslash(path);
  strLocation.Format("%s %s", C4ENGINECAPTION, LoadResStr("IDS_TEXT_USERPATH"));
  AddLocation(strLocation.getData(), path);
  SCopy(Config.AtExePath(""), path, _MAX_PATH);
  TruncateBackslash(path);
  strLocation.Format("%s %s", C4ENGINECAPTION,
                     LoadResStr("IDS_TEXT_PROGRAMDIRECTORY"));
  AddCheckedLocation(strLocation.getData(), Config.General.ExePath);
#ifdef _WIN32
  if (SHGetSpecialFolderPath(NULL, path, CSIDL_PERSONAL, FALSE))
    AddCheckedLocation(LoadResStr("IDS_TEXT_MYDOCUMENTS"), path);
  if (SHGetSpecialFolderPath(NULL, path, CSIDL_MYPICTURES, FALSE))
    AddCheckedLocation(LoadResStr("IDS_TEXT_MYPICTURES"), path);
  if (SHGetSpecialFolderPath(NULL, path, CSIDL_DESKTOPDIRECTORY, FALSE))
    AddCheckedLocation(LoadResStr("IDS_TEXT_DESKTOP"), path);
#endif
#ifdef __APPLE__
  AddCheckedLocation(LoadResStr("IDS_TEXT_HOME"), getenv("HOME"));
#else
  AddCheckedLocation(LoadResStr("IDS_TEXT_HOMEFOLDER"), getenv("HOME"));
#endif
#ifndef _WIN32
  sprintf(path, "%s%c%s", getenv("HOME"), (char)DirectorySeparator,
          (const char *)"Desktop");
  AddCheckedLocation(LoadResStr("IDS_TEXT_DESKTOP"), path);
#endif
  // build dialog
  InitElements();
  // select last location
  SetCurrentLocation(Config.Startup.LastPortraitFolderIdx, false);
}
开发者ID:ev1313,项目名称:yaC,代码行数:45,代码来源:C4FileSelDlg.cpp

示例11: FileExists

bool C4Shader::Refresh(const char *szWhat, const char **szUniforms)
{
	// Find a slice where the source file has updated
	ShaderSliceList::iterator pSlice;
	for (pSlice = FragmentSlices.begin(); pSlice != FragmentSlices.end(); pSlice++)
		if (pSlice->Source.getLength() &&
			FileExists(pSlice->Source.getData()) &&
			FileTime(pSlice->Source.getData()) > pSlice->SourceTime)
			break;
	if (pSlice == FragmentSlices.end()) return true;
	StdCopyStrBuf Source = pSlice->Source;

	// Okay, remove all slices that came from this file
	ShaderSliceList::iterator pNext;
	for (; pSlice != FragmentSlices.end(); pSlice = pNext)
	{
		pNext = pSlice; pNext++;
		if (SEqual(pSlice->Source.getData(), Source.getData()))
			FragmentSlices.erase(pSlice);
	}

	// Load new shader
	char szParentPath[_MAX_PATH+1]; C4Group Group;
	StdStrBuf Shader;
	GetParentPath(Source.getData(),szParentPath);
	if(!Group.Open(szParentPath) ||
	   !Group.LoadEntryString(GetFilename(Source.getData()),&Shader) ||
	   !Group.Close())
	{
		ShaderLogF("  gl: Failed to refresh %s shader from %s!", szWhat, Source.getData());
		return Refresh(szWhat, szUniforms);
	}

	// Load slices
	int iSourceTime = FileTime(Source.getData());
	StdStrBuf WhatSrc = FormatString("file %s", Config.AtRelativePath(Source.getData()));
	AddFragmentSlices(WhatSrc.getData(), Shader.getData(), Source.getData(), iSourceTime);

	// Reinitialise
	if (!Init(szWhat, szUniforms))
		return false;

	// Retry
	return Refresh(szWhat, szUniforms);
}
开发者ID:772,项目名称:openclonk,代码行数:45,代码来源:C4Shader.cpp

示例12: Log

bool C4PlayerList::RemoveLocal(bool fDisconnect, bool fNoCalls)
{
	// (used by league system the set local fate)
	C4Player *pPlr;
	do
		for (pPlr = First; pPlr; pPlr = pPlr->Next)
			if (pPlr->LocalControl)
			{
				// Log
				Log(FormatString(LoadResStr("IDS_PRC_REMOVEPLR"),pPlr->GetName()).getData());
				// Remove
				Remove(pPlr, fDisconnect, fNoCalls);
				break;
			}
	while (pPlr);

	return true;
}
开发者ID:sarah-russell12,项目名称:openclonk,代码行数:18,代码来源:C4PlayerList.cpp

示例13: re_search_reverse_helper

int re_search_reverse_helper( EmacsSearch::sea_type RE )
{
    int np;
    EmacsString str;
    if( arg <= 0 )
        arg = 1;
    if( RE == EmacsSearch::sea_type__RE_extended )
        str = getstr("Reverse ERE search for: ");
    else
        str = getstr("Reverse RE search for: ");
    np = sea_glob.search( str, -arg, dot, RE );
    if( np == 0 && ! ml_err )
        error(FormatString("Cannot find \"%s\"") << last_search_string.asString() );
    else
        if( np > 0 )
            set_dot( np );
    return 0;
}
开发者ID:barry-scott,项目名称:BarrysEmacs,代码行数:18,代码来源:search.cpp

示例14: erase_region

int erase_region( void )
{
    if( !bf_cur->b_mark.isSet() )
        error( FormatString(no_mark_set_str) << bf_cur->b_buf_name);
    else
    {
        int n = bf_cur->b_mark.to_mark() - dot;

        if( n < 0 )
        {
            n = -n;
            dot_left (n);
        }
        bf_cur->del_frwd( dot, n );
    }

    return 0;
}
开发者ID:barry-scott,项目名称:BarrysEmacs,代码行数:18,代码来源:simpcomm.cpp

示例15: left_or_right_marker

static int left_or_right_marker( int right )
{
    if( !eval_arg( 1 ) )
        return 0;

    if( ml_value.exp_type() != ISMARKER )
    {
        error( FormatString("%s expects its argument to be a marker") <<
            cur_exec->p_proc->b_proc_name );
        return 0;
    }

    int n = ml_value.asMarker()->get_mark();
    Marker *m = EMACS_NEW Marker( bf_cur, n, right );
    ml_value = m;

    return 0;
}
开发者ID:barry-scott,项目名称:BarrysEmacs,代码行数:18,代码来源:simpcomm.cpp


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