コード例 #1
0
ファイル: Xr_ini.cpp プロジェクト: vasilenkomike/xray
void CInifile::save_as	(IWriter& writer)
{
    string4096		temp,val;
    for (RootIt r_it=DATA.begin(); r_it!=DATA.end(); ++r_it)
    {
        sprintf_s		(temp,sizeof(temp),"[%s]",*(*r_it)->Name);
        writer.w_string	(temp);
        for (SectCIt s_it=(*r_it)->Data.begin(); s_it!=(*r_it)->Data.end(); ++s_it)
        {
            const Item&	I = *s_it;
            if (*I.first)
            {
                if (*I.second) {
                    _decorate	(val,*I.second);
#ifdef DEBUG
                    if (*I.comment) {
                        // name, value and comment
                        sprintf_s	(temp,sizeof(temp),"%8s%-32s = %-32s ;%s"," ",*I.first,val,*I.comment);
                    } else
#endif
                    {
                        // only name and value
                        sprintf_s	(temp,sizeof(temp),"%8s%-32s = %-32s"," ",*I.first,val);
                    }
                } else {
#ifdef DEBUG
                    if (*I.comment) {
                        // name and comment
                        sprintf_s(temp,sizeof(temp),"%8s%-32s = ;%s"," ",*I.first,*I.comment);
                    } else
#endif
                    {
                        // only name
                        sprintf_s(temp,sizeof(temp),"%8s%-32s = "," ",*I.first);
                    }
                }
            } else {
                // no name, so no value
#ifdef DEBUG
                if (*I.comment)
                    sprintf_s		(temp,sizeof(temp),"%8s;%s"," ",*I.comment);
                else
#endif
                    temp[0]		= 0;
            }
            _TrimRight			(temp);
            if (temp[0])		writer.w_string	(temp);
        }
        writer.w_string			(" ");
    }
}
コード例 #2
0
ファイル: UIGameLog.cpp プロジェクト: OLR-xray/OLR-3.0
void CUIGameLog::AddChatMessage(LPCSTR msg, LPCSTR author){
	string256 fullLine;
	sprintf_s(fullLine, "%s %s", author, msg);
	_TrimRight	(fullLine);
    
	CUIStatic* pItem = NULL;

	pItem = xr_new<CUIStatic>();
	pItem->SetTextComplexMode		(true);
	pItem->SetText(fullLine);
    pItem->m_pLines->SetCutWordsMode(true);
	pItem->SetFont(GetFont());
	pItem->SetTextColor(txt_color);
	pItem->SetClrAnimDelay(5000.0f);
	pItem->SetClrLightAnim(CHAT_LOG_ITEMS_ANIMATION, false, true, true, true);	
	pItem->SetWidth(this->GetDesiredChildWidth());
	pItem->AdjustHeightToText();
	AddWindow(pItem, true);	
}
コード例 #3
0
ファイル: xr_trims.cpp プロジェクト: BubbaXXX/xray-16
LPSTR _Trim(LPSTR str)
{
    _TrimLeft(str);
    _TrimRight(str);
    return str;
}
コード例 #4
0
ファイル: xr_trims.cpp プロジェクト: BubbaXXX/xray-16
xr_string& _Trim(xr_string& str)
{
    _TrimLeft(str);
    _TrimRight(str);
    return str;
}
コード例 #5
0
ファイル: Xr_ini.cpp プロジェクト: OLR-xray/OLR-3.0
bool	CInifile::save_as( LPCSTR new_fname )
{
	// save if needed
    if (new_fname&&new_fname[0]){
        xr_free			(fName);
        fName			= xr_strdup(new_fname);
    }
    R_ASSERT			(fName&&fName[0]);
    IWriter* F			= FS.w_open_ex(fName);
    if (F){
        string512		temp,val;
        for (RootIt r_it=DATA.begin(); r_it!=DATA.end(); ++r_it)
		{
            sprintf_s		(temp,sizeof(temp),"[%s]",*(*r_it)->Name);
            F->w_string	(temp);
            for (SectCIt s_it=(*r_it)->Data.begin(); s_it!=(*r_it)->Data.end(); ++s_it)
            {
                const Item&	I = *s_it;
                if (*I.first) {
                    if (*I.second) {
                        _decorate	(val,*I.second);
#ifdef DEBUG
                        if (*I.comment) {
                            // name, value and comment
                            sprintf_s	(temp,sizeof(temp),"%8s%-32s = %-32s ;%s"," ",*I.first,val,*I.comment);
                        } else
#endif
						{
                            // only name and value
                            sprintf_s	(temp,sizeof(temp),"%8s%-32s = %-32s"," ",*I.first,val);
                        }
                    } else {
#ifdef DEBUG
                        if (*I.comment) {
                            // name and comment
                            sprintf_s(temp,sizeof(temp),"%8s%-32s = ;%s"," ",*I.first,*I.comment);
                        } else
#endif
						{
                            // only name
                            sprintf_s(temp,sizeof(temp),"%8s%-32s = "," ",*I.first);
                        }
                    }
                } else {
                    // no name, so no value
#ifdef DEBUG
                    if (*I.comment)
						sprintf_s		(temp,sizeof(temp),"%8s;%s"," ",*I.comment);
                    else
#endif
						temp[0]		= 0;
                }
                _TrimRight			(temp);
                if (temp[0])		F->w_string	(temp);
            }
            F->w_string		(" ");
        }
        FS.w_close			(F);
	    return true;
    }
    return false;
}