diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-01-27 11:16:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-01-27 12:59:47 +0000 |
commit | 7045e4e15c9a41864c92899f6a58f68e13a24930 (patch) | |
tree | 51216feb0b50742b16e669ead2e1efbaea96c54d /l10ntools | |
parent | 5a0fd87d15ad0da5035337a8a1b90c4e32f855dd (diff) |
ByteString->rtl::OString
Diffstat (limited to 'l10ntools')
-rw-r--r-- | l10ntools/inc/export.hxx | 38 | ||||
-rw-r--r-- | l10ntools/inc/gsicheck.hxx | 2 | ||||
-rw-r--r-- | l10ntools/inc/tagtest.hxx | 38 | ||||
-rw-r--r-- | l10ntools/source/export.cxx | 26 | ||||
-rw-r--r-- | l10ntools/source/gsicheck.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/helpmerge.cxx | 8 | ||||
-rw-r--r-- | l10ntools/source/merge.cxx | 13 | ||||
-rw-r--r-- | l10ntools/source/tagtest.cxx | 107 |
8 files changed, 123 insertions, 117 deletions
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx index e3ca6f02d350..40ecba859ebf 100644 --- a/l10ntools/inc/export.hxx +++ b/l10ntools/inc/export.hxx @@ -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 ); }; diff --git a/l10ntools/inc/gsicheck.hxx b/l10ntools/inc/gsicheck.hxx index b98d7297d6e4..fff822f7ed92 100644 --- a/l10ntools/inc/gsicheck.hxx +++ b/l10ntools/inc/gsicheck.hxx @@ -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 ); diff --git a/l10ntools/inc/tagtest.hxx b/l10ntools/inc/tagtest.hxx index 95ce00939851..a3d916506ecb 100644 --- a/l10ntools/inc/tagtest.hxx +++ b/l10ntools/inc/tagtest.hxx @@ -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(); diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index dc07f414afeb..39b8d041c6e6 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -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"; diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx index e915a4a184d2..a33e8ea4c12c 100644 --- a/l10ntools/source/gsicheck.cxx +++ b/l10ntools/source/gsicheck.cxx @@ -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 ) { diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index f6b781312f2d..7b1be3cb18ab 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -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) ); } diff --git a/l10ntools/source/merge.cxx b/l10ntools/source/merge.cxx index 6015a66e3b15..7fe05a5d0597 100644 --- a/l10ntools/source/merge.cxx +++ b/l10ntools/source/merge.cxx @@ -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; diff --git a/l10ntools/source/tagtest.cxx b/l10ntools/source/tagtest.cxx index 58a1299917b3..90d8178977da 100644 --- a/l10ntools/source/tagtest.cxx +++ b/l10ntools/source/tagtest.cxx @@ -95,7 +95,7 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) String aDelims( String::CreateFromAscii( " \\=>/" ) ); String aPortion; String aValue; // store the value of a property - ByteString aName; // store the name of a property/tag + rtl::OString aName; // store the name of a property/tag sal_Bool bCheckName = sal_False; sal_Bool bCheckEmpty = sal_False; sal_Unicode cDelim; @@ -223,14 +223,14 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) { if ( !IsPropertyValueValid( aName, aValue ) ) { - rErrorList.AddError( 25, ByteString("Property '").Append(aName).Append("' has invalid value '").Append(rtl::OUStringToOString(aValue, RTL_TEXTENCODING_UTF8)).Append("' "), *this ); + rErrorList.AddError( 25, rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Property '")).append(aName).append(RTL_CONSTASCII_STRINGPARAM("' has invalid value '")).append(rtl::OUStringToOString(aValue, RTL_TEXTENCODING_UTF8)).append("' ").makeStringAndClear(), *this ); bIsBroken = sal_True; } aProperties[ aName ] = aValue; } else { - rErrorList.AddError( 25, ByteString("Property '").Append(aName).Append("' defined twice "), *this ); + rErrorList.AddError( 25, rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Property '")).append(aName).append(RTL_CONSTASCII_STRINGPARAM("' defined twice ")).makeStringAndClear(), *this ); bIsBroken = sal_True; } } @@ -336,10 +336,9 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) { aName = rtl::OUStringToOString(aPortion, RTL_TEXTENCODING_UTF8); // "a-zA-Z_-.0-9" - xub_StrLen nCount; sal_Bool bBroken = sal_False; - const sal_Char* aBuf = aName.GetBuffer(); - for ( nCount = 0 ; !bBroken && nCount < aName.Len() ; nCount++ ) + const sal_Char* aBuf = aName.getStr(); + for (sal_Int32 nCount = 0 ; !bBroken && nCount < aName.getLength() ; ++nCount) { bBroken = ! ( ( aBuf[nCount] >= 'a' && aBuf[nCount] <= 'z' ) ||( aBuf[nCount] >= 'A' && aBuf[nCount] <= 'Z' ) @@ -364,7 +363,7 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) { if ( aPortion.Len() ) { - rErrorList.AddError( 25, ByteString("Found displaced characters '").Append(rtl::OUStringToOString(aPortion, RTL_TEXTENCODING_UTF8)).Append("' in Tag "), *this ); + rErrorList.AddError( 25, rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Found displaced characters '")).append(rtl::OUStringToOString(aPortion, RTL_TEXTENCODING_UTF8)).append(RTL_CONSTASCII_STRINGPARAM("' in Tag ")).makeStringAndClear(), *this ); bIsBroken = sal_True; } bCheckEmpty = sal_False; @@ -387,46 +386,46 @@ void TokenInfo::SplitTag( ParserMessageList &rErrorList ) } } -sal_Bool TokenInfo::IsPropertyRelevant( const ByteString &aName, const String &aValue ) const +sal_Bool TokenInfo::IsPropertyRelevant( const rtl::OString &rName, const String &rValue ) const { - if ( aTagName.EqualsAscii( "alt" ) && aName.Equals( "xml-lang" ) ) + if ( aTagName.EqualsAscii( "alt" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("xml-lang")) ) return sal_False; - if ( aTagName.EqualsAscii( "ahelp" ) && aName.Equals( "visibility" ) && aValue.EqualsAscii("visible") ) + if ( aTagName.EqualsAscii( "ahelp" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("visibility")) && rValue.EqualsAscii("visible") ) return sal_False; - if ( aTagName.EqualsAscii( "image" ) && (aName.Equals( "width" ) || aName.Equals( "height" )) ) + if ( aTagName.EqualsAscii( "image" ) && (rName.equalsL(RTL_CONSTASCII_STRINGPARAM("width")) || rName.equalsL(RTL_CONSTASCII_STRINGPARAM("height"))) ) return sal_False; return sal_True; } -sal_Bool TokenInfo::IsPropertyValueValid( const ByteString &aName, const String &aValue ) const +sal_Bool TokenInfo::IsPropertyValueValid( const rtl::OString &rName, const String &rValue ) const { /* removed due to i56740 - if ( aTagName.EqualsAscii( "switchinline" ) && aName.Equals( "select" ) ) + if ( aTagName.EqualsAscii( "switchinline" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("select")) ) { - return aValue.EqualsAscii("sys") || - aValue.EqualsAscii("appl") || - aValue.EqualsAscii("distrib"); + return rValue.EqualsAscii("sys") || + rValue.EqualsAscii("appl") || + rValue.EqualsAscii("distrib"); } */ - if ( aTagName.EqualsAscii( "caseinline" ) && aName.Equals( "select" ) ) + if ( aTagName.EqualsAscii( "caseinline" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("select")) ) { - return /*!aValue.EqualsAscii("OS2") && removed due to i56740 */ - !aValue.EqualsAscii(""); + return /*!rValue.EqualsAscii("OS2") && removed due to i56740 */ + !rValue.EqualsAscii(""); } // we don't know any better so we assume it to be OK return sal_True; } -sal_Bool TokenInfo::IsPropertyInvariant( const ByteString &aName, const String &aValue ) const +sal_Bool TokenInfo::IsPropertyInvariant( const rtl::OString &rName, const String &rValue ) const { - if ( aTagName.EqualsAscii( "link" ) && aName.Equals( "name" ) ) + if ( aTagName.EqualsAscii( "link" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("name")) ) return sal_False; - if ( aTagName.EqualsAscii( "link" ) && aName.Equals( "href" ) ) + if ( aTagName.EqualsAscii( "link" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("href")) ) { // check for external reference - if ( aValue.Copy( 0, 5 ).EqualsIgnoreCaseAscii( "http:" ) - || aValue.Copy( 0, 6 ).EqualsIgnoreCaseAscii( "https:" ) - || aValue.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "ftp:" ) ) + if ( rValue.Copy( 0, 5 ).EqualsIgnoreCaseAscii( "http:" ) + || rValue.Copy( 0, 6 ).EqualsIgnoreCaseAscii( "https:" ) + || rValue.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "ftp:" ) ) return sal_False; else return sal_True; @@ -434,15 +433,15 @@ sal_Bool TokenInfo::IsPropertyInvariant( const ByteString &aName, const String & return sal_True; } -sal_Bool TokenInfo::IsPropertyFixable( const ByteString &aName ) const +sal_Bool TokenInfo::IsPropertyFixable( const rtl::OString &rName ) const { // name everything that is allowed to be fixed automatically here - if ( (aTagName.EqualsAscii( "ahelp" ) && aName.Equals( "hid" )) - || (aTagName.EqualsAscii( "link" ) && aName.Equals( "href" )) - || (aTagName.EqualsAscii( "alt" ) && aName.Equals( "id" )) - || (aTagName.EqualsAscii( "variable" ) && aName.Equals( "id" )) - || (aTagName.EqualsAscii( "image" ) && aName.Equals( "src" )) - || (aTagName.EqualsAscii( "image" ) && aName.Equals( "id" ) )) + if ( (aTagName.EqualsAscii( "ahelp" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("hid"))) + || (aTagName.EqualsAscii( "link" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("href"))) + || (aTagName.EqualsAscii( "alt" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("id"))) + || (aTagName.EqualsAscii( "variable" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("id"))) + || (aTagName.EqualsAscii( "image" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("src"))) + || (aTagName.EqualsAscii( "image" ) && rName.equalsL(RTL_CONSTASCII_STRINGPARAM("id")) )) return sal_True; return sal_False; } @@ -480,10 +479,10 @@ sal_Bool TokenInfo::MatchesTranslation( TokenInfo& rInfo, sal_Bool bGenErrors, P { rInfo.aProperties.find( iProp->first )->second = iProp->second; rInfo.SetHasBeenFixed(); - rErrorList.AddWarning( 25, ByteString("Property '").Append(iProp->first).Append("': FIXED different value in Translation "), *this ); + rErrorList.AddWarning( 25, rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Property '")).append(iProp->first).append(RTL_CONSTASCII_STRINGPARAM("': FIXED different value in Translation ")).makeStringAndClear(), *this ); } else - rErrorList.AddError( 25, ByteString("Property '").Append(iProp->first).Append("': value different in Translation "), *this ); + rErrorList.AddError( 25, rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Property '")).append(iProp->first).append(RTL_CONSTASCII_STRINGPARAM("': value different in Translation ")).makeStringAndClear(), *this ); } else return sal_False; } @@ -495,7 +494,7 @@ sal_Bool TokenInfo::MatchesTranslation( TokenInfo& rInfo, sal_Bool bGenErrors, P if ( IsPropertyRelevant( iProp->first, iProp->second ) ) { if ( bGenErrors ) - rErrorList.AddError( 25, ByteString("Property '").Append(iProp->first).Append("' missing in Translation "), *this ); + rErrorList.AddError( 25, rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Property '")).append(iProp->first).append(RTL_CONSTASCII_STRINGPARAM("' missing in Translation ")).makeStringAndClear(), *this ); else return sal_False; } } @@ -507,7 +506,7 @@ sal_Bool TokenInfo::MatchesTranslation( TokenInfo& rInfo, sal_Bool bGenErrors, P if ( IsPropertyRelevant( iProp->first, iProp->second ) ) { if ( bGenErrors ) - rErrorList.AddError( 25, ByteString("Extra Property '").Append(iProp->first).Append("' in Translation "), rInfo ); + rErrorList.AddError( 25, rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Extra Property '")).append(iProp->first).append(RTL_CONSTASCII_STRINGPARAM("' in Translation ")).makeStringAndClear(), rInfo ); else return sal_False; } } @@ -548,14 +547,14 @@ String TokenInfo::MakeTag() const } -void ParserMessageList::AddError( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag ) +void ParserMessageList::AddError( sal_uInt16 nErrorNr, const rtl::OString& rErrorText, const TokenInfo &rTag ) { - maList.push_back( new ParserError( nErrorNr, aErrorText, rTag ) ); + maList.push_back( new ParserError( nErrorNr, rErrorText, rTag ) ); } -void ParserMessageList::AddWarning( sal_uInt16 nErrorNr, ByteString aErrorText, const TokenInfo &rTag ) +void ParserMessageList::AddWarning( sal_uInt16 nErrorNr, const rtl::OString& rErrorText, const TokenInfo &rTag ) { - maList.push_back( new ParserWarning( nErrorNr, aErrorText, rTag ) ); + maList.push_back( new ParserWarning( nErrorNr, rErrorText, rTag ) ); } sal_Bool ParserMessageList::HasErrors() @@ -786,7 +785,6 @@ String SimpleParser::GetNextTokenString( ParserMessageList &rErrorList, sal_uInt if ( nEndPos == STRING_NOTFOUND ) { // Token is incomplete. Skip start and search for better ones nPos = nStyle3StartPos +2; - ByteString sTmp( "Tag Start '\\<' without Tag End '\\>': " ); rErrorList.AddError( 24, "Tag Start '\\<' without Tag End '\\>'", TokenInfo( TAG_UNKNOWN_TAG, nStyle3StartPos, aSource.Copy( nStyle3StartPos-10, 20 ) ) ); return GetNextTokenString( rErrorList, rTagStartPos ); } @@ -1315,37 +1313,38 @@ sal_Bool TokenParser::match( const TokenInfo &aCurrentToken, const TokenInfo &rE aExpectedToken.aTokenString.Insert( String::CreateFromAscii( "Close tag for " ), 0 ); } - ByteString sTmp( "Expected Symbol" ); + rtl::OString sTmp(RTL_CONSTASCII_STRINGPARAM("Expected Symbol")); if ( aCurrentToken.nId == TAG_NOMORETAGS ) { ParseError( 7, sTmp, aExpectedToken ); } else { - sTmp += ": "; - sTmp += rtl::OUStringToOString(aParser.GetLexem( aExpectedToken ), RTL_TEXTENCODING_UTF8); - sTmp += " near "; - ParseError( 7, sTmp, aCurrentToken ); + rtl::OStringBuffer aBuf(sTmp); + aBuf.append(": "). + append(rtl::OUStringToOString(aParser.GetLexem( aExpectedToken ), RTL_TEXTENCODING_UTF8)). + append(RTL_CONSTASCII_STRINGPARAM(" near ")); + ParseError( 7, aBuf.makeStringAndClear(), aCurrentToken ); } return sal_False; } -void TokenParser::ParseError( sal_uInt16 nErrNr, ByteString aErrMsg, const TokenInfo &rTag ) +void TokenParser::ParseError( sal_uInt16 nErrNr, const rtl::OString &rErrMsg, const TokenInfo &rTag ) { - pErrorList->AddError( nErrNr, aErrMsg, rTag); + pErrorList->AddError( nErrNr, rErrMsg, rTag); // Das Fehlerhafte Tag ueberspringen aTag = aParser.GetNextToken( *pErrorList ); } -ParserMessage::ParserMessage( sal_uInt16 PnErrorNr, ByteString PaErrorText, const TokenInfo &rTag ) +ParserMessage::ParserMessage( sal_uInt16 PnErrorNr, const rtl::OString &rPaErrorText, const TokenInfo &rTag ) : nErrorNr( PnErrorNr ) , nTagBegin( 0 ) , nTagLength( 0 ) { String aLexem( SimpleParser::GetLexem( rTag ) ); - rtl::OStringBuffer aErrorBuffer(PaErrorText); + rtl::OStringBuffer aErrorBuffer(rPaErrorText); aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(": ")); aErrorBuffer.append(rtl::OUStringToOString(aLexem, RTL_TEXTENCODING_UTF8)); if ( rTag.nId == TAG_NOMORETAGS ) @@ -1360,12 +1359,12 @@ ParserMessage::ParserMessage( sal_uInt16 PnErrorNr, ByteString PaErrorText, cons nTagLength = aLexem.Len(); } -ParserError::ParserError( sal_uInt16 ErrorNr, ByteString ErrorText, const TokenInfo &rTag ) -: ParserMessage( ErrorNr, ErrorText, rTag ) +ParserError::ParserError( sal_uInt16 ErrorNr, const rtl::OString &rErrorText, const TokenInfo &rTag ) +: ParserMessage( ErrorNr, rErrorText, rTag ) {} -ParserWarning::ParserWarning( sal_uInt16 ErrorNr, ByteString ErrorText, const TokenInfo &rTag ) -: ParserMessage( ErrorNr, ErrorText, rTag ) +ParserWarning::ParserWarning( sal_uInt16 ErrorNr, const rtl::OString &rErrorText, const TokenInfo &rTag ) +: ParserMessage( ErrorNr, rErrorText, rTag ) {} sal_Bool LingTest::IsTagMandatory( TokenInfo const &aToken, TokenId &aMetaTokens ) |