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


C++ String::Append方法代码示例

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


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

示例1: DumpCore

 void DumpCore( String & s, char const * buf, int len )
 {
     for( int i = 0; i < len; ++i )
     {
         uint8 c = buf[ i ];
         if( c < 32 || c > 126 ) s.Append( '.' );
         else s.Append( (char)c );
     }
 }
开发者ID:denghe,项目名称:69net,代码行数:9,代码来源:BufferUtils.cpp

示例2: GetBitmapN

Bitmap * LangSetting::GetIconN(Locale & lc)
{
	String name = L"ic_";
	name.Append(lc.GetCountryCodeString());
	name.Append(L".png");
	name.ToLowerCase();

	return Utils::GetBitmapN(name);
}
开发者ID:m1uan,项目名称:voc4u_bada,代码行数:9,代码来源:LangSetting.cpp

示例3: replace_macro_tokens

void replace_macro_tokens(const char *text, String &fixed_text) {
    const char*curptr=&text[0];
    char tmpm[3];
    const char*endat = curptr + strlen(text);
    fixed_text.Empty();
    char tempo[STD_BUFFER_SIZE];

    while (1) {
        if (curptr[0]==0) break;
        if (curptr>=endat) break;
        if (curptr[0]=='@') {
            const char *curptrWasAt = curptr;
            char macroname[21]; int idd=0; curptr++;
            for (idd=0;idd<20;idd++) {
                if (curptr[0]=='@') {
                    macroname[idd]=0;
                    curptr++;
                    break;
                }
                // unterminated macro (eg. "@SCORETEXT"), so abort
                if (curptr[0] == 0)
                    break;
                macroname[idd]=curptr[0];
                curptr++;
            }
            macroname[idd]=0; 
            tempo[0]=0;
            if (stricmp(macroname,"score")==0)
                sprintf(tempo,"%d",play.score);
            else if (stricmp(macroname,"totalscore")==0)
                sprintf(tempo,"%d",MAXSCORE);
            else if (stricmp(macroname,"scoretext")==0)
                sprintf(tempo,"%d of %d",play.score,MAXSCORE);
            else if (stricmp(macroname,"gamename")==0)
                strcpy(tempo, play.game_name);
            else if (stricmp(macroname,"overhotspot")==0) {
                // While game is in Wait mode, no overhotspot text
                if (!IsInterfaceEnabled())
                    tempo[0] = 0;
                else
                    GetLocationName(divide_down_coordinate(mousex), divide_down_coordinate(mousey), tempo);
            }
            else { // not a macro, there's just a @ in the message
                curptr = curptrWasAt + 1;
                strcpy(tempo, "@");
            }

            fixed_text.Append(tempo);
        }
        else {
            tmpm[0]=curptr[0]; tmpm[1]=0;
            fixed_text.Append(tmpm);
            curptr++;
        }
    }
}
开发者ID:ya-isakov,项目名称:ags,代码行数:56,代码来源:gui.cpp

示例4: WriteClassDeclaration

void JSBModule::WriteClassDeclaration(String& source)
{

    source += "static void jsb_declare_classes(JSVM* vm)\n{\n";

    source += "duk_context* ctx = vm->GetJSContext();\n";

    for (unsigned i = 0; i < classes_.Size(); i++)
    {
        JSBClass* klass = classes_.At(i);

        if (klass->isNumberArray())
            continue;

        source.AppendWithFormat("   js_class_declare(vm, \"%s\", jsb_constructor_%s);\n", klass->GetName().CString(), klass->GetName().CString());

        if (klass->hasProperties())
        {
            source.AppendWithFormat("js_class_push_propertyobject(vm, \"%s\");\n", klass->GetName().CString());


            Vector<String> pnames;
            klass->GetPropertyNames(pnames);

            for (unsigned j = 0; j < pnames.Size(); j++)
            {
                JSBProperty* prop = klass->GetProperty(pnames[j]);

                source.Append("duk_push_object(ctx);\n");

                if (prop->getter_ && !prop->getter_->Skip())
                {
                    source.AppendWithFormat("duk_push_c_function(ctx, jsb_class_%s_%s, 0);\n",
                                            klass->GetName().CString(), prop->getter_->name_.CString());
                    source.Append("duk_put_prop_string(ctx, -2, \"get\");\n");
                }
                if (prop->setter_ && !prop->setter_->Skip())
                {
                    source.AppendWithFormat("duk_push_c_function(ctx, jsb_class_%s_%s, 1);\n",
                                            klass->GetName().CString(), prop->setter_->name_.CString());
                    source.Append("duk_put_prop_string(ctx, -2, \"set\");\n");
                }

                pnames[j][0] = tolower(pnames[j][0]);
                source.AppendWithFormat("duk_put_prop_string(ctx, -2, \"%s\");\n", pnames[j].CString());

            }

            source.Append("duk_pop(ctx);\n");

        }
    }

    source += "\n}\n\n";

}
开发者ID:slagusev,项目名称:AtomicGameEngine,代码行数:56,代码来源:JSBModule.cpp

示例5: SplashStatInit

void GameEconomicGameClientStateSplash::SplashStatInit(void)
{
/// Get Needed SubSystems
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    Renderer* renderer = GetSubsystem<Renderer>();
    Graphics* graphics = GetSubsystem<Graphics>();
    UI* ui = GetSubsystem<UI>();

    FileSystem * filesystem = GetSubsystem<FileSystem>();

    /// Create variables (urho3d)
    String InputDataFile;

    InputDataFile.Append(filesystem->GetProgramDir().CString());
    InputDataFile.Append("Resources/Scenes/");
    InputDataFile.Append("Login1.xml");

    bool success;
    /// Check if the input data file exist
    if(filesystem->FileExists(InputDataFile))
    {
        /// Open file as a Urho3d Datafile
        dataFile = new File(context_, InputDataFile, FILE_READ);

        if (dataFile -> IsOpen())
        {

            /// Get File Extension
            String extension = GetExtension(InputDataFile);


            /// Determine file extension
            if (extension != ".xml")
            {
                ///success= Existence-> scene_ -> Load(dataFile);
                success = Existence-> scene_ -> LoadAsync(dataFile);
            }
            else
            {
                success= Existence-> scene_ ->LoadAsyncXML(dataFile);
            }
        }
        else
        {
            /// set is error
            success=false;
        }

    }

    /// on update
    SubscribeToEvent(E_UPDATE, HANDLER(GameEconomicGameClientStateSplash, HandlerSplashUpdate)); // Keep visible until rendering of the scene

    return;
}
开发者ID:vivienneanthony,项目名称:Urho3D-gameeconomic,代码行数:55,代码来源:GameEconomicGameClientStateSplash.cpp

示例6: quit_check_for_error_state

QuitReason quit_check_for_error_state(const char *&qmsg, String &alertis)
{
    if (qmsg[0]=='|')
    {
        return kQuit_GameRequest;
    }
    else if (qmsg[0]=='!')
    {
        QuitReason qreason;
        qmsg++;

        if (qmsg[0] == '|')
        {
            qreason = kQuit_UserAbort;
            alertis = "Abort key pressed.\n\n";
        }
        else if (qmsg[0] == '?')
        {
            qmsg++;
            qreason = kQuit_ScriptAbort;
            alertis = "A fatal error has been generated by the script using the AbortGame function. Please contact the game author for support.\n\n";
        }
        else
        {
            qreason = kQuit_GameError;
            alertis.Format("An error has occurred. Please contact the game author for support, as this "
                "is likely to be a scripting error and not a bug in AGS.\n"
                "(ACI version %s)\n\n", EngineVersion.LongString.GetCStr());
        }

        alertis.Append(get_cur_script(5));

        if (qreason != kQuit_UserAbort)
            alertis.Append("\nError: ");
        else
            qmsg = "";
        return qreason;
    }
    else if (qmsg[0] == '%')
    {
        qmsg++;
        alertis.Format("A warning has been generated. This is not normally fatal, but you have selected "
            "to treat warnings as errors.\n"
            "(ACI version %s)\n\n%s\n", EngineVersion.LongString.GetCStr(), get_cur_script(5));
        return kQuit_GameWarning;
    }
    else
    {
        alertis.Format("An internal error has occurred. Please note down the following information.\n"
        "If the problem persists, post the details on the AGS Technical Forum.\n"
        "(ACI version %s)\n"
        "\nError: ", EngineVersion.LongString.GetCStr());
        return kQuit_FatalError;
    }
}
开发者ID:AlanDrake,项目名称:ags,代码行数:55,代码来源:quit.cpp

示例7: ConfigureTitle

void GalleryForm::ConfigureTitle() {

	String newTitle;

	newTitle.Append(pGallery->GetCurrentItemIndex() + 1);
	newTitle.Append(L"/");
	newTitle.Append(pImagesPaths->GetCount());

	GetHeader()->SetTitleText(newTitle);

}
开发者ID:drstrangecode,项目名称:BadaImageGallery_SampleApp,代码行数:11,代码来源:GalleryForm.cpp

示例8: SaveConfiguration

/// Save account information to a file
void GameEconomicGameClient::SaveConfiguration(Configuration &configuration)
{
    /// Get Resource
    ResourceCache * cache = GetSubsystem<ResourceCache>();
    FileSystem * fileSystem = GetSubsystem<FileSystem>();

    String configFileName;

    /// Set directory and path for network file
    configFileName.Append(fileSystem->GetProgramDir().CString());
    configFileName.Append("");
    configFileName.Append("Configuration.xml");


    /// Check if the account file information exist
    if(fileSystem->FileExists(configFileName.CString()))
    {
        fileSystem->Delete(configFileName.CString());
    }

    cout << "It got here "<<endl;

    File saveFile(context_, configFileName.CString(), FILE_WRITE);

    XMLFile * preferencefileconfig  = new XMLFile(context_);

    XMLElement configElem = preferencefileconfig   -> CreateRoot("Configuration");
    XMLElement GameModeConfigurationElement = configElem.CreateChild("GameModeConfiguration");
    XMLElement VideoConfigurationElement= configElem.CreateChild("VideoConfiguration");

    /// Set true false
    if(configuration.GameModeForceTablet==true)
    {
        GameModeConfigurationElement.SetAttribute("GameModeForceTablet", "true");
    }
    else
    {
        GameModeConfigurationElement.SetAttribute("GameModeForceTablet", "false");
    }

    /// Convert video bloom to float
    String VideoBloomParamValue1String(configuration.VideoBloomParam1);
    String VideoBloomParamValue2String(configuration.VideoBloomParam2);

    /// Copy values testing
    VideoConfigurationElement.SetAttribute("BloomParam1",VideoBloomParamValue1String);
    VideoConfigurationElement.SetAttribute("BloomParam2",VideoBloomParamValue2String);

    preferencefileconfig->Save(saveFile);

    return;
}
开发者ID:vivienneanthony,项目名称:Urho3D-gameeconomic,代码行数:53,代码来源:GameEconomicGameClient.cpp

示例9: AsString

String PixInsightVersion::AsString( bool withCodename )
{
   Initialize();
   String v = String().Format( "PixInsight %s%02d.%02d.%02d.%04d",
               LE() ? "LE " : "", Major(), Minor(), Release(), Build() );
   if ( BetaRelease() != 0 )
      v.Append( String().Format( " %s%d", (BetaRelease() < 0) ? "RC" : "beta ", Abs( BetaRelease() ) ) );
   if ( withCodename )
      v.Append( ' ' + Codename() );
   if ( Confidential() )
      v.Append( " (confidential)" );
   return v;
}
开发者ID:aleixpuig,项目名称:PCL,代码行数:13,代码来源:Version.cpp

示例10: GetLastErrMsg

bool 	SFtpReader::isChkFile(const File& tFile)
{
	LIBSSH2_SFTP_ATTRIBUTES 	tAttr;
	if (libssh2_sftp_stat((LIBSSH2_SFTP*)_pSessionSFtp, (char*)tFile.sFullName.c_str(), &tAttr) == -1)
	{
		String	sMsg; string sErrMsg = GetLastErrMsg();
		sMsg.Append(_("File access error (%s), continue? !!!"), tFile.sFullName.c_str());
		if (!sErrMsg.empty()) sMsg.Append("[%s]", sErrMsg.c_str());
		MsgBox(_("Error"), sMsg.c_str());
		return false;
	}
	return true;
}
开发者ID:roderico,项目名称:linm,代码行数:13,代码来源:SFtpReader.cpp

示例11: GetLastError

bool	SFtpReader::Rename(File* pFile, const string& sRename)
{
	if (pFile == NULL) 
	{
		LOG_WRITE("Rename pFile is NULL !!!");
		return false;
	}

	string sRenameName = pFile->sName;
	if (sRenameName == "..") return false;

	if (sRename == "")
	{
		if (InputBox(_("Rename"), sRenameName) == ERROR) 
			return false;
	}
	else
		sRenameName = sRename;
	
	sRenameName = _sCurPath + sRenameName;

	LOG_WRITE("Rename - [%s] [%s]", pFile->sFullName.c_str(), sRenameName.c_str());

	if ( libssh2_sftp_rename_ex((LIBSSH2_SFTP*)_pSessionSFtp, 
								(char*)pFile->sFullName.c_str(), 
								pFile->sFullName.size(),
								(char*)sRenameName.c_str(),
								sRenameName.size(), 
								LIBSSH2_SFTP_RENAME_OVERWRITE |
								LIBSSH2_SFTP_RENAME_ATOMIC |
								LIBSSH2_SFTP_RENAME_NATIVE) == -1)
	{
		String	sMsg; string	sErrMsg;
		int		nRt = GetLastError( &sErrMsg );
		sMsg.Append(_("SFtp rename failure !!! [%s]"), sRename.c_str());
		if ( !sErrMsg.empty() ) sMsg.Append("%s", sErrMsg.c_str() );
		MsgBox(_("Error"), sMsg.c_str());
		
		if ( nRt == LIBSSH2_ERROR_SOCKET_TIMEOUT)
		{
			string sTmp = _sCurPath;
			Destroy();
			Init(_sInitFile);
			_sCurPath = sTmp;
		}
		return false;
	}
	return true;
}
开发者ID:roderico,项目名称:linm,代码行数:49,代码来源:SFtpReader.cpp

示例12: Evaluate

Value AndExpr::Evaluate(SymbolTable *scope, EvalContext& context, bool asbool)
{
	// Scope override; must do this for every expression that might contain an identifier
	if(this->scope != NULL)
		scope = this->scope;

	// Lowering A and B:
	//  [A]
	//  [iffalse goto end]
	//  [B]
	//  label end:

	String* value = new String();

	// Create internal label
	string labelbase = context.GetUniqueLabelName();
	Anchor* endanchor = new Anchor(labelbase + ".end");

	// Evaluate the first operand
	value->Append( a->Evaluate(scope, context, true).ToCodeString() );

	// Add a jump to the end if the first operand is false
	value->Code("1B 02 FF FF FF FF");
	value->AddReference(value->GetPos()-4, endanchor);

	// TODO:
	//  Hm. I just realized that some boolean expressions (and and or) rely on reference
	//  resolution to operate correctly. Thus, it doesn't make sense to use them in ROM
	//  write statements at the moment, because ROM write statements occur after normal
	//  resolution, but without doing any resolution themselves. Perhaps ROM write statements
	//  should have a special resolution step to take care of stuff like this. (Perhaps
	//  the ROM data itself should be represented as a ByteChunk, with refs?)
	//  Anyway, don't worry about this for now, since using boolean expressions in a ROM
	//  write statement is not a very likely usage scenario.
	// UPDATE: 11/11/2008
	//  This issue has been fixed by moving the evaluation of ROM write subexpressions
	//  back to the evaluation pass of the compiler, and simply caching the results and
	//  resolving references in a later pass. However, it still might be worthwhile to
	//  consider alternative solutions; whole-ROM resolution seems interesting for example.

	// Evaluate the second operand
	value->Append( b->Evaluate(scope, context, true).ToCodeString() );

	// Set the position of the end label
	value->AddAnchor(endanchor);

	return Value(value);
}
开发者ID:jeffman,项目名称:ccscript_legacy,代码行数:48,代码来源:ast.cpp

示例13: UpdateCalendarDisplay

bool ForUsDocForm::UpdateCalendarDisplay(void) {

	DateTime oldValue = __pSelectCalendar->GetTime();
	result r = E_SUCCESS;

	for (int i = 0; i < DAY_BUTTON_COUNT; i++) {
		r = __pDayBtn[i]->SetShowState(false);
		TryReturn(!IsFailed(r), false,
				"DayButton::SetShowStqte() failed with [%s]", GetErrorMessage(r));
	}
	r = __pSelectCalendar->SetTimeField(TIME_FIELD_DAY_OF_MONTH, 1);
	int offset = __pSelectCalendar->GetTimeField(TIME_FIELD_DAY_OF_WEEK) - 1;
	int date = __pSelectCalendar->GetTimeField(TIME_FIELD_DAY_OF_MONTH);

	int i = offset;
	do {
		String value(L"");
		value.Append(date);
		__pDayBtn[i]->SetEnabled(true);
		__pDayBtn[i]->SetText(value);
		r = __pDayBtn[i]->SetShowState(true);
		TryReturn(!IsFailed(r), false,
				"Button::SetShowState() failed with [%s]", GetErrorMessage(r));
		r = __pSelectCalendar->AddTimeField(TIME_FIELD_DAY_OF_MONTH, 1);
		TryReturn(!IsFailed(r), false,
				"Calendar::AddTimeField failed with [%s]", GetErrorMessage(r));
		date = __pSelectCalendar->GetTimeField(TIME_FIELD_DAY_OF_MONTH);

		i++;

	} while (date != 1 && i < DAY_BUTTON_COUNT);

	__pSelectCalendar->SetTime(oldValue);

	String year = L"";
	year.Append(__pSelectCalendar->GetTimeField(TIME_FIELD_YEAR));
	__pEditFields[0]->SetText(year);

	String month = L"";
	month.Append(__pSelectCalendar->GetTimeField(TIME_FIELD_MONTH));
	__pEditFields[1]->SetText(month);

	SetFocus();
	RequestRedraw(true);

	return true;

}
开发者ID:ajouSE-TeamE,项目名称:SE_TizenProgectTeamE,代码行数:48,代码来源:ForUsDocForm.cpp

示例14:

String BonkEnc::Utilities::LocalizeNumber(Int64 number)
{
	String	 nString = String::FromInt(number);
	String	 retVal;
	String	 separator;

	char	*buffer_a = new char [256];
	wchar_t	*buffer_w = new wchar_t [256];

	if (Setup::enableUnicode)	GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, buffer_w, 256);
	else				GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, buffer_a, 256);

	if (Setup::enableUnicode)	separator = buffer_w;
	else				separator = buffer_a;

	delete [] buffer_a;
	delete [] buffer_w;

	for (Int i = 0; i < nString.Length(); i++)
	{
		if ((nString.Length() - i) % 3 == 0 && i > 0) retVal.Append(separator);

		retVal[retVal.Length()] = nString[i];
	}

	return retVal;
}
开发者ID:michaelaw320,项目名称:YoutubeAudioSplitter,代码行数:27,代码来源:utilities.cpp

示例15: CreateDatabase

bool DatabaseForm::CreateDatabase(){

	Database pDatabase;
	String sql;
	String sql2;
	String statement;

	result r = E_SUCCESS;

	// create the database if it doesn't exist
	r = pDatabase.Construct(__databaseName, true);
	if (IsFailed(r)) return false;


	//pDatabase = new Database();
	//if (pDatabase == null) return false;
	//r = pDatabase->Construct(pDatabaseName,true);
	//if (IsFailed(r)) return false;

	// Create the main table
	sql.Append(L"CREATE TABLE IF NOT EXISTS movies (id INTEGER PRIMARY KEY AUTOINCREMENT, description TEXT)");
	r = pDatabase.ExecuteSql(sql, true);

	if (IsFailed(r)) return false;

	return true;
}
开发者ID:luiztiago,项目名称:bada-watchlist,代码行数:27,代码来源:DatabaseForm.cpp


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