Kaydet (Commit) e521a240 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Reduced tools/string usage

plus some preliminary cfgex clean up.
üst 54d278ae
......@@ -29,11 +29,10 @@
#ifndef _CFG_MERGE_HXX
#define _CFG_MERGE_HXX
#include <tools/string.hxx>
#include <boost/unordered_map.hpp>
#include <vector>
typedef boost::unordered_map<rtl::OString, rtl::OString, rtl::OStringHash> ByteStringHashMap;
typedef boost::unordered_map<rtl::OString, rtl::OString, rtl::OStringHash> OStringHashMap;
//
......@@ -54,7 +53,7 @@ private:
rtl::OString sTextTag;
rtl::OString sEndTextTag;
ByteStringHashMap sText;
OStringHashMap sText;
public:
CfgStackData(const rtl::OString &rTag, const rtl::OString &rId)
: sTagType( rTag ), sIdentifier( rId )
......@@ -106,7 +105,7 @@ class CfgParser
protected:
rtl::OString sCurrentResTyp;
rtl::OString sCurrentIsoLang;
ByteString sCurrentText;
rtl::OString sCurrentText;
rtl::OString sLastWhitespace;
......@@ -116,7 +115,7 @@ protected:
sal_Bool bLocalize;
virtual void WorkOnText(
ByteString &rText,
rtl::OString &rText,
const rtl::OString &rLangIndex )=0;
virtual void WorkOnRessourceEnd()=0;
......@@ -129,9 +128,9 @@ private:
int ExecuteAnalyzedToken( int nToken, char *pToken );
std::vector<rtl::OString> aLanguages;
void AddText(
ByteString &rText,
const ByteString &rIsoLang,
const ByteString &rResTyp );
rtl::OString &rText,
const rtl::OString &rIsoLang,
const rtl::OString &rResTyp );
sal_Bool IsTokenClosed(const rtl::OString &rToken);
......@@ -162,12 +161,12 @@ public:
class CfgExport : public CfgOutputParser
{
private:
ByteString sPrj;
ByteString sPath;
rtl::OString sPrj;
rtl::OString sPath;
std::vector<rtl::OString> aLanguages;
protected:
virtual void WorkOnText(
ByteString &rText,
rtl::OString &rText,
const rtl::OString &rIsoLang
);
......@@ -175,9 +174,9 @@ protected:
void Output(const rtl::OString& rOutput);
public:
CfgExport(
const ByteString &rOutputFile,
const ByteString &rProject,
const ByteString &rFilePath
const rtl::OString &rOutputFile,
const rtl::OString &rProject,
const rtl::OString &rFilePath
);
~CfgExport();
};
......@@ -197,7 +196,7 @@ private:
sal_Bool bEnglish;
protected:
virtual void WorkOnText(ByteString &rText, const rtl::OString &rLangIndex);
virtual void WorkOnText(rtl::OString &rText, const rtl::OString &rLangIndex);
void WorkOnRessourceEnd();
......
......@@ -29,6 +29,8 @@
#ifndef _EXPORT_HXX
#define _EXPORT_HXX
#include "sal/config.h"
#include <comphelper/string.hxx>
#ifndef L10NTOOLS_DIRECTORY_HXX
......@@ -36,7 +38,6 @@
#include <l10ntools/directory.hxx>
#endif
#include <tools/string.hxx>
#include <tools/stream.hxx>
#include <tools/fsys.hxx>
#include <osl/file.hxx>
......@@ -58,13 +59,12 @@
class PFormEntrys;
class MergeData;
typedef std::set<rtl::OString> ByteStringSet;
typedef boost::unordered_map<rtl::OString, rtl::OString, rtl::OStringHash>
ByteStringHashMap;
OStringHashMap;
typedef boost::unordered_map<rtl::OString, bool, rtl::OStringHash>
ByteStringBoolHashMap;
OStringBoolHashMap;
typedef boost::unordered_map<rtl::OString, PFormEntrys*, rtl::OStringHash>
PFormEntrysHashMap;
......@@ -75,7 +75,7 @@ typedef boost::unordered_map<rtl::OString, MergeData*, rtl::OStringHash>
#define SOURCE_LANGUAGE rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))
#define LIST_REFID "LIST_REFID"
typedef ByteStringHashMap ExportListEntry;
typedef OStringHashMap ExportListEntry;
typedef ::std::vector< ExportListEntry* > ExportListBase;
//
......@@ -145,16 +145,16 @@ public:
rtl::OString sHelpId;
rtl::OString sFilename;
ByteStringHashMap sText;
OStringHashMap sText;
sal_uInt16 nTextRefId;
ByteStringHashMap sHelpText;
OStringHashMap sHelpText;
sal_uInt16 nHelpTextRefId;
ByteStringHashMap sQuickHelpText;
OStringHashMap sQuickHelpText;
sal_uInt16 nQuickHelpTextRefId;
ByteStringHashMap sTitle;
OStringHashMap sTitle;
sal_uInt16 nTitleRefId;
rtl::OString sTextTyp;
......@@ -267,7 +267,7 @@ private:
ResStack aResStack; // stack for parsing recursive
ByteString sActPForm; // hold cur. system
rtl::OString sActPForm; // hold cur. system
sal_Bool bDefine; // cur. res. in a define?
sal_Bool bNextMustBeDefineEOL; // define but no \ at lineend
......@@ -277,18 +277,18 @@ private:
sal_uLong nListIndex;
sal_uLong nListLevel;
bool bSkipFile;
ByteString sProject;
ByteString sRoot;
rtl::OString sProject;
rtl::OString sRoot;
sal_Bool bEnableExport;
sal_Bool bMergeMode;
ByteString sMergeSrc;
ByteString sLastListLine;
rtl::OString sMergeSrc;
rtl::OString sLastListLine;
sal_Bool bError; // any errors while export?
sal_Bool bReadOver;
sal_Bool bDontWriteOutput;
ByteString sLastTextTyp;
rtl::OString sLastTextTyp;
static bool isInitialized;
ByteString sFilename;
rtl::OString sFilename;
public:
......@@ -296,8 +296,6 @@ public:
static rtl::OString sLanguages; // public ?
static rtl::OString sForcedLanguages; // public ?
static bool skipProject( ByteString sPrj ) ;
static void InitLanguages( bool bMergeMode = false );
static void InitForcedLanguages( bool bMergeMode = false );
static std::vector<rtl::OString> GetLanguages();
......@@ -308,10 +306,10 @@ public:
static bool hasUTF8ByteOrderMarker( const rtl::OString &rString );
static void RemoveUTF8ByteOrderMarkerFromFile(const rtl::OString &rFilename);
static bool fileHasUTF8ByteOrderMarker(const rtl::OString &rString);
static void QuotHTML( ByteString &rString );
static rtl::OString QuoteHTML( rtl::OString const &rString );
static bool CopyFile(const rtl::OString& rSource , const rtl::OString& rDest);
static void UnquotHTML( ByteString &rString );
static rtl::OString UnquoteHTML( rtl::OString const &rString );
static const char* GetEnv( const char *pVar );
......@@ -323,14 +321,14 @@ public:
static void getCurrentDir( std::string& dir );
static rtl::OString GetTimeStamp();
static sal_Bool ConvertLineEnds( ByteString sSource, ByteString sDestination );
static ByteString GetNativeFile( ByteString sSource );
static sal_Bool ConvertLineEnds( rtl::OString const & sSource, rtl::OString const & sDestination );
static rtl::OString GetNativeFile( rtl::OString const & sSource );
static DirEntry GetTempFile();
static void DumpExportList(const rtl::OString& rListName,
ExportList& aList);
static void DumpMap(const rtl::OString& rMapName,
ByteStringHashMap& aMap);
OStringHashMap& aMap);
private:
static std::vector<rtl::OString> aLanguages;
......@@ -340,7 +338,7 @@ private:
sal_Bool WriteExportList( ResData *pResData, ExportList *pExportList,
const rtl::OString &rTyp, sal_Bool bCreateNew = sal_False );
ByteString MergePairedList( ByteString& sLine , ByteString& sText );
rtl::OString MergePairedList( rtl::OString const & sLine , rtl::OString const & sText );
rtl::OString FullId(); // creates cur. GID
......@@ -349,19 +347,19 @@ private:
rtl::OString StripList(const rtl::OString& rText);
void InsertListEntry(const rtl::OString &rText, const rtl::OString &rLine);
void CleanValue( ByteString &rValue );
void CleanValue( rtl::OString &rValue );
rtl::OString GetText(const rtl::OString &rSource, int nToken);
sal_Bool PrepareTextToMerge(ByteString &rText, sal_uInt16 nTyp,
sal_Bool PrepareTextToMerge(rtl::OString &rText, sal_uInt16 nTyp,
rtl::OString &rLangIndex, ResData *pResData);
void MergeRest( ResData *pResData, sal_uInt16 nMode = MERGE_MODE_NORMAL );
void ConvertMergeContent( ByteString &rText );
void ConvertMergeContent( rtl::OString &rText );
void WriteToMerged(const rtl::OString &rText , bool bSDFContent);
void SetChildWithText();
void CutComment( ByteString &rText );
void CutComment( rtl::OString &rText );
public:
Export(const rtl::OString &rOutput, sal_Bool bWrite,
......@@ -386,20 +384,21 @@ public:
* Purpose: holds information of data to merge (one pform)
******************************************************************************/
class PFormEntrys : public ByteString
class PFormEntrys
{
friend class MergeDataFile;
private:
ByteString sHelpText; // empty string
ByteStringHashMap sText;
ByteStringBoolHashMap bTextFirst;
ByteStringHashMap sQuickHelpText;
ByteStringBoolHashMap bQuickHelpTextFirst;
ByteStringHashMap sTitle;
ByteStringBoolHashMap bTitleFirst;
rtl::OString data_; //TODO
rtl::OString sHelpText; // empty string
OStringHashMap sText;
OStringBoolHashMap bTextFirst;
OStringHashMap sQuickHelpText;
OStringBoolHashMap bQuickHelpTextFirst;
OStringHashMap sTitle;
OStringBoolHashMap bTitleFirst;
public:
PFormEntrys( const ByteString &rPForm ) : ByteString( rPForm ) {};
PFormEntrys( const rtl::OString &rPForm ) : data_( rPForm ) {};
rtl::OString Dump();
void InsertEntry(const rtl::OString &rId, const rtl::OString &rText,
const rtl::OString &rQuickHelpText, const rtl::OString &rTitle)
......@@ -412,8 +411,8 @@ public:
sTitle[ rId ] = rTitle;
bTitleFirst[ rId ] = true;
}
sal_Bool GetText( ByteString &rReturn, sal_uInt16 nTyp, const ByteString &nLangIndex, sal_Bool bDel = sal_False );
sal_Bool GetTransex3Text( ByteString &rReturn, sal_uInt16 nTyp, const ByteString &nLangIndex, sal_Bool bDel = sal_False );
sal_Bool GetText( rtl::OString &rReturn, sal_uInt16 nTyp, const rtl::OString &nLangIndex, sal_Bool bDel = sal_False );
sal_Bool GetTransex3Text( rtl::OString &rReturn, sal_uInt16 nTyp, const rtl::OString &nLangIndex, sal_Bool bDel = sal_False );
};
......@@ -461,7 +460,7 @@ class MergeDataFile
{
private:
sal_Bool bErrorLog;
ByteString sErrorLog;
rtl::OString sErrorLog;
SvFileStream aErrLog;
MergeDataHashMap aMap;
std::set<rtl::OString> aLanguageSet;
......
......@@ -37,20 +37,19 @@
//
enum LineFormat { FORMAT_SDF, FORMAT_UNKNOWN };
class GSILine : public ByteString
class GSILine
{
private:
ParserMessageList aMessages;
LineFormat aFormat;
sal_uLong nLineNumber;
ByteString aUniqId;
ByteString aLineType;
ByteString aLangId;
ByteString aText;
ByteString aQuickHelpText;
ByteString aTitle;
rtl::OString aUniqId;
rtl::OString aLineType;
rtl::OString aLangId;
rtl::OString aText;
rtl::OString aQuickHelpText;
rtl::OString aTitle;
sal_Bool bOK;
sal_Bool bFixed;
......@@ -58,22 +57,24 @@ private:
void ReassembleLine();
public:
GSILine( const ByteString &rLine, sal_uLong nLine );
rtl::OString data_;
GSILine( const rtl::OString &rLine, sal_uLong nLine );
LineFormat GetLineFormat() const { return aFormat; }
sal_uLong GetLineNumber() const { return nLineNumber; }
ByteString const GetUniqId() const { return aUniqId; }
ByteString const GetLineType() const { return aLineType; }
ByteString const GetLanguageId() const { return aLangId; }
ByteString const GetText() const { return aText; }
String const GetUText() const { return String( aText, RTL_TEXTENCODING_UTF8 ); }
ByteString const GetQuickHelpText() const { return aQuickHelpText; }
ByteString const GetTitle() const { return aTitle; }
rtl::OString const GetUniqId() const { return aUniqId; }
rtl::OString const GetLineType() const { return aLineType; }
rtl::OString const GetLanguageId() const { return aLangId; }
rtl::OString const GetText() const { return aText; }
rtl::OUString const GetUText() const { return rtl::OStringToOUString( aText, RTL_TEXTENCODING_UTF8 ); }
rtl::OString const GetQuickHelpText() const { return aQuickHelpText; }
rtl::OString const GetTitle() const { return aTitle; }
void SetUText( String &aNew ) { aText = rtl::OUStringToOString(aNew, RTL_TEXTENCODING_UTF8); ReassembleLine(); }
void SetText( ByteString &aNew ) { aText = aNew; ReassembleLine(); }
void SetQuickHelpText( ByteString &aNew ) { aQuickHelpText = aNew; ReassembleLine(); }
void SetTitle( ByteString &aNew ) { aTitle = aNew; ReassembleLine(); }
void SetText( rtl::OString const &aNew ) { aText = aNew; ReassembleLine(); }
void SetQuickHelpText( rtl::OString const &aNew ) { aQuickHelpText = aNew; ReassembleLine(); }
void SetTitle( rtl::OString const &aNew ) { aTitle = aNew; ReassembleLine(); }
ParserMessageList* GetMessageList() { return &aMessages; };
sal_Bool HasMessages(){ return ( aMessages.size() > 0 ); };
......@@ -99,7 +100,7 @@ private:
GSIBlock_Impl maList;
GSILine *pSourceLine;
GSILine *pReferenceLine;
void PrintList( ParserMessageList *pList, ByteString aPrefix, GSILine *pLine );
void PrintList( ParserMessageList *pList, rtl::OString const & aPrefix, GSILine *pLine );
sal_Bool bPrintContext;
sal_Bool bCheckSourceLang;
sal_Bool bCheckTranslationLang;
......@@ -108,15 +109,15 @@ private:
sal_Bool bHasBlockError;
sal_Bool IsUTF8( const ByteString &aTestee, sal_Bool bFixTags, sal_uInt16 &nErrorPos, ByteString &aErrorMsg, sal_Bool &bHasBeenFixed, ByteString &aFixed ) const;
sal_Bool IsUTF8( const rtl::OString &aTestee, sal_Bool bFixTags, sal_uInt16 &nErrorPos, rtl::OString &aErrorMsg, sal_Bool &bHasBeenFixed, rtl::OString &aFixed ) const;
sal_Bool TestUTF8( GSILine* pTestee, sal_Bool bFixTags );
sal_Bool HasSuspiciousChars( GSILine* pTestee, GSILine* pSource );
public:
GSIBlock( sal_Bool PbPrintContext, sal_Bool bSource, sal_Bool bTrans, sal_Bool bRef, sal_Bool bAllowSusp );
~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 PrintMessage( rtl::OString const & aType, rtl::OString const & aMsg, rtl::OString const & aPrefix, rtl::OString const & aContext, sal_uLong nLine, rtl::OString const & aUniqueId = rtl::OString() );
void PrintError( rtl::OString const & aMsg, rtl::OString const & aPrefix, rtl::OString const & aContext, sal_uLong nLine, rtl::OString const & aUniqueId = rtl::OString() );
void InsertLine( GSILine* pLine, const rtl::OString &rSourceLang);
void SetReferenceLine( GSILine* pLine );
sal_Bool CheckSyntax( sal_uLong nLine, sal_Bool bRequireSourceLine, sal_Bool bFixTags );
......
......@@ -39,43 +39,43 @@
class HelpParser
{
private:
ByteString sHelpFile;
rtl::OString sHelpFile;
bool bUTF8;
bool bHasInputList;
#if OSL_DEBUG_LEVEL > 2
/// Debugmethod, prints the content of the map to stdout
static void Dump(LangHashMap* rElem_in , const ByteString sKey_in);
static void Dump(LangHashMap* rElem_in , const rtl::OString & sKey_in);
/// Debugmethod, prints the content of the map to stdout
static void Dump(XMLHashMap* rElem_in);
#endif
public:
HelpParser( const ByteString &rHelpFile, bool bUTF8 , bool bHasInputList );
HelpParser( const rtl::OString &rHelpFile, bool bUTF8 , bool bHasInputList );
~HelpParser(){};
/// Method creates/append a SDF file with the content of a parsed XML file
/// @PRECOND rHelpFile is valid
static bool CreateSDF( const ByteString &rSDFFile_in, const ByteString &rPrj_in, const ByteString &rRoot_in,
const ByteString &sHelpFile, XMLFile *pXmlFile, const ByteString &rGsi1 );
static bool CreateSDF( const rtl::OString &rSDFFile_in, const rtl::OString &rPrj_in, const rtl::OString &rRoot_in,
const rtl::OString &sHelpFile, XMLFile *pXmlFile, const rtl::OString &rGsi1 );
static void parse_languages( std::vector<rtl::OString>& aLanguages , MergeDataFile& aMergeDataFile );
/// Method merges the String from the SDFfile into XMLfile. Both Strings must
/// point to existing files.
bool Merge( const ByteString &rSDFFile_in, const ByteString &rDestinationFile_in ,
bool Merge( const rtl::OString &rSDFFile_in, const rtl::OString &rDestinationFile_in ,
const rtl::OString& sLanguage , MergeDataFile& aMergeDataFile );
bool Merge( const ByteString &rSDFFile, const ByteString &rPathX , const ByteString &rPathY , bool bISO
bool Merge( const rtl::OString &rSDFFile, const rtl::OString &rPathX , const rtl::OString &rPathY , bool bISO
, const std::vector<rtl::OString>& aLanguages , MergeDataFile& aMergeDataFile , bool bCreateDir );
private:
static rtl::OString makeAbsolutePath(const rtl::OString& sHelpFile , const rtl::OString& rRoot_in);
ByteString GetOutpath( const ByteString& rPathX , const ByteString& sCur , const ByteString& rPathY );
bool MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const ByteString& sLanguage , ByteString sPath );
rtl::OString GetOutpath( const rtl::OString& rPathX , const rtl::OString& sCur , const rtl::OString& rPathY );
bool MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const rtl::OString& sLanguage , rtl::OString const & sPath );
void ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
void ProcessHelp( LangHashMap* aLangHM , const rtl::OString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile );
void MakeDir(const rtl::OString& rPath);
};
......
......@@ -55,8 +55,8 @@ private:
bool isNextGroup(rtl::OString &sGroup_out, rtl::OString &sLine_in);
void ReadLine(const rtl::OString &rLine_in,
ByteStringHashMap &rText_inout);
void WriteSDF(SvFileStream &aSDFStream, ByteStringHashMap &rText_inout,
OStringHashMap &rText_inout);
void WriteSDF(SvFileStream &aSDFStream, OStringHashMap &rText_inout,
const rtl::OString &rPrj, const rtl::OString &rRoot,
const rtl::OString &rActFileName, const rtl::OString &rID);
public:
......
......@@ -64,30 +64,31 @@ using namespace std;
/** Holds data of Attributes
*/
class XMLAttribute : public String
class XMLAttribute
{
private:
String sValue;
rtl::OUString sName;
rtl::OUString sValue;
public:
/// creates an attribute
XMLAttribute(
const String &rName, // attributes name
const String &rValue // attributes data
const rtl::OUString &rName, // attributes name
const rtl::OUString &rValue // attributes data
)
: String( rName ), sValue( rValue ) {}
: sName( rName ), sValue( rValue ) {}
/// getting value of an attribue
const String &GetValue() { return sValue; }
rtl::OUString GetName() const { return sName; }
rtl::OUString GetValue() const { return sValue; }
void setValue(const String &rValue){sValue=rValue;}
void setValue(const rtl::OUString &rValue){sValue=rValue;}
/// returns true if two attributes are equal and have the same value
sal_Bool IsEqual(
const XMLAttribute &rAttribute // the attribute which has to be equal
)
{
return (( rAttribute == *this ) && ( rAttribute.sValue == sValue ));
return (( rAttribute.sName == sName ) && ( rAttribute.sValue == sValue ));
}
};
......@@ -172,7 +173,6 @@ public:
XMLChildNode *pChild , size_t pos /// the new child
);
virtual int GetPosition( ByteString id );
int RemoveChild( XMLElement *pRefElement );
void RemoveAndDeleteAllChildren();
......@@ -204,18 +204,17 @@ class XMLFile : public XMLParentNode
{
public:
XMLFile(
const String &rFileName // the file name, empty if created from memory stream
const rtl::OUString &rFileName // the file name, empty if created from memory stream
);
XMLFile( const XMLFile& obj ) ;
~XMLFile();
ByteString* GetGroupID(std::deque<rtl::OString> &groupid);
void Print( XMLNode *pCur = NULL, sal_uInt16 nLevel = 0 );
virtual void SearchL10NElements( XMLParentNode *pCur, int pos = 0 );
void Extract( XMLFile *pCur = NULL );
XMLHashMap* GetStrings(){return XMLStrings;}
sal_Bool Write( ByteString &rFilename );
sal_Bool Write( rtl::OString const &rFilename );
sal_Bool Write( ofstream &rStream , XMLNode *pCur = NULL );
bool CheckExportStatus( XMLParentNode *pCur = NULL );// , int pos = 0 );
......@@ -277,7 +276,7 @@ class XMLElement : public XMLParentNode
private:
String sElementName;
XMLAttributeList *pAttributes;
ByteString project,
rtl::OString project,
filename,
id,
sOldRef,
......@@ -332,23 +331,23 @@ public:
/// returns a attribute
XMLAttribute *GetAttribute(
const String &rName // the attribute name
const rtl::OUString &rName // the attribute name
);
void SetProject ( ByteString prj ){ project = prj; }
void SetFileName ( ByteString fn ){ filename = fn; }
void SetId ( ByteString theId ){ id = theId; }
void SetResourceType ( ByteString rt ){ resourceType = rt; }
void SetLanguageId ( ByteString lid ){ languageId = lid; }
void SetProject ( rtl::OString const & prj ){ project = prj; }
void SetFileName ( rtl::OString const & fn ){ filename = fn; }
void SetId ( rtl::OString const & theId ){ id = theId; }
void SetResourceType ( rtl::OString const & rt ){ resourceType = rt; }
void SetLanguageId ( rtl::OString const & lid ){ languageId = lid; }
void SetPos ( int nPos_in ){ nPos = nPos_in; }
void SetOldRef ( ByteString sOldRef_in ){ sOldRef = sOldRef_in; }
void SetOldRef ( rtl::OString const & sOldRef_in ){ sOldRef = sOldRef_in; }
virtual int GetPos() { return nPos; }
ByteString GetProject() { return project; }
ByteString GetFileName() { return filename; }
ByteString GetId() { return id; }
ByteString GetOldref() { return sOldRef; }
ByteString GetResourceType(){ return resourceType; }
ByteString GetLanguageId() { return languageId; }
rtl::OString GetProject() { return project; }
rtl::OString GetFileName() { return filename; }
rtl::OString GetId() { return id; }
rtl::OString GetOldref() { return sOldRef; }
rtl::OString GetResourceType(){ return resourceType; }
rtl::OString GetLanguageId() { return languageId; }
};
......
......@@ -34,18 +34,8 @@ int yycolumn = 1;
#define YY_USER_ACTION yycolumn += yyleng;
/* external functions (C++ code, declared as extren "C" */
extern int WorkOnTokenSet( int, char* );
extern int InitCfgExport( char * , char *);
extern int EndCfgExport();
extern int GetError();
extern int SetError();
extern char *GetOutputFile( int argc, char* argv[]);
extern FILE *GetCfgFile();
extern int isQuiet();
extern void removeTempFile();
extern char* getFilename();
/* forwards */
void YYWarning();
extern void workOnTokenSet( int, char* );
extern FILE * init(int, char **);
int bText=0;
%}
......@@ -58,28 +48,28 @@ int bText=0;
\<[^\>]*"xml:lang="\""x-no-translate"\"[^\<]*\/\> {
bText = 0;
WorkOnTokenSet( CFG_TOKEN_NO_TRANSLATE, yytext );
workOnTokenSet( CFG_TOKEN_NO_TRANSLATE, yytext );
}
\<.*\/\> {
bText = 0;
WorkOnTokenSet( ANYTOKEN, yytext );
workOnTokenSet( ANYTOKEN, yytext );
}
\<[^\>]*"xml:lang="\".*\"[^\<]*\> {
bText = 1;
WorkOnTokenSet( CFG_TEXT_START, yytext );
workOnTokenSet( CFG_TEXT_START, yytext );
}
\<[^\/\!][^\>]*\> {
bText = 0;
WorkOnTokenSet( CFG_TAG, yytext );
workOnTokenSet( CFG_TAG, yytext );
}
"<!"DOCTYPE[^\>]*\> {
bText = 0;
WorkOnTokenSet( CFG_TAG, yytext );
workOnTokenSet( CFG_TAG, yytext );
}
......@@ -89,8 +79,8 @@ int bText=0;
pChar[1] = 0x00;
pChar[0] = c3;
WorkOnTokenSet( COMMEND, yytext );
WorkOnTokenSet( COMMEND, pChar );
workOnTokenSet( COMMEND, yytext );
workOnTokenSet( COMMEND, pChar );
for(;;) {
if ( c3 == EOF )
......@@ -101,29 +91,29 @@ int bText=0;
c2 = c3;
c3 = input();
pChar[0] = c3;
WorkOnTokenSet( COMMEND, pChar );
workOnTokenSet( COMMEND, pChar );
}
}
\<\/[^\>]*\> {
bText = 0;
WorkOnTokenSet( CFG_CLOSETAG, yytext );
workOnTokenSet( CFG_CLOSETAG, yytext );
}
\<[^\>\!]*\> {
bText = 0;
if ( yytext[ 1 ] == '!' && yytext[ 2 ] == '-' && yytext[ 3 ] == '-' )
WorkOnTokenSet( COMMEND, yytext );
workOnTokenSet( COMMEND, yytext );
else
WorkOnTokenSet( CFG_UNKNOWNTAG, yytext );
workOnTokenSet( CFG_UNKNOWNTAG, yytext );
}
.|\n {
yycolumn = 1;
if ( bText == 1 )
WorkOnTokenSet( CFG_TEXTCHAR, yytext );
workOnTokenSet( CFG_TEXTCHAR, yytext );
else
WorkOnTokenSet( UNKNOWNCHAR, yytext );
workOnTokenSet( UNKNOWNCHAR, yytext );
}
......@@ -156,63 +146,15 @@ void yyerror ( const char *s )
/* write error to stderr */
fprintf( stderr,
"Error: \"%s\" in line %d, column %d: \"%s\"\n", s, yylineno, yycolumn, yytext );
SetError();
exit(EXIT_FAILURE);
}
/*****************************************************************************/
int
#ifdef WNT
#if defined WNT
_cdecl
#endif
main( int argc, char* argv[])
/*****************************************************************************/
{
/* error level */
int nRetValue = 0;
char *pOutput;
FILE *pFile;
pOutput = GetOutputFile( argc, argv );
if ( !pOutput ) {
fprintf( stdout, "Syntax: CFGEX[-p Prj][-r PrjRoot]-i FileIn [-o FileOut][-m DataBase][-e][-b][-u][-f][-d DoneFile][-g[:dtd] ][-L l1,l2,...]\n" );
fprintf( stdout, " Prj: Project\n" );
fprintf( stdout, " PrjRoot: Path to project root (..\\.. etc.)\n" );
fprintf( stdout, " FileIn: Source files (*.src)\n" );
fprintf( stdout, " FileOut: Destination file (*.*)\n" );
fprintf( stdout, " DataBase: Mergedata (*.sdf)\n" );
fprintf( stdout, " -e: Disable writing errorlog\n" );
fprintf( stdout, " -b: Break when Token \"HelpText\" found in source\n" );
fprintf( stdout, " -u: [english] and [german] are allowed, Id is Taken from DataBase \n" );
fprintf( stdout, " -f: force extraction and merge even if only one language is existent\n" );
fprintf( stdout, " -g[:dtd]: enables generation of properties (dtds if :dtd is set) - in this case FileOut is the output path\n" );
fprintf( stdout, " -d: enables generation of *.don if work is done\n" );
fprintf( stdout, " -L: Restrict the handled languages. l1,l2,... are elements of (de,en-US...)\n" );
fprintf( stdout, " f1, f2,... are also elements of (de,en-US...)\n" );
return 1;
}
pFile = GetCfgFile();
InitCfgExport( pOutput , getFilename() );
if ( !pFile )
return 1;
yyin = pFile;
/* create global instance of class CfgExport */
//InitCfgExport( pOutput );
/* start parser */
yylex();
/* get error info. and end export */
nRetValue = GetError();
EndCfgExport();
removeTempFile();
/* return error level */
return nRetValue;
main(int argc, char ** argv) {
yyin = init(argc, argv);
yylex();
return EXIT_SUCCESS;
}
This diff is collapsed.
This diff is collapsed.
......@@ -106,13 +106,13 @@ void Export::DumpExportList(const rtl::OString& rListName, ExportList& aList)
}
void Export::DumpMap(const rtl::OString& rMapName,
ByteStringHashMap& aMap)
OStringHashMap& aMap)
{
if( rMapName.getLength() )
printf("MapName %s\n", rMapName.getStr());
if( aMap.size() < 1 )
return;
for(ByteStringHashMap::const_iterator idbg = aMap.begin(); idbg != aMap.end(); ++idbg)
for(OStringHashMap::const_iterator idbg = aMap.begin(); idbg != aMap.end(); ++idbg)
{
ByteString a( idbg->first );
ByteString b( idbg->second );
......@@ -143,24 +143,24 @@ std::vector<rtl::OString> Export::aLanguages = std::vector<rtl::OString>()
std::vector<rtl::OString> Export::aForcedLanguages = std::vector<rtl::OString>();
/*****************************************************************************/
void Export::QuotHTML( ByteString &rString )
rtl::OString Export::QuoteHTML( rtl::OString const &rString )
/*****************************************************************************/
{
rtl::OStringBuffer sReturn;
for ( sal_uInt16 i = 0; i < rString.Len(); i++ ) {
ByteString sTemp = rString.Copy( i );
if ( sTemp.Search( "<Arg n=" ) == 0 ) {
while ( i < rString.Len() && rString.GetChar( i ) != '>' ) {
sReturn.append(rString.GetChar(i));
for ( sal_Int32 i = 0; i < rString.getLength(); i++ ) {
rtl::OString sTemp = rString.copy( i );
if ( sTemp.match( "<Arg n=" ) ) {
while ( i < rString.getLength() && rString[i] != '>' ) {
sReturn.append(rString[i]);
i++;
}
if ( rString.GetChar( i ) == '>' ) {
if ( rString[i] == '>' ) {
sReturn.append('>');
i++;
}
}
if ( i < rString.Len()) {
switch ( rString.GetChar( i )) {
if ( i < rString.getLength()) {
switch ( rString[i]) {
case '<':
sReturn.append("&lt;");
break;
......@@ -178,20 +178,20 @@ void Export::QuotHTML( ByteString &rString )
break;
case '&':
if ((( i + 4 ) < rString.Len()) &&
( rString.Copy( i, 5 ) == "&amp;" ))
sReturn.append(rString.GetChar(i));
if ((( i + 4 ) < rString.getLength()) &&
( rString.copy( i, 5 ) == "&amp;" ))
sReturn.append(rString[i]);
else
sReturn.append("&amp;");
break;
default:
sReturn.append(rString.GetChar(i));
sReturn.append(rString[i]);
break;
}
}
}
rString = sReturn.makeStringAndClear();
return sReturn.makeStringAndClear();
}
void Export::RemoveUTF8ByteOrderMarker( rtl::OString &rString )
......@@ -298,45 +298,32 @@ bool Export::CopyFile(const rtl::OString& rSource, const rtl::OString& rDest)
}
/*****************************************************************************/
void Export::UnquotHTML( ByteString &rString )
rtl::OString Export::UnquoteHTML( rtl::OString const &rString )
/*****************************************************************************/
{
rtl::OStringBuffer sReturn;
while ( rString.Len())
{
if ( rString.Copy( 0, 5 ) == "&amp;" )
{
for (sal_Int32 i = 0; i != rString.getLength();) {
if (rString.match("&amp;", i)) {
sReturn.append('&');
rString.Erase( 0, 5 );
}
else if ( rString.Copy( 0, 4 ) == "&lt;" )
{
i += RTL_CONSTASCII_LENGTH("&amp;");
} else if (rString.match("&lt;", i)) {
sReturn.append('<');
rString.Erase( 0, 4 );
}
else if ( rString.Copy( 0, 4 ) == "&gt;" )
{
i += RTL_CONSTASCII_LENGTH("&lt;");
} else if (rString.match("&gt;", i)) {
sReturn.append('>');
rString.Erase( 0, 4 );
}
else if ( rString.Copy( 0, 6 ) == "&quot;" )
{
sReturn.append('\"');;
rString.Erase( 0, 6 );
}
else if ( rString.Copy( 0, 6 ) == "&apos;" )
{
i += RTL_CONSTASCII_LENGTH("&gt;");
} else if (rString.match("&quot;", i)) {
sReturn.append('"');
i += RTL_CONSTASCII_LENGTH("&quot;");
} else if (rString.match("&apos;", i)) {
sReturn.append('\'');
rString.Erase( 0, 6 );
}
else
{
sReturn.append(rString.GetChar(0));
rString.Erase( 0, 1 );
i += RTL_CONSTASCII_LENGTH("&apos;");
} else {
sReturn.append(rString[i]);
++i;
}
}
rString = sReturn.makeStringAndClear();
return sReturn.makeStringAndClear();
}
bool Export::isSourceLanguage(const rtl::OString &rLanguage)
......@@ -357,7 +344,7 @@ void Export::InitLanguages( bool bMergeMode ){
if( !isInitialized )
{
ByteString sTmp;
ByteStringBoolHashMap aEnvLangs;
OStringBoolHashMap aEnvLangs;
sal_Int32 nIndex = 0;
do
......@@ -380,7 +367,7 @@ void Export::InitLanguages( bool bMergeMode ){
void Export::InitForcedLanguages( bool bMergeMode ){
/*****************************************************************************/
ByteString sTmp;
ByteStringBoolHashMap aEnvLangs;
OStringBoolHashMap aEnvLangs;
sal_Int32 nIndex = 0;
do
......@@ -409,7 +396,7 @@ rtl::OString Export::GetTimeStamp()
/*****************************************************************************/
sal_Bool Export::ConvertLineEnds(
ByteString sSource, ByteString sDestination )
rtl::OString const & sSource, rtl::OString const & sDestination )
/*****************************************************************************/
{
String sSourceFile( sSource, RTL_TEXTENCODING_ASCII_US );
......@@ -445,7 +432,7 @@ sal_Bool Export::ConvertLineEnds(
}
/*****************************************************************************/
ByteString Export::GetNativeFile( ByteString sSource )
rtl::OString Export::GetNativeFile( rtl::OString const & sSource )
/*****************************************************************************/
{
DirEntry aTemp( GetTempFile());
......@@ -455,7 +442,7 @@ ByteString Export::GetNativeFile( ByteString sSource )
if ( ConvertLineEnds( sSource, sReturn ))
return sReturn;
return "";
return rtl::OString();
}
const char* Export::GetEnv( const char *pVar )
......
This diff is collapsed.
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Version: MPL 1.1 / GPLv3+ / LGPLv3+
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License or as specified alternatively below. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* Major Contributor(s):
* [ Copyright (C) 2012 Red Hat, Inc., Stephan Bergmann <sbergman@redhat.com>
* (initial developer) ]
*
* All Rights Reserved.
*
* For minor contributions see the git repository.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 3 or later (the "GPLv3+"), or
* the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
#ifndef INCLUDED_L10NTOOLS_SOURCE_HELPER_HXX
#define INCLUDED_L10NTOOLS_SOURCE_HELPER_HXX
#include "sal/config.h"
#include <cassert>
#include "rtl/string.hxx"
#include "sal/types.h"
namespace helper {
inline bool endsWith(rtl::OString const & text, rtl::OString const & search) {
return text.getLength() >= search.getLength()
&& text.match(search, text.getLength() - search.getLength());
}
inline sal_Int32 searchAndReplace(
rtl::OString * text, rtl::OString const & search,
rtl::OString const & replace)
{
assert(text != 0);
sal_Int32 i = text->indexOf(search);
if (i != -1) {
*text = text->replaceAt(i, search.getLength(), replace);
}
return i;
}
inline rtl::OString getToken(
rtl::OString const & text, sal_Int32 token, char separator)
{
sal_Int32 i = 0;
return text.getToken(token, separator, i);
}
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -209,7 +209,7 @@ int _cdecl main( int argc, char *argv[] )
hasNoError = aParser.Merge( sSDFFile, sOutputFile , Export::sLanguages , aMergeDataFile );
}
else
hasNoError = aParser.CreateSDF( sOutputFile, sPrj, sPrjRoot, sInputFile, new XMLFile( '0' ), "help" );
hasNoError = aParser.CreateSDF( sOutputFile, sPrj, sPrjRoot, sInputFile, new XMLFile( rtl::OUString('0') ), "help" );
}else if ( sOutputFileX.getLength() && sOutputFileY.getLength() && hasInputList ) { // Merge multiple files ?
if ( bMergeMode ){
......
......@@ -55,11 +55,11 @@ void HelpParser::Dump(XMLHashMap* rElem_in)
}
}
void HelpParser::Dump(LangHashMap* rElem_in,const ByteString sKey_in)
void HelpParser::Dump(LangHashMap* rElem_in,const rtl::OString & sKey_in)
{
ByteString x;
OString y;
fprintf(stdout,"+------------%s-----------+\n",sKey_in.GetBuffer() );
fprintf(stdout,"+------------%s-----------+\n",sKey_in.getStr() );
for(LangHashMap::iterator posn=rElem_in->begin();posn!=rElem_in->end();++posn)
{
x=posn->first;
......@@ -70,7 +70,7 @@ void HelpParser::Dump(LangHashMap* rElem_in,const ByteString sKey_in)
}
#endif
HelpParser::HelpParser( const ByteString &rHelpFile, bool rUTF8 , bool rHasInputList )
HelpParser::HelpParser( const rtl::OString &rHelpFile, bool rUTF8 , bool rHasInputList )
: sHelpFile( rHelpFile ),
bUTF8 ( rUTF8 ),
bHasInputList( rHasInputList )
......@@ -79,8 +79,8 @@ HelpParser::HelpParser( const ByteString &rHelpFile, bool rUTF8 , bool rHasInput
/*****************************************************************************/
bool HelpParser::CreateSDF(
/*****************************************************************************/
const ByteString &rSDFFile_in, const ByteString &rPrj_in,const ByteString &rRoot_in,
const ByteString &sHelpFile, XMLFile *pXmlFile, const ByteString &rGsi1){
const rtl::OString &rSDFFile_in, const rtl::OString &rPrj_in,const rtl::OString &rRoot_in,
const rtl::OString &sHelpFile, XMLFile *pXmlFile, const rtl::OString &rGsi1){
// GSI File constants
static const String GSI_SEQUENCE1( String::CreateFromAscii("\t0\t") );
static const String GSI_SEQUENCE2( String::CreateFromAscii("\t\t\t0\t") );
......@@ -137,11 +137,11 @@ bool HelpParser::CreateSDF(
STREAM_STD_WRITE | STREAM_TRUNC );
if ( !aSDFStream.IsOpen()) {
fprintf(stdout,"Can't open file %s\n",rSDFFile_in.GetBuffer());
fprintf(stdout,"Can't open file %s\n",rSDFFile_in.getStr());
return false;
}
ByteString sActFileName = makeAbsolutePath( sHelpFile , rRoot_in );
rtl::OString sActFileName = makeAbsolutePath( sHelpFile , rRoot_in );
XMLHashMap* aXMLStrHM = file->GetStrings();
LangHashMap* pElem;
......@@ -151,9 +151,9 @@ bool HelpParser::CreateSDF(
OUString sOUTimeStamp( sTimeStamp.GetBuffer() , sTimeStamp.Len() , RTL_TEXTENCODING_ASCII_US );
OUStringBuffer sBuffer;
const OUString sOUPrj( rPrj_in.GetBuffer() , rPrj_in.Len() , RTL_TEXTENCODING_ASCII_US );
const OUString sOUActFileName(sActFileName.GetBuffer() , sActFileName.Len() , RTL_TEXTENCODING_ASCII_US );
const OUString sOUGsi1( rGsi1.GetBuffer() , rGsi1.Len() , RTL_TEXTENCODING_ASCII_US );
const OUString sOUPrj( rPrj_in.getStr() , rPrj_in.getLength() , RTL_TEXTENCODING_ASCII_US );
const OUString sOUActFileName(sActFileName.getStr() , sActFileName.getLength() , RTL_TEXTENCODING_ASCII_US );
const OUString sOUGsi1( rGsi1.getStr() , rGsi1.getLength() , RTL_TEXTENCODING_ASCII_US );
Export::InitLanguages( false );
std::vector<rtl::OString> aLanguages = Export::GetLanguages();
......@@ -183,7 +183,7 @@ bool HelpParser::CreateSDF(
data = OUString( sTmp );
sBuffer.append( sOUPrj );
sBuffer.append( GSI_TAB ); //"\t";
if ( rRoot_in.Len())
if ( !rRoot_in.isEmpty())
sBuffer.append( sOUActFileName );
sBuffer.append( GSI_SEQUENCE1 ); //"\t0\t";
sBuffer.append( sOUGsi1 ); //"help";
......@@ -230,7 +230,7 @@ rtl::OString HelpParser::makeAbsolutePath(const rtl::OString& sHelpFile, const r
return sActFileName.replace('/', '\\');
}
bool HelpParser::Merge( const ByteString &rSDFFile, const ByteString &rDestinationFile ,
bool HelpParser::Merge( const rtl::OString &rSDFFile, const rtl::OString &rDestinationFile ,
const rtl::OString& rLanguage , MergeDataFile& aMergeDataFile )
{
......@@ -259,7 +259,7 @@ bool HelpParser::Merge( const ByteString &rSDFFile, const ByteString &rDestinati
String fullFilePath;
DirEntry aFile( sXmlFile );
XMLFile* xmlfile = ( aParser.Execute( aFile.GetFull() , sOUHelpFile, new XMLFile( '0' ) ) );
XMLFile* xmlfile = ( aParser.Execute( aFile.GetFull() , sOUHelpFile, new XMLFile( rtl::OUString('0') ) ) );
hasNoError = MergeSingleFile( xmlfile , aMergeDataFile , rLanguage , rDestinationFile );
delete xmlfile;
if( !sUsedTempFile.EqualsIgnoreCaseAscii( "" ) ){
......@@ -308,7 +308,7 @@ void HelpParser::parse_languages( std::vector<rtl::OString>& aLanguages , MergeD
}
bool HelpParser::Merge(
const ByteString &rSDFFile, const ByteString &rPathX , const ByteString &rPathY , bool bISO ,
const rtl::OString &rSDFFile, const rtl::OString &rPathX , const rtl::OString &rPathY , bool bISO ,
const std::vector<rtl::OString>& aLanguages , MergeDataFile& aMergeDataFile , bool bCreateDir )
{
......@@ -340,7 +340,7 @@ bool HelpParser::Merge(
String fullFilePath;
DirEntry aFile( sXmlFile );
XMLFile* xmlfile = ( aParser.Execute( aFile.GetFull() , sOUHelpFile, new XMLFile( '0' ) ) );
XMLFile* xmlfile = ( aParser.Execute( aFile.GetFull() , sOUHelpFile, new XMLFile( rtl::OUString('0') ) ) );
xmlfile->Extract();
if( xmlfile == NULL)
......@@ -377,8 +377,8 @@ bool HelpParser::Merge(
return hasNoError;
}
bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const ByteString& sLanguage ,
ByteString sPath )
bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile , const rtl::OString& sLanguage ,
rtl::OString const & sPath )
{
file->Extract();
......@@ -501,7 +501,7 @@ bool HelpParser::MergeSingleFile( XMLFile* file , MergeDataFile& aMergeDataFile
return true;
}
ByteString HelpParser::GetOutpath( const ByteString& rPathX , const ByteString& sCur , const ByteString& rPathY )
rtl::OString HelpParser::GetOutpath( const rtl::OString& rPathX , const rtl::OString& sCur , const rtl::OString& rPathY )
{
ByteString testpath = rPathX;
static const rtl::OString sDelimiter(rtl::OUStringToOString(DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US));
......@@ -539,7 +539,7 @@ void HelpParser::MakeDir(const rtl::OString& rPath)
/* ProcessHelp Methode: search for en-US entry and replace it with the current language*/
void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile ){
void HelpParser::ProcessHelp( LangHashMap* aLangHM , const rtl::OString& sCur , ResData *pResData , MergeDataFile& aMergeDataFile ){
XMLElement* pXMLElement = NULL;
PFormEntrys *pEntrys = NULL;
......@@ -551,7 +551,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , Re
pEntrys = NULL;
if( !sCur.EqualsIgnoreCaseAscii("en-US") ){
if( !sCur.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("en-US")) ){
pXMLElement = (*aLangHM)[ "en-US" ];
if( pXMLElement == NULL )
{
......@@ -565,7 +565,7 @@ void HelpParser::ProcessHelp( LangHashMap* aLangHM , const ByteString& sCur , Re
pEntrys = aMergeDataFile.GetPFormEntrys( pResData );
if( pEntrys != NULL)
{
ByteString sNewText;
rtl::OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur , true );
sNewdata = String( sNewText , RTL_TEXTENCODING_UTF8 );
if ( sNewdata.Len())
......
......@@ -112,7 +112,7 @@ sal_Bool LngParser::CreateSDF(const rtl::OString &rSDFFile,
size_t nPos = 0;
sal_Bool bStart = true;
rtl::OString sGroup, sLine;
ByteStringHashMap Text;
OStringHashMap Text;
ByteString sID;
while( nPos < pLines->size() ) {
......@@ -135,7 +135,7 @@ sal_Bool LngParser::CreateSDF(const rtl::OString &rSDFFile,
}
void LngParser::WriteSDF(SvFileStream &aSDFStream,
ByteStringHashMap &rText_inout, const rtl::OString &rPrj,
OStringHashMap &rText_inout, const rtl::OString &rPrj,
const rtl::OString &rRoot, const rtl::OString &rActFileName,
const rtl::OString &rID)
{
......@@ -179,7 +179,7 @@ bool LngParser::isNextGroup(rtl::OString &sGroup_out, rtl::OString &sLine_in)
}
void LngParser::ReadLine(const rtl::OString &rLine_in,
ByteStringHashMap &rText_inout)
OStringHashMap &rText_inout)
{
rtl::OString sLang = getToken(rLine_in, 0, '=');
sLang = comphelper::string::stripStart(sLang, ' ');
......@@ -230,7 +230,7 @@ sal_Bool LngParser::Merge(
}
while ( nPos < pLines->size()) {
ByteStringHashMap Text;
OStringHashMap Text;
ByteString sID( sGroup );
sal_uLong nLastLangPos = 0;
......@@ -276,10 +276,10 @@ sal_Bool LngParser::Merge(
{
if( sLang.Len() )
{
ByteString sNewText;
rtl::OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sLang, sal_True );
if ( sNewText.Len()) {
if ( !sNewText.isEmpty()) {
rtl::OString *pLine = (*pLines)[ nPos ];
ByteString sText1( sLang );
......@@ -312,9 +312,9 @@ sal_Bool LngParser::Merge(
if( !sCur.EqualsIgnoreCaseAscii("en-US") && Text[sCur].isEmpty() && pEntrys )
{
ByteString sNewText;
rtl::OString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, sal_True );
if (( sNewText.Len()) &&
if (( !sNewText.isEmpty()) &&
!(( sCur.Equals("x-comment") ) && ( sNewText == "-" )))
{
ByteString sLine;
......
......@@ -63,22 +63,22 @@ rtl::OString PFormEntrys::Dump()
return rtl::OString(RTL_CONSTASCII_STRINGPARAM("PFormEntrys\n"));
}
sal_Bool PFormEntrys::GetTransex3Text( ByteString &rReturn,
sal_uInt16 nTyp, const ByteString &nLangIndex, sal_Bool bDel )
sal_Bool PFormEntrys::GetTransex3Text( rtl::OString &rReturn,
sal_uInt16 nTyp, const rtl::OString &nLangIndex, sal_Bool bDel )
{
sal_Bool rc = GetText( rReturn , nTyp , nLangIndex , bDel );
for( sal_uInt16 idx = 0; idx < rReturn.Len(); idx++ )
for( sal_Int32 idx = 0; idx < rReturn.getLength(); idx++ )
{
if( rReturn.GetChar( idx ) == '\"' && ( idx >= 1 ) && rReturn.GetChar( idx-1 ) == '\\' )
if( rReturn[idx] == '\"' && ( idx >= 1 ) && rReturn[idx-1] == '\\' )
{
rReturn.Erase( idx-1 , 1 );
rReturn = rReturn.replaceAt( idx-1, 1, rtl::OString() );
}
}
return rc;
}
/*****************************************************************************/
sal_Bool PFormEntrys::GetText( ByteString &rReturn,
sal_uInt16 nTyp, const ByteString &nLangIndex, sal_Bool bDel )
sal_Bool PFormEntrys::GetText( rtl::OString &rReturn,
sal_uInt16 nTyp, const rtl::OString &nLangIndex, sal_Bool bDel )
{
sal_Bool bReturn=sal_True;
......
This diff is collapsed.
......@@ -670,11 +670,11 @@ void XRMResMerge::WorkOnDesc(
ByteString sDescFilename = GetAttribute ( rOpenTag, "xlink:href" );
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
sCur = aLanguages[ n ];
ByteString sContent;
rtl::OString sContent;
if ( !sCur.EqualsIgnoreCaseAscii("en-US") &&
( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sCur, sal_True )) &&
( sContent != "-" ) && ( sContent.Len()))
( sContent != "-" ) && !sContent.isEmpty())
{
ByteString sText( sContent );
ByteString sAdditionalLine( "\n " );
......@@ -738,11 +738,11 @@ void XRMResMerge::WorkOnText(
PFormEntrys *pEntrys = pMergeDataFile->GetPFormEntrys( pResData );
if ( pEntrys ) {
ByteString sContent;
rtl::OString sContent;
if ( Export::isAllowed( sLang ) &&
( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sLang )) &&
( sContent != "-" ) && ( sContent.Len()))
( sContent != "-" ) && !sContent.isEmpty())
{
rText = sContent;
......@@ -776,11 +776,11 @@ void XRMResMerge::EndOfText(
ByteString sCur;
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
sCur = aLanguages[ n ];
ByteString sContent;
rtl::OString sContent;
if ( !sCur.EqualsIgnoreCaseAscii("en-US") &&
( pEntrys->GetText(
sContent, STRING_TYP_TEXT, sCur, sal_True )) &&
( sContent != "-" ) && ( sContent.Len()))
( sContent != "-" ) && !sContent.isEmpty())
{
ByteString sText( sContent );
ByteString sAdditionalLine( "\n " );
......
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