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