Kaydet (Commit) 7045e4e1 authored tarafından Caolán McNamara's avatar Caolán McNamara

ByteString->rtl::OString

üst 5a0fd87d
......@@ -72,7 +72,7 @@ typedef boost::unordered_map<rtl::OString, PFormEntrys*, rtl::OStringHash>
typedef boost::unordered_map<rtl::OString, MergeData*, rtl::OStringHash>
MergeDataHashMap;
#define SOURCE_LANGUAGE ByteString("en-US")
#define SOURCE_LANGUAGE rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))
#define LIST_REFID "LIST_REFID"
typedef ByteStringHashMap ExportListEntry;
......@@ -139,11 +139,11 @@ public:
sal_Bool bRestMerged;
ByteString sResTyp;
ByteString sId;
ByteString sGId;
ByteString sHelpId;
ByteString sFilename;
rtl::OString sResTyp;
rtl::OString sId;
rtl::OString sGId;
rtl::OString sHelpId;
rtl::OString sFilename;
ByteStringHashMap sText;
sal_uInt16 nTextRefId;
......@@ -157,7 +157,7 @@ public:
ByteStringHashMap sTitle;
sal_uInt16 nTitleRefId;
ByteString sTextTyp;
rtl::OString sTextTyp;
ExportList *pStringList;
ExportList *pUIEntries;
......@@ -165,11 +165,11 @@ public:
ExportList *pFilterList;
ExportList *pPairedList;
ByteString sPForm;
rtl::OString sPForm;
void Dump();
ResData( const ByteString &rPF, const ByteString &rGId )
ResData(const rtl::OString &rPF, const rtl::OString &rGId)
:
nWidth( 0 ),
nChildIndex( 0 ),
......@@ -197,9 +197,9 @@ public:
{
sGId = comphelper::string::remove(sGId, '\r');
sPForm = comphelper::string::remove(sPForm, '\r');
};
}
ResData( const ByteString &rPF, const ByteString &rGId , const ByteString &rFilename )
ResData(const rtl::OString &rPF, const rtl::OString &rGId , const rtl::OString &rFilename)
:
nChildIndex( 0 ),
nIdLevel( ID_LEVEL_NULL ),
......@@ -227,7 +227,7 @@ public:
{
sGId = comphelper::string::remove(sGId, '\r');
sPForm = comphelper::string::remove(sPForm, '\r');
};
}
};
......@@ -435,21 +435,21 @@ class MergeData
{
friend class MergeDataFile;
private:
ByteString sTyp;
ByteString sGID;
ByteString sLID;
ByteString sFilename;
rtl::OString sTyp;
rtl::OString sGID;
rtl::OString sLID;
rtl::OString sFilename;
PFormEntrysHashMap aMap;
public:
MergeData( const ByteString &rTyp, const ByteString &rGID, const ByteString &rLID , const ByteString &rFilename )
MergeData( const rtl::OString &rTyp, const rtl::OString &rGID, const rtl::OString &rLID , const rtl::OString &rFilename )
: sTyp( rTyp ), sGID( rGID ), sLID( rLID ) , sFilename( rFilename ) {};
~MergeData();
PFormEntrys* GetPFormEntries();
void Insert( PFormEntrys* pfEntrys );
PFormEntrys* GetPFObject( const ByteString& rPFO );
PFormEntrys* GetPFObject( const rtl::OString &rPFO );
ByteString Dump();
rtl::OString Dump();
sal_Bool operator==( ResData *pData );
};
......
......@@ -118,7 +118,7 @@ public:
~GSIBlock();
void PrintMessage( ByteString aType, ByteString aMsg, ByteString aPrefix, ByteString aContext, sal_uLong nLine, ByteString aUniqueId = ByteString() );
void PrintError( ByteString aMsg, ByteString aPrefix, ByteString aContext, sal_uLong nLine, ByteString aUniqueId = ByteString() );
void InsertLine( GSILine* pLine, const ByteString aSourceLang);
void InsertLine( GSILine* pLine, const rtl::OString &rSourceLang);
void SetReferenceLine( GSILine* pLine );
sal_Bool CheckSyntax( sal_uLong nLine, sal_Bool bRequireSourceLine, sal_Bool bFixTags );
......
......@@ -79,18 +79,18 @@ explicit TokenInfo( TokenId pnId, sal_uInt16 nP, String paStr, ParserMessageL
/**
Is the property to be ignored or does it have the default value anyways
**/
sal_Bool IsPropertyRelevant( const ByteString &aName, const String &aValue ) const;
sal_Bool IsPropertyValueValid( const ByteString &aName, const String &aValue ) const;
sal_Bool IsPropertyRelevant( const rtl::OString &rName, const String &rValue ) const;
sal_Bool IsPropertyValueValid( const rtl::OString &rName, const String &rValue ) const;
/**
Does the property contain the same value for all languages
e.g.: the href in a link tag
**/
sal_Bool IsPropertyInvariant( const ByteString &aName, const String &aValue ) const;
sal_Bool IsPropertyInvariant( const rtl::OString &rName, const String &rValue ) const;
/**
a subset of IsPropertyInvariant but containing only those that are fixable
we dont wat to fix e.g.: ahelp :: visibility
**/
sal_Bool IsPropertyFixable( const ByteString &aName ) const;
sal_Bool IsPropertyFixable( const rtl::OString &rName ) const;
sal_Bool MatchesTranslation( TokenInfo& rInfo, sal_Bool bGenErrors, ParserMessageList &rErrorList, sal_Bool bFixTags = sal_False ) const;
sal_Bool IsDone() const { return bDone; }
......@@ -108,8 +108,8 @@ private:
public:
~ParserMessageList() { clear(); }
void AddError( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag );
void AddWarning( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag );
void AddError( sal_uInt16 nErrorNr, const rtl::OString& rErrorText, const TokenInfo &rTag );
void AddWarning( sal_uInt16 nErrorNr, const rtl::OString& rErrorText, const TokenInfo &rTag );
sal_Bool HasErrors();
bool empty() const { return maList.empty(); }
......@@ -212,8 +212,8 @@ private:
TokenList& operator =( const TokenList& rList );
public:
TokenList() {};
~TokenList(){ clear(); };
TokenList() {}
~TokenList(){ clear(); }
size_t size() const { return maList.size(); }
void clear()
......@@ -244,40 +244,40 @@ public:
class ParserMessage
{
sal_uInt16 nErrorNr;
ByteString aErrorText;
rtl::OString aErrorText;
sal_uInt16 nTagBegin,nTagLength;
protected:
ParserMessage( sal_uInt16 PnErrorNr, ByteString PaErrorText, const TokenInfo &rTag );
ParserMessage( sal_uInt16 PnErrorNr, const rtl::OString &rPaErrorText, const TokenInfo &rTag );
public:
sal_uInt16 GetErrorNr() { return nErrorNr; }
ByteString GetErrorText() { return aErrorText; }
rtl::OString GetErrorText() { return aErrorText; }
sal_uInt16 GetTagBegin() { return nTagBegin; }
sal_uInt16 GetTagLength() { return nTagLength; }
virtual ~ParserMessage() {}
virtual sal_Bool IsError() =0;
virtual ByteString Prefix() =0;
virtual rtl::OString Prefix() =0;
};
class ParserError : public ParserMessage
{
public:
ParserError( sal_uInt16 PnErrorNr, ByteString PaErrorText, const TokenInfo &rTag );
ParserError( sal_uInt16 PnErrorNr, const rtl::OString &rPaErrorText, const TokenInfo &rTag );
virtual sal_Bool IsError() {return sal_True;};
virtual ByteString Prefix() {return "Error:"; };
virtual sal_Bool IsError() {return sal_True;}
virtual rtl::OString Prefix() {return rtl::OString(RTL_CONSTASCII_STRINGPARAM("Error:")); }
};
class ParserWarning : public ParserMessage
{
public:
ParserWarning( sal_uInt16 PnErrorNr, ByteString PaErrorText, const TokenInfo &rTag );
ParserWarning( sal_uInt16 PnErrorNr, const rtl::OString &rPaErrorText, const TokenInfo &rTag );
virtual sal_Bool IsError() {return sal_False;};
virtual ByteString Prefix() {return "Warning:"; };
virtual sal_Bool IsError() {return sal_False;}
virtual rtl::OString Prefix() {return rtl::OString(RTL_CONSTASCII_STRINGPARAM("Warning:")); }
};
class SimpleParser
......@@ -304,7 +304,7 @@ class TokenParser
{
sal_Bool match( const TokenInfo &aCurrentToken, const TokenId &aExpectedToken );
sal_Bool match( const TokenInfo &aCurrentToken, const TokenInfo &aExpectedToken );
void ParseError( sal_uInt16 nErrNr, ByteString aErrMsg, const TokenInfo &rTag );
void ParseError( sal_uInt16 nErrNr, const rtl::OString &rErrMsg, const TokenInfo &rTag );
void Paragraph();
void PfCase();
void PfCaseBegin();
......
......@@ -337,8 +337,9 @@ int GetError()
void ResData::Dump(){
printf("**************\nResData\n");
printf("sPForm = %s , sResTyp = %s , sId = %s , sGId = %s , sHelpId = %s\n",sPForm.GetBuffer()
,sResTyp.GetBuffer(),sId.GetBuffer(),sGId.GetBuffer(),sHelpId.GetBuffer());
printf("sPForm = %s , sResTyp = %s , sId = %s , sGId = %s , sHelpId = %s\n",
sPForm.getStr(), sResTyp.getStr(), sId.getStr(),
sGId.getStr(), sHelpId.getStr());
rtl::OString a("*pStringList");
rtl::OString b("*pUIEntries");
......@@ -373,10 +374,10 @@ sal_Bool ResData::SetId( const rtl::OString& rId, sal_uInt16 nLevel )
SetError();
}
if ( sId.Len() > 255 )
if ( sId.getLength() > 255 )
{
YYWarning( "LocalId > 255 chars, truncating..." );
sId.Erase( 255 );
sId = sId.copy(0, 255);
sId = comphelper::string::stripEnd(sId, ' ');
sId = comphelper::string::stripEnd(sId, '\t');
}
......@@ -656,7 +657,7 @@ int Export::Execute( int nToken, const char * pToken )
sToken = comphelper::string::stripEnd(sToken, ' ');
rtl::OString sTLower = getToken(sToken, 0, ' ').toAsciiLowerCase();
pResData->sResTyp = sTLower;
ByteString sId( sToken.Copy( pResData->sResTyp.Len() + 1 ));
ByteString sId( sToken.Copy( pResData->sResTyp.getLength() + 1 ));
ByteString sCondition;
if ( sId.Search( "#" ) != STRING_NOTFOUND )
{
......@@ -1792,14 +1793,15 @@ sal_Bool Export::PrepareTextToMerge(ByteString &rText, sal_uInt16 nTyp,
sLastListLine = "<";
sLastListLine += sTmp;
}
if ( pResData->sResTyp.EqualsIgnoreCaseAscii( "pairedlist" ) ){
if ( pResData->sResTyp.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("pairedlist")) )
{
pResData->sId = GetPairedListID( sLastListLine );
}
else pResData->sId = rtl::OString::valueOf(static_cast<sal_Int32>(nListIndex));
if ( pResData->sGId.Len())
pResData->sGId += ".";
pResData->sGId += sOldId;
if (!pResData->sGId.isEmpty())
pResData->sGId = pResData->sGId + rtl::OString('.');
pResData->sGId = pResData->sGId + sOldId;
nTyp = STRING_TYP_TEXT;
}
break;
......@@ -2065,9 +2067,9 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
ByteString sOldId = pResData->sId;
ByteString sOldGId = pResData->sGId;
ByteString sOldTyp = pResData->sResTyp;
if ( pResData->sGId.Len())
pResData->sGId += ".";
pResData->sGId += sOldId;
if (!pResData->sGId.isEmpty())
pResData->sGId = pResData->sGId + rtl::OString('.');
pResData->sGId = pResData->sGId + sOldId;
ByteString sSpace;
for ( sal_uInt16 i = 1; i < nLevel-1; i++ )
sSpace += "\t";
......
......@@ -318,11 +318,9 @@ GSIBlock::~GSIBlock()
maList.clear();
}
/*****************************************************************************/
void GSIBlock::InsertLine( GSILine* pLine, ByteString aSourceLang)
/*****************************************************************************/
void GSIBlock::InsertLine( GSILine* pLine, const rtl::OString &rSourceLang)
{
if ( pLine->GetLanguageId().Equals( aSourceLang ) )
if ( pLine->GetLanguageId().Equals( rSourceLang ) )
{
if ( pSourceLine )
{
......@@ -338,7 +336,7 @@ void GSIBlock::InsertLine( GSILine* pLine, ByteString aSourceLang)
}
}
if ( aSourceLang.Len() ) // only check blockstructure if source lang is given
if (!rSourceLang.isEmpty()) // only check blockstructure if source lang is given
{
for ( size_t nPos = 0, n = maList.size(); nPos < n; ++nPos )
{
......
......@@ -577,7 +577,13 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , Re
aLangHM->erase( sCur );
}
}
}else if( pResData == NULL ){fprintf(stdout,"Can't find GID=%s LID=%s TYP=%s\n",pResData->sGId.GetBuffer(),pResData->sId.GetBuffer(),pResData->sResTyp.GetBuffer());}
}
else if( pResData == NULL )
{
fprintf(stdout,"Can't find GID=%s LID=%s TYP=%s\n",
pResData->sGId.getStr(), pResData->sId.getStr(),
pResData->sResTyp.getStr());
}
pXMLElement->ChangeLanguageTag( String( sCur , RTL_TEXTENCODING_ASCII_US) );
}
......
......@@ -134,10 +134,10 @@ void MergeData::Insert(PFormEntrys* pfEntrys )
aMap.insert( PFormEntrysHashMap::value_type( ByteString("HACK") , pfEntrys ) );
}
ByteString MergeData::Dump(){
ByteString sRet( "MergeData\n" );
printf("MergeData sTyp = %s , sGid = %s , sLid =%s , sFilename = %s\n",sTyp.GetBuffer(),sGID.GetBuffer(),sLID.GetBuffer(), sFilename.GetBuffer() );
rtl::OString MergeData::Dump()
{
printf("MergeData sTyp = %s , sGid = %s , sLid =%s , sFilename = %s\n",
sTyp.getStr(), sGID.getStr(), sLID.getStr(), sFilename.getStr());
PFormEntrysHashMap::const_iterator idbg;
for( idbg = aMap.begin() ; idbg != aMap.end(); ++idbg )
......@@ -147,10 +147,11 @@ ByteString MergeData::Dump(){
printf("\n");
}
printf("\n");
return sRet;
return rtl::OString(RTL_CONSTASCII_STRINGPARAM("MergeData\n"));
}
PFormEntrys* MergeData::GetPFObject( const ByteString& rPFO ){
PFormEntrys* MergeData::GetPFObject( const rtl::OString& rPFO )
{
if( aMap.find( ByteString("HACK") ) != aMap.end() )
return aMap[ rPFO ];
return NULL;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment