[Libreoffice-commits] .: l10ntools/inc l10ntools/layout l10ntools/source
Joseph Powers
jpowers at kemper.freedesktop.org
Sun Jan 23 18:04:50 PST 2011
l10ntools/inc/xmlparse.hxx | 151 ++++++++---------
l10ntools/layout/layoutparse.cxx | 20 +-
l10ntools/layout/tralay.cxx | 26 ++
l10ntools/source/xmlparse.cxx | 344 +++++++++++++++++++--------------------
4 files changed, 273 insertions(+), 268 deletions(-)
New commits:
commit ea201756bab5e5e0a6260963e347eff7600c59cf
Author: Joseph Powers <jpowers27 at cox.net>
Date: Sun Jan 23 18:02:34 2011 -0800
Remove DECLARE_LIST( XMLAttributeList, XMLAttribute * )
diff --git a/l10ntools/inc/xmlparse.hxx b/l10ntools/inc/xmlparse.hxx
index 3ad046d..8e11031 100644
--- a/l10ntools/inc/xmlparse.hxx
+++ b/l10ntools/inc/xmlparse.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -56,7 +56,7 @@ using namespace std;
#include <iterator> /* std::iterator*/
#include <list> /* std::list*/
#include <vector> /* std::vector*/
-#define XML_NODE_TYPE_FILE 0x001
+#define XML_NODE_TYPE_FILE 0x001
#define XML_NODE_TYPE_ELEMENT 0x002
#define XML_NODE_TYPE_DATA 0x003
#define XML_NODE_TYPE_COMMENT 0x004
@@ -64,7 +64,6 @@ using namespace std;
#define MAX_LANGUAGES 99
-//#define TESTDRIVER /* use xml2gsi testclass */
//-------------------------------------------------------------------------
/** Holds data of Attributes
@@ -73,30 +72,30 @@ class XMLAttribute : public String
{
private:
String sValue;
-
+
public:
/// creates an attribute
- XMLAttribute(
+ XMLAttribute(
const String &rName, // attributes name
- const String &rValue // attributes data
- )
+ const String &rValue // attributes data
+ )
: String( rName ), sValue( rValue ) {}
/// getting value of an attribue
const String &GetValue() { return sValue; }
-
+
void setValue(const String &rValue){sValue=rValue;}
/// returns true if two attributes are equal and have the same value
- BOOL IsEqual(
+ BOOL IsEqual(
const XMLAttribute &rAttribute // the attribute which has to be equal
)
- {
+ {
return (( rAttribute == *this ) && ( rAttribute.sValue == sValue ));
}
};
-DECLARE_LIST( XMLAttributeList, XMLAttribute * )
+typedef ::std::vector< XMLAttribute* > XMLAttributeList;
//-------------------------------------------------------------------------
@@ -149,18 +148,18 @@ private:
static int dbgcnt;
//int nParentPos;
protected:
- XMLParentNode( XMLParentNode *pPar )
- : XMLChildNode( pPar ), pChildList( NULL )
+ XMLParentNode( XMLParentNode *pPar )
+ : XMLChildNode( pPar ), pChildList( NULL )
{
}
XMLParentNode(): pChildList(NULL){
}
/// Copyconstructor
XMLParentNode( const XMLParentNode& );
-
+
XMLParentNode& operator=(const XMLParentNode& obj);
virtual ~XMLParentNode();
-
+
public:
virtual USHORT GetNodeType() = 0;
@@ -169,14 +168,14 @@ public:
XMLChildNodeList *GetChildList() { return pChildList; }
/// adds a new child
- void AddChild(
+ void AddChild(
XMLChildNode *pChild /// the new child
);
- void AddChild(
+ void AddChild(
XMLChildNode *pChild , int pos /// the new child
);
-
+
virtual int GetPosition( ByteString id );
int RemoveChild( XMLElement *pRefElement );
void RemoveAndDeleteAllChilds();
@@ -191,18 +190,18 @@ public:
DECLARE_LIST( XMLStringList, XMLElement* )
-/// Mapping numeric Language code <-> XML Element
+/// Mapping numeric Language code <-> XML Element
typedef std::hash_map< ByteString ,XMLElement* , hashByteString,equalByteString > LangHashMap;
/// Mapping XML Element string identifier <-> Language Map
-typedef std::hash_map<ByteString , LangHashMap* ,
+typedef std::hash_map<ByteString , LangHashMap* ,
hashByteString,equalByteString> XMLHashMap;
/// Mapping iso alpha string code <-> iso numeric code
typedef std::hash_map<ByteString, int, hashByteString,equalByteString> HashMap;
-/// Mapping XML tag names <-> have localizable strings
-typedef std::hash_map<ByteString , BOOL ,
+/// Mapping XML tag names <-> have localizable strings
+typedef std::hash_map<ByteString , BOOL ,
hashByteString,equalByteString> TagMap;
/** Holds information of a XML file, is root node of tree
@@ -213,12 +212,12 @@ class XMLFile : public XMLParentNode
{
public:
XMLFile() ;
- XMLFile(
+ XMLFile(
const String &rFileName // the file name, empty if created from memory stream
);
XMLFile( const XMLFile& obj ) ;
~XMLFile();
-
+
ByteString* GetGroupID(std::deque<ByteString> &groupid);
void Print( XMLNode *pCur = NULL, USHORT nLevel = 0 );
virtual void SearchL10NElements( XMLParentNode *pCur, int pos = 0 );
@@ -234,7 +233,7 @@ public:
bool CheckExportStatus( XMLParentNode *pCur = NULL );// , int pos = 0 );
XMLFile& operator=(const XMLFile& obj);
-
+
virtual USHORT GetNodeType();
/// returns file name
@@ -242,11 +241,11 @@ public:
void SetName( const String &rFilename ) { sFileName = rFilename; }
void SetFullName( const String &rFullFilename ) { sFullName = rFullFilename; }
const std::vector<ByteString> getOrder(){ return order; }
-
+
protected:
// writes a string as UTF8 with dos line ends to a given stream
void WriteString( ofstream &rStream, const String &sString );
-
+
// quotes the given text for writing to a file
void QuotHTML( String &rString );
@@ -273,31 +272,31 @@ public:
static void QuotHTML( String &rString );
/// UnQuot the XML characters and restore \n \t
- static void UnQuotHTML ( String &rString );
+ static void UnQuotHTML ( String &rString );
- /// Return the numeric iso language code
+ /// Return the numeric iso language code
//USHORT GetLangByIsoLang( const ByteString &rIsoLang );
-
+
/// Return the alpha strings representation
ByteString GetIsoLangByIndex( USHORT nIndex );
-
- static XMLUtil& Instance();
+
+ static XMLUtil& Instance();
~XMLUtil();
void dump();
private:
- /// Mapping iso alpha string code <-> iso numeric code
+ /// Mapping iso alpha string code <-> iso numeric code
HashMap lMap;
- /// Mapping iso numeric code <-> iso alpha string code
+ /// Mapping iso numeric code <-> iso alpha string code
ByteString isoArray[MAX_LANGUAGES];
static void UnQuotData( String &rString );
static void UnQuotTags( String &rString );
- XMLUtil();
- XMLUtil(const XMLUtil&);
+ XMLUtil();
+ XMLUtil(const XMLUtil&);
};
@@ -319,30 +318,30 @@ private:
resourceType,
languageId;
int nPos;
-
+
protected:
void Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement);
public:
/// create a element node
XMLElement(){}
- XMLElement(
+ XMLElement(
const String &rName, // the element name
XMLParentNode *Parent // parent node of this element
- ): XMLParentNode( Parent ),
- sElementName( rName ),
+ ): XMLParentNode( Parent ),
+ sElementName( rName ),
pAttributes( NULL ),
- project(""),
- filename(""),
- id(""),
- sOldRef(""),
- resourceType(""),
+ project(""),
+ filename(""),
+ id(""),
+ sOldRef(""),
+ resourceType(""),
languageId(""),
nPos(0)
{
}
~XMLElement();
XMLElement(const XMLElement&);
-
+
XMLElement& operator=(const XMLElement& obj);
/// returns node type XML_NODE_ELEMENT
virtual USHORT GetNodeType();
@@ -359,10 +358,10 @@ public:
void ChangeLanguageTag( const String &rValue );
// Return a ASCII String representation of this object
OString ToOString();
-
+
// Return a Unicode String representation of this object
OUString ToOUString();
-
+
bool Equals(OUString refStr);
/// returns a attribute
@@ -375,10 +374,10 @@ public:
void SetResourceType ( ByteString rt ){ resourceType = rt; }
void SetLanguageId ( ByteString lid ){ languageId = lid; }
void SetPos ( int nPos_in ){ nPos = nPos_in; }
- void SetOldRef ( ByteString sOldRef_in ){ sOldRef = sOldRef_in; }
+ void SetOldRef ( ByteString sOldRef_in ){ sOldRef = sOldRef_in; }
virtual int GetPos() { return nPos; }
- ByteString GetProject() { return project; }
+ ByteString GetProject() { return project; }
ByteString GetFileName() { return filename; }
ByteString GetId() { return id; }
ByteString GetOldref() { return sOldRef; }
@@ -400,20 +399,20 @@ private:
public:
/// create a data node
- XMLData(
+ XMLData(
const String &rData, // the initial data
- XMLParentNode *Parent // the parent node of this data, typically a element node
- )
- : XMLChildNode( Parent ), sData( rData ) , isNewCreated ( false ){}
- XMLData(
+ XMLParentNode *Parent // the parent node of this data, typically a element node
+ )
+ : XMLChildNode( Parent ), sData( rData ) , isNewCreated ( false ){}
+ XMLData(
const String &rData, // the initial data
- XMLParentNode *Parent, // the parent node of this data, typically a element node
+ XMLParentNode *Parent, // the parent node of this data, typically a element node
bool newCreated
- )
- : XMLChildNode( Parent ), sData( rData ) , isNewCreated ( newCreated ){}
-
+ )
+ : XMLChildNode( Parent ), sData( rData ) , isNewCreated ( newCreated ){}
+
XMLData(const XMLData& obj);
-
+
XMLData& operator=(const XMLData& obj);
virtual USHORT GetNodeType();
@@ -422,12 +421,12 @@ public:
bool isNew() { return isNewCreated; }
/// adds new character data to the existing one
- void AddData(
+ void AddData(
const String &rData // the new data
- );
-
-
-
+ );
+
+
+
};
//-------------------------------------------------------------------------
@@ -450,9 +449,9 @@ public:
virtual USHORT GetNodeType();
XMLComment( const XMLComment& obj );
-
+
XMLComment& operator=(const XMLComment& obj);
-
+
/// returns the comment
const String &GetComment() { return sComment; }
};
@@ -477,7 +476,7 @@ public:
XMLDefault(const XMLDefault& obj);
XMLDefault& operator=(const XMLDefault& obj);
-
+
/// returns node type XML_NODE_TYPE_COMMENT
virtual USHORT GetNodeType();
@@ -500,7 +499,7 @@ struct XMLError {
/** validating xml parser, creates a document tree with xml nodes
*/
-
+
class SimpleXMLParser
{
@@ -511,21 +510,21 @@ private:
XMLFile *pXMLFile;
XMLParentNode *pCurNode;
XMLData *pCurData;
-
-
+
+
static void StartElementHandler( void *userData, const XML_Char *name, const XML_Char **atts );
static void EndElementHandler( void *userData, const XML_Char *name );
static void CharacterDataHandler( void *userData, const XML_Char *s, int len );
static void CommentHandler( void *userData, const XML_Char *data );
static void DefaultHandler( void *userData, const XML_Char *s, int len );
-
-
+
+
void StartElement( const XML_Char *name, const XML_Char **atts );
void EndElement( const XML_Char *name );
void CharacterData( const XML_Char *s, int len );
void Comment( const XML_Char *data );
void Default( const XML_Char *s, int len );
-
+
public:
/// creates a new parser
@@ -533,14 +532,14 @@ public:
~SimpleXMLParser();
/// parse a file, returns NULL on criticall errors
- XMLFile *Execute(
+ XMLFile *Execute(
const String &rFullFileName,
const String &rFileName, // the file name
XMLFile *pXMLFileIn // the XMLFile
);
/// parse a memory stream, returns NULL on criticall errors
- XMLFile *Execute(
+ XMLFile *Execute(
SvMemoryStream *pStream // the stream
);
diff --git a/l10ntools/layout/layoutparse.cxx b/l10ntools/layout/layoutparse.cxx
index 72bbff6..1405d7a 100644
--- a/l10ntools/layout/layoutparse.cxx
+++ b/l10ntools/layout/layoutparse.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -36,13 +36,13 @@ LayoutXMLFile::LayoutXMLFile( bool mergeMode )
, mMergeMode( mergeMode )
{
}
-
+
void
LayoutXMLFile::SearchL10NElements( XMLParentNode* pCur, int )
{
if ( !pCur )
pCur = this;
-
+
/* Recurse int children, SearchL10NElements does not do that for us. */
if ( XMLChildNodeList* lst = pCur->GetChildList() )
for ( ULONG i = 0; i < lst->Count(); i++ )
@@ -57,11 +57,11 @@ interestingAttributes( XMLAttributeList* lst )
{
std::vector<XMLAttribute*> interesting;
if ( lst )
- for ( ULONG i = 0; i < lst->Count(); i++ )
- if ( lst->GetObject( i )->Equals( STRING( "id" ) ) )
- interesting.insert( interesting.begin(), lst->GetObject( i ) );
- else if ( ! BSTRING( *lst->GetObject( i ) ).CompareTo( "_", 1 ) )
- interesting.push_back( lst->GetObject( i ) );
+ for ( size_t i = 0; i < lst->size(); i++ )
+ if ( (*lst)[ i ]->Equals( STRING( "id" ) ) )
+ interesting.insert( interesting.begin(), (*lst)[ i ] );
+ else if ( ! BSTRING( *(*lst)[ i ]).CompareTo( "_", 1 ) )
+ interesting.push_back( (*lst)[ i ] );
return interesting;
}
@@ -69,7 +69,7 @@ void
LayoutXMLFile::HandleElement( XMLElement* element )
{
std::vector<XMLAttribute*> interesting = interestingAttributes( element->GetAttributeList() );
-
+
if ( interesting.size() )
{
std::vector<XMLAttribute*>::iterator i = interesting.begin();
@@ -122,7 +122,7 @@ BOOL LayoutXMLFile::Write( ByteString &aFilename )
if ( aFilename.Len() )
{
- ofstream aFStream( aFilename.GetBuffer() , ios::out | ios::trunc );
+ ofstream aFStream( aFilename.GetBuffer() , ios::out | ios::trunc );
if ( !aFStream )
fprintf( stderr, "ERROR: cannot open file:%s\n", aFilename.GetBuffer() );
else
diff --git a/l10ntools/layout/tralay.cxx b/l10ntools/layout/tralay.cxx
index 11582b0..30fb0dd 100644
--- a/l10ntools/layout/tralay.cxx
+++ b/l10ntools/layout/tralay.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -56,7 +56,7 @@ class TranslateLayout : public Application
{
ByteString mGid1;
ByteString mLanguage;
- ByteString mLocalize;
+ ByteString mLocalize;
ByteString mOutput;
ByteString mProject;
ByteString mRoot;
@@ -166,9 +166,9 @@ void TranslateLayout::ParseCommandLine()
static XMLAttribute*
findAttribute( XMLAttributeList* lst, String const& name )
{
- for ( ULONG i = 0; i < lst->Count(); i++ )
- if ( lst->GetObject( i )->Equals( name ) )
- return lst->GetObject( i );
+ for ( size_t i = 0; i < lst->size(); i++ )
+ if ( (*lst)[ i ]->Equals( name ) )
+ return (*lst)[ i ];
return 0;
}
@@ -177,7 +177,17 @@ translateAttribute( XMLAttributeList* lst,
String const& name, String const& translation )
{
if ( XMLAttribute* a = findAttribute( lst, name ) )
- return lst->Replace ( new XMLAttribute( name.Copy( 1 ), translation ), a );
+ {
+ for ( XMLAttributeList::iterator it = lst->begin(); it < lst->end(); ++it )
+ {
+ if ( *it == a )
+ {
+ delete *it;
+ *it = new XMLAttribute( name.Copy( 1 ), translation );
+ return *it;
+ }
+ }
+ }
return 0;
}
@@ -269,7 +279,7 @@ void TranslateLayout::MergeLanguage( ByteString const& language )
fprintf(stderr, "error: parsing: %s\n", xmlFile.GetBuffer() );
return;
}
-
+
layoutXml->Extract();
insertMarker( layoutXml, xmlFile );
@@ -285,7 +295,7 @@ void TranslateLayout::MergeLanguage( ByteString const& language )
if ( XMLElement* element = ( *languageMap )[ "en-US" ] )
translateElement( element, language, &resData, mergeData );
}
-
+
#ifndef WNT
ByteString outFile = "/dev/stdout";
#else
diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx
index d8a69a8..f85ab96 100644
--- a/l10ntools/source/xmlparse.cxx
+++ b/l10ntools/source/xmlparse.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -48,14 +48,14 @@ using namespace osl;
//
// class XMLChildNode
//
-
+
/*****************************************************************************/
-XMLChildNode::XMLChildNode( XMLParentNode *pPar )
+XMLChildNode::XMLChildNode( XMLParentNode *pPar )
/*****************************************************************************/
- : pParent( pPar )
-{
+ : pParent( pPar )
+{
if ( pParent )
- pParent->AddChild( this );
+ pParent->AddChild( this );
}
@@ -101,13 +101,13 @@ XMLParentNode::XMLParentNode( const XMLParentNode& obj)
pNode = obj.pChildList->GetObject( i );
if( pNode != NULL){
switch(pNode->GetNodeType()){
- case XML_NODE_TYPE_ELEMENT:
- AddChild( new XMLElement( *static_cast<XMLElement* >(pNode) ) ); break;
- case XML_NODE_TYPE_DATA:
+ case XML_NODE_TYPE_ELEMENT:
+ AddChild( new XMLElement( *static_cast<XMLElement* >(pNode) ) ); break;
+ case XML_NODE_TYPE_DATA:
AddChild( new XMLData ( *static_cast<XMLData* > (pNode) ) ); break;
- case XML_NODE_TYPE_COMMENT:
+ case XML_NODE_TYPE_COMMENT:
AddChild( new XMLComment( *static_cast<XMLComment* >(pNode) ) ); break;
- case XML_NODE_TYPE_DEFAULT:
+ case XML_NODE_TYPE_DEFAULT:
AddChild( new XMLDefault( *static_cast<XMLDefault* >(pNode) ) ); break;
default: fprintf(stdout,"XMLParentNode::XMLParentNode( const XMLParentNode& obj) strange obj");
}
@@ -155,11 +155,11 @@ void XMLParentNode::AddChild( XMLChildNode *pChild , int pos )
/*****************************************************************************/
int XMLParentNode::GetPosition( ByteString id ){
/*****************************************************************************/
- XMLElement* a;
+ XMLElement* a;
static const ByteString sEnusStr = ByteString(String::CreateFromAscii(ENGLISH_US_ISO).ToLowerAscii() , RTL_TEXTENCODING_ASCII_US ).ToLowerAscii();
static const ByteString sDeStr = ByteString(String::CreateFromAscii(GERMAN_ISO2).ToLowerAscii() , RTL_TEXTENCODING_ASCII_US ).ToLowerAscii();
-
+
if ( pChildList ){
for ( ULONG i = 0; i < pChildList->Count(); i++ ) {
XMLChildNode *pChild = pChildList->GetObject( i );
@@ -199,24 +199,24 @@ int XMLParentNode::RemoveChild( XMLElement *pRefElement )
elemLID.ToLowerAscii();
ByteString pRefLID( pRefElement->GetLanguageId() );
pRefLID.ToLowerAscii();
- if ( elemid.Equals(pRefElement->GetId())
- && elemLID.Equals( pRefLID ) )
+ if ( elemid.Equals(pRefElement->GetId())
+ && elemLID.Equals( pRefLID ) )
{
if( pRefElement->ToOString().compareTo( a->ToOString() )==0 ){
pChildList->Remove( i );
delete a; // Test
return i;
}
- }
+ }
}
-
+
}
}
return -1;
}
/*****************************************************************************/
-void XMLParentNode::RemoveAndDeleteAllChilds(){
+void XMLParentNode::RemoveAndDeleteAllChilds(){
/*****************************************************************************/
if ( pChildList ) {
for ( ULONG i = 0; i < pChildList->Count(); i++ )
@@ -232,18 +232,18 @@ XMLElement *XMLParentNode::GetChildElement( XMLElement *pRefElement )
for ( ULONG i = 0; i < pChildList->Count(); i++ ) {
XMLChildNode *pChild = pChildList->GetObject( i );
if ( pChild->GetNodeType() == XML_NODE_TYPE_ELEMENT )
- if ((( XMLElement * ) pChild )->GetName() ==
- pRefElement->GetName())
+ if ((( XMLElement * ) pChild )->GetName() ==
+ pRefElement->GetName())
{
XMLAttributeList *pList = pRefElement->GetAttributeList();
if ( !pList )
return ( XMLElement * ) pChild;
BOOL bMatch = FALSE;
- for ( ULONG j = 0; j < pList->Count() && bMatch; j++ ) {
- XMLAttribute *pAttribute = pList->GetObject( j );
- XMLAttribute *pCandidate =
- (( XMLElement * ) pChild )->GetAttribute(
+ for ( size_t j = 0; j < pList->size() && bMatch; j++ ) {
+ XMLAttribute *pAttribute = (*pList)[ j ];
+ XMLAttribute *pCandidate =
+ (( XMLElement * ) pChild )->GetAttribute(
*pAttribute );
if ( !pCandidate || !pAttribute->IsEqual( *pCandidate ))
bMatch = FALSE;
@@ -273,12 +273,11 @@ BOOL XMLFile::Write( ByteString &aFilename )
if ( aFilename.Len()) {
// retry harder if there is a NFS problem,
- for( int x = 1 ; x < 3 ; x++ ){ // this looks strange...yes!
- ofstream aFStream( aFilename.GetBuffer() , ios::out | ios::trunc );
+ for( int x = 1 ; x < 3 ; x++ ){ // this looks strange...yes!
+ ofstream aFStream( aFilename.GetBuffer() , ios::out | ios::trunc );
- if( !aFStream ) // From time to time the stream can not be opened the first time on NFS volumes,
+ if( !aFStream ) // From time to time the stream can not be opened the first time on NFS volumes,
{ // I wasn't able to track this down. I think this is an NFS issue .....
- //cerr << "ERROR: - helpex - Can't write to tempfile " << aFilename.GetBuffer() << " No#" << x << "\n";
TimeValue aTime;
aTime.Seconds = 3;
aTime.Nanosec = 0;
@@ -290,15 +289,14 @@ BOOL XMLFile::Write( ByteString &aFilename )
// write out
Write( aFStream );
aFStream.close();
-
+
// check!
- DirEntry aTarget( aFilename );
- FileStat aFileStat( aTarget );
-
+ DirEntry aTarget( aFilename );
+ FileStat aFileStat( aTarget );
+
if( aFileStat.GetSize() < 1 )
{
//retry
- //cerr << "WARNING: - helpex - Can't create file " << aFilename.GetBuffer() << " No#" << x << "\n";
aTarget.Kill();
}
else
@@ -310,7 +308,7 @@ BOOL XMLFile::Write( ByteString &aFilename )
}
cerr << "ERROR: - helpex - Can't create file " << aFilename.GetBuffer() << "\nPossible reason: Disk full ? Mounted NFS volume broken ? Wrong permissions ?\n";
exit( -1 );
- }
+ }
cerr << "ERROR: - helpex - Empty file name\n";
exit( -1 );
}
@@ -329,7 +327,7 @@ BOOL XMLFile::Write( ofstream &rStream , XMLNode *pCur )
XMLUtil& xmlutil = XMLUtil::Instance();
(void) xmlutil;
- if ( !pCur )
+ if ( !pCur )
Write( rStream, this );
else {
switch( pCur->GetNodeType()) {
@@ -344,13 +342,13 @@ BOOL XMLFile::Write( ofstream &rStream , XMLNode *pCur )
rStream << "<";
WriteString( rStream, pElement->GetName());
if ( pElement->GetAttributeList())
- for ( ULONG j = 0; j < pElement->GetAttributeList()->Count(); j++ ) {
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ) {
rStream << " ";
- String sData(*pElement->GetAttributeList()->GetObject( j ));
+ String sData(* (*pElement->GetAttributeList())[ j ] );
xmlutil.QuotHTML( sData );
WriteString( rStream , sData );
rStream << "=\"";
- sData=pElement->GetAttributeList()->GetObject( j )->GetValue();
+ sData = (*pElement->GetAttributeList())[ j ]->GetValue();
xmlutil.QuotHTML( sData );
WriteString( rStream , sData );
rStream << "\"";
@@ -364,7 +362,7 @@ BOOL XMLFile::Write( ofstream &rStream , XMLNode *pCur )
rStream << "</";
WriteString( rStream, pElement->GetName());
rStream << ">";
- }
+ }
}
break;
case XML_NODE_TYPE_DATA: {
@@ -378,24 +376,24 @@ BOOL XMLFile::Write( ofstream &rStream , XMLNode *pCur )
XMLComment *pComment = ( XMLComment * ) pCur;
rStream << "<!--";
WriteString( rStream, pComment->GetComment());
- rStream << "-->";
+ rStream << "-->";
}
- break;
+ break;
case XML_NODE_TYPE_DEFAULT: {
XMLDefault *pDefault = ( XMLDefault * ) pCur;
WriteString( rStream, pDefault->GetDefault());
}
- break;
+ break;
}
}
- return TRUE;
-}
+ return TRUE;
+}
void XMLFile::Print( XMLNode *pCur, USHORT nLevel )
{
- if ( !pCur )
+ if ( !pCur )
Print( this );
else {
switch( pCur->GetNodeType()) {
@@ -410,12 +408,12 @@ void XMLFile::Print( XMLNode *pCur, USHORT nLevel )
fprintf( stdout, "<%s", ByteString( pElement->GetName(), RTL_TEXTENCODING_UTF8 ).GetBuffer());
if ( pElement->GetAttributeList())
- for ( ULONG j = 0; j < pElement->GetAttributeList()->Count(); j++ ){
- ByteString aAttrName( *pElement->GetAttributeList()->GetObject( j ), RTL_TEXTENCODING_UTF8 );
- if( !aAttrName.EqualsIgnoreCaseAscii( XML_LANG ) ) {
- fprintf( stdout, " %s=\"%s\"",
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){
+ ByteString aAttrName( *(*pElement->GetAttributeList())[ j ], RTL_TEXTENCODING_UTF8 );
+ if( !aAttrName.EqualsIgnoreCaseAscii( XML_LANG ) ) {
+ fprintf( stdout, " %s=\"%s\"",
aAttrName.GetBuffer(),
- ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),
+ ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),
RTL_TEXTENCODING_UTF8 ).GetBuffer());
}
}
@@ -426,7 +424,7 @@ void XMLFile::Print( XMLNode *pCur, USHORT nLevel )
for ( ULONG k = 0; k < pElement->GetChildList()->Count(); k++ )
Print( pElement->GetChildList()->GetObject( k ), nLevel + 1 );
fprintf( stdout, "</%s>", ByteString( pElement->GetName(), RTL_TEXTENCODING_UTF8 ).GetBuffer());
- }
+ }
}
break;
case XML_NODE_TYPE_DATA: {
@@ -452,7 +450,7 @@ XMLFile::~XMLFile()
{
if( XMLStrings != NULL ){
XMLHashMap::iterator pos = XMLStrings->begin();
- for( ; pos != XMLStrings->end() ; ++pos ){
+ for( ; pos != XMLStrings->end() ; ++pos ){
delete pos->second; // Check and delete content also ?
}
delete XMLStrings;
@@ -462,15 +460,14 @@ XMLFile::~XMLFile()
/*****************************************************************************/
XMLFile::XMLFile( const String &rFileName ) // the file name, empty if created from memory stream
/*****************************************************************************/
- : XMLParentNode( NULL ),
- sFileName ( rFileName ),
+ : XMLParentNode( NULL ),
+ sFileName ( rFileName ),
ID ( "id" ),
OLDREF ( "oldref" ),
XML_LANG ( "xml-lang" ),
XMLStrings ( NULL )
-
+
{
-// nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("bookmark_value"),RTL_TEXTENCODING_ASCII_US) , TRUE) );
nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("bookmark"),RTL_TEXTENCODING_ASCII_US) , TRUE) );
nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("variable"),RTL_TEXTENCODING_ASCII_US) , TRUE) );
nodes_localize.insert( TagMap::value_type(ByteString(String::CreateFromAscii("paragraph"),RTL_TEXTENCODING_ASCII_US) , TRUE) );
@@ -484,9 +481,9 @@ void XMLFile::Extract( XMLFile *pCur )
/*****************************************************************************/
{
if( XMLStrings != NULL ) delete XMLStrings; // Elements ?
-
+
XMLStrings = new XMLHashMap();
- if ( !pCur )
+ if ( !pCur )
SearchL10NElements( this );
else {
if( pCur->GetNodeType()==XML_NODE_TYPE_FILE) {
@@ -502,11 +499,11 @@ void XMLFile::View(){
for(XMLHashMap::iterator pos=XMLStrings->begin(); pos!=XMLStrings->end();++pos){
fprintf(stdout,"\nid=%s\n",(pos->first).GetBuffer());
LangHashMap* elem=pos->second;
- for(LangHashMap::iterator pos2=elem->begin(); pos2!=elem->end();++pos2){
+ for(LangHashMap::iterator pos2=elem->begin(); pos2!=elem->end();++pos2){
fprintf( stdout,"\nlanguage=%s\n",(pos2->first).GetBuffer() );
cur=pos2->second;
fprintf(stdout,"\n%s\n",((XMLElement*)cur)->ToOString().getStr());
-
+
}
}
}
@@ -518,17 +515,17 @@ void XMLFile::InsertL10NElement( XMLElement* pElement ){
LangHashMap* elem;
if( pElement->GetAttributeList() != NULL ){
- for ( ULONG j = 0; j < pElement->GetAttributeList()->Count(); j++ ){
- tmpStr=ByteString( *pElement->GetAttributeList()->GetObject( j ),RTL_TEXTENCODING_UTF8 );
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){
+ tmpStr=ByteString( *(*pElement->GetAttributeList())[ j ], RTL_TEXTENCODING_UTF8 );
if( tmpStr.CompareTo(ID)==COMPARE_EQUAL ){ // Get the "id" Attribute
- id = ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ id = ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
if( tmpStr.CompareTo( XML_LANG ) == COMPARE_EQUAL ){ // Get the "xml-lang" Attribute
- language = ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ language = ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
}
- }else{
+ }else{
fprintf(stdout,"XMLFile::InsertL10NElement: No AttributeList found");
fprintf(stdout,"++++++++++++++++++++++++++++++++++++++++++++++++++");
Print( pElement , 0 );
@@ -541,7 +538,7 @@ void XMLFile::InsertL10NElement( XMLElement* pElement ){
(*elem)[ language ]=pElement;
XMLStrings->insert( XMLHashMap::value_type( id , elem ) );
order.push_back( id );
- }else{ // Already there
+ }else{ // Already there
elem=pos->second;
if ( (*elem)[ language ] )
{
@@ -560,22 +557,22 @@ void XMLFile::showType(XMLParentNode* node){
case XML_NODE_TYPE_COMMENT: fprintf(stdout,"COMMENT\n") ;break;
case XML_NODE_TYPE_DATA: fprintf(stdout,"DATA\n") ;break;
case XML_NODE_TYPE_DEFAULT: fprintf(stdout,"DEFAULT\n") ;break;
- default: break;
+ default: break;
}
}
-XMLFile::XMLFile()
+XMLFile::XMLFile()
/*****************************************************************************/
- : XMLParentNode( NULL ),
+ : XMLParentNode( NULL ),
ID ( "id" ),
OLDREF ( "oldref" ),
XML_LANG ( "xml-lang" ),
XMLStrings ( NULL ){};
-XMLFile::XMLFile( const XMLFile& obj )
+XMLFile::XMLFile( const XMLFile& obj )
/*****************************************************************************/
- : XMLParentNode( obj ),
- sFileName ( obj.sFileName ),
+ : XMLParentNode( obj ),
+ sFileName ( obj.sFileName ),
ID ( "id" ),
OLDREF ( "oldref" ),
XML_LANG ( "xml-lang" ),
@@ -585,7 +582,7 @@ XMLFile::XMLFile( const XMLFile& obj )
{
nodes_localize =obj.nodes_localize;
order =obj.order;
-
+
}
}
/*****************************************************************************/
@@ -594,26 +591,26 @@ XMLFile& XMLFile::operator=(const XMLFile& obj){
if( this!=&obj ){
XMLParentNode::operator=(obj);
-
+
nodes_localize =obj.nodes_localize;
order =obj.order;
-
+
if( XMLStrings ) delete XMLStrings;
-
+
if( obj.XMLStrings )
{
- XMLStrings = new XMLHashMap();
+ XMLStrings = new XMLHashMap();
for( XMLHashMap::iterator pos = obj.XMLStrings->begin() ; pos != obj.XMLStrings->end() ; ++pos )
{
LangHashMap* elem=pos->second;
LangHashMap* newelem = new LangHashMap();
- for(LangHashMap::iterator pos2=elem->begin(); pos2!=elem->end();++pos2){
+ for(LangHashMap::iterator pos2=elem->begin(); pos2!=elem->end();++pos2){
(*newelem)[ pos2->first ] = new XMLElement( *pos2->second );
printf("*");
}
(*XMLStrings)[ pos->first ] = newelem;
}
- }
+ }
}
printf("done!\n");
return *this;
@@ -627,7 +624,7 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos)
static const ByteString LOCALIZE("localize");
static const ByteString THEID("id");
bool bInsert = true;
- if ( !pCur )
+ if ( !pCur )
SearchL10NElements( this );
else {
switch( pCur->GetNodeType()) {
@@ -644,22 +641,21 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos)
case XML_NODE_TYPE_ELEMENT: {
XMLElement *pElement = ( XMLElement * ) pCur;
ByteString sName(pElement->GetName(),RTL_TEXTENCODING_ASCII_US);
- ByteString language,tmpStrVal,oldref;
+ ByteString language,tmpStrVal,oldref;
if ( pElement->GetAttributeList()){
- for ( ULONG j = 0 , cnt = pElement->GetAttributeList()->Count(); j < cnt && bInsert; j++ ){
- const ByteString tmpStr( *pElement->GetAttributeList()->GetObject( j ),RTL_TEXTENCODING_UTF8 );
+ for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; j++ ){
+ const ByteString tmpStr( *(*pElement->GetAttributeList())[ j ],RTL_TEXTENCODING_UTF8 );
if( tmpStr.CompareTo(THEID)==COMPARE_EQUAL ){ // Get the "id" Attribute
- tmpStrVal=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
- //printf("Checking id = %s\n",tmpStrVal.GetBuffer() );
+ tmpStrVal=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
if( tmpStr.CompareTo(LOCALIZE)==COMPARE_EQUAL ){ // Get the "localize" Attribute
bInsert=false;
}
if( tmpStr.CompareTo(XML_LANG)==COMPARE_EQUAL ){ // Get the "xml-lang" Attribute
- language=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ language=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
if( tmpStr.CompareTo(OLDREF)==COMPARE_EQUAL ){ // Get the "oldref" Attribute
- oldref=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ oldref=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
}
}
pElement->SetLanguageId ( language );
@@ -667,13 +663,13 @@ void XMLFile::SearchL10NElements( XMLParentNode *pCur , int pos)
pElement->SetOldRef ( oldref );
pElement->SetPos( pos );
}
-
- if ( bInsert && ( nodes_localize.find( sName.ToLowerAscii() ) != nodes_localize.end() ) )
+
+ if ( bInsert && ( nodes_localize.find( sName.ToLowerAscii() ) != nodes_localize.end() ) )
InsertL10NElement(pElement);
else if ( bInsert && pElement->GetChildList() ){
for ( ULONG k = 0; k < pElement->GetChildList()->Count(); k++ )
SearchL10NElements( (XMLParentNode*) pElement->GetChildList()->GetObject( k ) , k);
- }
+ }
}
break;
case XML_NODE_TYPE_DATA: {
@@ -701,7 +697,7 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur )
const ByteString TOPIC("topic");
bool bInsert = true;
- if ( !pCur )
+ if ( !pCur )
CheckExportStatus( this );
else {
switch( pCur->GetNodeType()) {
@@ -720,10 +716,10 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur )
ByteString sName(pElement->GetName(),RTL_TEXTENCODING_ASCII_US);
if( sName.EqualsIgnoreCaseAscii( TOPIC ) ){
if ( pElement->GetAttributeList()){
- for ( ULONG j = 0 , cnt = pElement->GetAttributeList()->Count(); j < cnt && bInsert; j++ ){
- const ByteString tmpStr( *pElement->GetAttributeList()->GetObject( j ),RTL_TEXTENCODING_UTF8 );
+ for ( size_t j = 0 , cnt = pElement->GetAttributeList()->size(); j < cnt && bInsert; j++ ){
+ const ByteString tmpStr( *(*pElement->GetAttributeList())[ j ],RTL_TEXTENCODING_UTF8 );
if( tmpStr.EqualsIgnoreCaseAscii( STATUS ) ){
- ByteString tmpStrVal=ByteString( pElement->GetAttributeList()->GetObject( j )->GetValue(),RTL_TEXTENCODING_UTF8 );
+ ByteString tmpStrVal=ByteString( (*pElement->GetAttributeList())[ j ]->GetValue(),RTL_TEXTENCODING_UTF8 );
if( !tmpStrVal.EqualsIgnoreCaseAscii( PUBLISH ) &&
!tmpStrVal.EqualsIgnoreCaseAscii( DEPRECATED )){
bStatusExport = false;
@@ -736,7 +732,7 @@ bool XMLFile::CheckExportStatus( XMLParentNode *pCur )
else if ( pElement->GetChildList() ){
for ( ULONG k = 0; k < pElement->GetChildList()->Count(); k++ )
CheckExportStatus( (XMLParentNode*) pElement->GetChildList()->GetObject( k ) );//, k);
- }
+ }
}
break;
}
@@ -754,23 +750,23 @@ USHORT XMLElement::GetNodeType()
/*****************************************************************************/
XMLElement::XMLElement(const XMLElement& obj)
/*****************************************************************************/
- :
- XMLParentNode ( obj ),
- sElementName ( obj.sElementName ),
+ :
+ XMLParentNode ( obj ),
+ sElementName ( obj.sElementName ),
pAttributes ( NULL ),
- project ( obj.project ),
- filename ( obj.filename ),
- id ( obj.id ),
- sOldRef ( obj.sOldRef ),
- resourceType ( obj.resourceType ),
+ project ( obj.project ),
+ filename ( obj.filename ),
+ id ( obj.id ),
+ sOldRef ( obj.sOldRef ),
+ resourceType ( obj.resourceType ),
languageId ( obj.languageId ),
- nPos ( obj.nPos )
-
+ nPos ( obj.nPos )
+
{
if ( obj.pAttributes ){
pAttributes = new XMLAttributeList();
- for ( ULONG i = 0; i < obj.pAttributes->Count(); i++ )
- AddAttribute( *obj.pAttributes->GetObject( i ) , obj.pAttributes->GetObject( i )->GetValue() );
+ for ( size_t i = 0; i < obj.pAttributes->size(); i++ )
+ AddAttribute( *(*obj.pAttributes)[ i ], (*obj.pAttributes)[ i ]->GetValue() );
}
}
@@ -779,24 +775,24 @@ XMLElement& XMLElement::operator=(const XMLElement& obj){
/*****************************************************************************/
if( this!=&obj ){
XMLParentNode::operator=(obj);
- sElementName =obj.sElementName;
- project =obj.project;
- filename =obj.filename;
- id =obj.id;
- sOldRef =obj.sOldRef;
- resourceType =obj.resourceType;
+ sElementName =obj.sElementName;
+ project =obj.project;
+ filename =obj.filename;
+ id =obj.id;
+ sOldRef =obj.sOldRef;
+ resourceType =obj.resourceType;
languageId =obj.languageId;
nPos =obj.nPos;
if ( pAttributes ){
- for ( ULONG i = 0; i < pAttributes->Count(); i++ )
- delete pAttributes->GetObject( i );
+ for ( size_t i = 0; i < pAttributes->size(); i++ )
+ delete (*pAttributes)[ i ];
delete pAttributes;
}
if ( obj.pAttributes ){
pAttributes =new XMLAttributeList();
- for ( ULONG i = 0; i < obj.pAttributes->Count(); i++ )
- AddAttribute( *obj.pAttributes->GetObject( i ) , obj.pAttributes->GetObject( i )->GetValue() );
+ for ( size_t i = 0; i < obj.pAttributes->size(); i++ )
+ AddAttribute( *(*obj.pAttributes)[ i ], (*obj.pAttributes)[ i ]->GetValue() );
}
}
return *this;
@@ -808,7 +804,7 @@ void XMLElement::AddAttribute( const String &rAttribute, const String &rValue )
{
if ( !pAttributes )
pAttributes = new XMLAttributeList();
- pAttributes->Insert( new XMLAttribute( rAttribute, rValue ), LIST_APPEND );
+ pAttributes->push_back( new XMLAttribute( rAttribute, rValue ) );
}
/*****************************************************************************/
@@ -817,16 +813,16 @@ void XMLElement::ChangeLanguageTag( const String &rValue ){
static const String rName = String::CreateFromAscii("xml-lang");
SetLanguageId( ByteString(rValue,RTL_TEXTENCODING_UTF8) );
if ( pAttributes ){
- for ( ULONG i = 0; i < pAttributes->Count(); i++ ){
- if ( *pAttributes->GetObject( i ) == rName ){
- pAttributes->GetObject( i )->setValue(rValue);
+ for ( size_t i = 0; i < pAttributes->size(); i++ ){
+ if ( *(*pAttributes)[ i ] == rName ){
+ (*pAttributes)[ i ]->setValue(rValue);
}
}
}
XMLChildNode* pNode = NULL;
- XMLElement* pElem = NULL;
+ XMLElement* pElem = NULL;
XMLChildNodeList* pCList = GetChildList();
-
+
if( pCList != NULL ){
for ( ULONG i = 0; i < pCList->Count(); i++ ){
pNode = pCList->GetObject( i );
@@ -846,10 +842,10 @@ XMLAttribute *XMLElement::GetAttribute( const String &rName )
/*****************************************************************************/
{
if ( pAttributes )
- for ( ULONG i = 0; i < pAttributes->Count(); i++ )
- if ( *pAttributes->GetObject( i ) == rName )
- return pAttributes->GetObject( i );
-
+ for ( size_t i = 0; i < pAttributes->size(); i++ )
+ if ( *(*pAttributes)[ i ] == rName )
+ return (*pAttributes)[ i ];
+
return NULL;
}
@@ -858,9 +854,9 @@ XMLElement::~XMLElement()
/*****************************************************************************/
{
if ( pAttributes ) {
- for ( ULONG i = 0; i < pAttributes->Count(); i++ )
- delete pAttributes->GetObject( i );
-
+ for ( size_t i = 0; i < pAttributes->size(); i++ )
+ delete (*pAttributes)[ i ];
+
delete pAttributes;
pAttributes = NULL;
}
@@ -894,7 +890,7 @@ OUString XMLElement::ToOUString(){
delete buffer;
return result;
}
-/*****************************************************************************/
+/*****************************************************************************/
void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement ){
/*****************************************************************************/
//YD FIXME somewhere COMMENT is defined as 4!
@@ -911,7 +907,7 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
tmp=pElement->GetChildList()->GetObject( k );
Print( tmp, buffer , false);
}
- }
+ }
}
}
else{
@@ -919,20 +915,20 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
switch( pCur->GetNodeType()) {
case XML_NODE_TYPE_ELEMENT: {
XMLElement *pElement = ( XMLElement * ) pCur;
-
+
if( !pElement->GetName().EqualsIgnoreCaseAscii( _COMMENT ) ){
buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\<")) );
buffer.append( pElement->GetName() );
if ( pElement->GetAttributeList()){
- for ( ULONG j = 0; j < pElement->GetAttributeList()->Count(); j++ ){
-
- OUString aAttrName( *pElement->GetAttributeList()->GetObject( j ) );
+ for ( size_t j = 0; j < pElement->GetAttributeList()->size(); j++ ){
+
+ OUString aAttrName( *(*pElement->GetAttributeList())[ j ] );
if( !aAttrName.equalsIgnoreAsciiCase( XML_LANG ) ) {
buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM(" ")) );
buffer.append( aAttrName );
buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("=")) );
buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\\"")) );
- buffer.append( pElement->GetAttributeList()->GetObject( j )->GetValue() );
+ buffer.append( (*pElement->GetAttributeList())[ j ]->GetValue() );
buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\\"")) );
}
}
@@ -949,8 +945,8 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\</")) );
buffer.append( pElement->GetName() );
buffer.append( OUString(RTL_CONSTASCII_USTRINGPARAM("\\>")) );
- }
- }
+ }
+ }
}
break;
case XML_NODE_TYPE_DATA: {
@@ -986,10 +982,10 @@ void XMLElement::Print(XMLNode *pCur, OUStringBuffer& buffer , bool rootelement
/*****************************************************************************/
XMLData::XMLData(const XMLData& obj)
/*****************************************************************************/
- : XMLChildNode( obj ),
- sData( obj.sData ) ,
+ : XMLChildNode( obj ),
+ sData( obj.sData ) ,
isNewCreated ( obj.isNewCreated ){}
-
+
/*****************************************************************************/
XMLData& XMLData::operator=(const XMLData& obj){
/*****************************************************************************/
@@ -1001,9 +997,9 @@ XMLData& XMLData::operator=(const XMLData& obj){
return *this;
}
/*****************************************************************************/
-void XMLData::AddData( const String &rData) {
+void XMLData::AddData( const String &rData) {
/*****************************************************************************/
- sData += rData;
+ sData += rData;
}
/*****************************************************************************/
@@ -1026,12 +1022,12 @@ USHORT XMLComment::GetNodeType()
/*****************************************************************************/
XMLComment::XMLComment(const XMLComment& obj)
/*****************************************************************************/
- : XMLChildNode( obj ),
+ : XMLChildNode( obj ),
sComment( obj.sComment ){}
-
+
/*****************************************************************************/
XMLComment& XMLComment::operator=(const XMLComment& obj){
-/*****************************************************************************/
+/*****************************************************************************/
if( this!=&obj ){
XMLChildNode::operator=( obj );
sComment = obj.sComment;
@@ -1052,9 +1048,9 @@ USHORT XMLDefault::GetNodeType()
/*****************************************************************************/
XMLDefault::XMLDefault(const XMLDefault& obj)
/*****************************************************************************/
- : XMLChildNode( obj ),
+ : XMLChildNode( obj ),
sDefault( obj.sDefault){}
-
+
/*****************************************************************************/
XMLDefault& XMLDefault::operator=(const XMLDefault& obj){
/*****************************************************************************/
@@ -1095,7 +1091,7 @@ SimpleXMLParser::~SimpleXMLParser()
}
/*****************************************************************************/
-void SimpleXMLParser::StartElementHandler(
+void SimpleXMLParser::StartElementHandler(
void *userData, const XML_Char *name, const XML_Char **atts )
/*****************************************************************************/
{
@@ -1104,7 +1100,7 @@ void SimpleXMLParser::StartElementHandler(
/*****************************************************************************/
-void SimpleXMLParser::EndElementHandler(
+void SimpleXMLParser::EndElementHandler(
void *userData, const XML_Char *name )
/*****************************************************************************/
{
@@ -1112,7 +1108,7 @@ void SimpleXMLParser::EndElementHandler(
}
/*****************************************************************************/
-void SimpleXMLParser::CharacterDataHandler(
+void SimpleXMLParser::CharacterDataHandler(
void *userData, const XML_Char *s, int len )
/*****************************************************************************/
{
@@ -1120,7 +1116,7 @@ void SimpleXMLParser::CharacterDataHandler(
}
/*****************************************************************************/
-void SimpleXMLParser::CommentHandler(
+void SimpleXMLParser::CommentHandler(
void *userData, const XML_Char *data )
/*****************************************************************************/
{
@@ -1128,7 +1124,7 @@ void SimpleXMLParser::CommentHandler(
}
/*****************************************************************************/
-void SimpleXMLParser::DefaultHandler(
+void SimpleXMLParser::DefaultHandler(
void *userData, const XML_Char *s, int len )
/*****************************************************************************/
{
@@ -1136,7 +1132,7 @@ void SimpleXMLParser::DefaultHandler(
}
/*****************************************************************************/
-void SimpleXMLParser::StartElement(
+void SimpleXMLParser::StartElement(
const XML_Char *name, const XML_Char **atts )
/*****************************************************************************/
{
@@ -1148,9 +1144,9 @@ void SimpleXMLParser::StartElement(
int i = 0;
while( atts[i] ) {
pElement->AddAttribute(
- String( XML_CHAR_TO_OUSTRING( atts[ i ] )),
- String( XML_CHAR_TO_OUSTRING( atts[ i + 1 ] )));
- i += 2;
+ String( XML_CHAR_TO_OUSTRING( atts[ i ] )),
+ String( XML_CHAR_TO_OUSTRING( atts[ i + 1 ] )));
+ i += 2;
}
}
@@ -1168,7 +1164,7 @@ void SimpleXMLParser::EndElement( const XML_Char *name )
}
/*****************************************************************************/
-void SimpleXMLParser::CharacterData(
+void SimpleXMLParser::CharacterData(
const XML_Char *s, int len )
/*****************************************************************************/
{
@@ -1194,13 +1190,13 @@ void SimpleXMLParser::Comment(
}
/*****************************************************************************/
-void SimpleXMLParser::Default(
+void SimpleXMLParser::Default(
const XML_Char *s, int len )
/*****************************************************************************/
{
pCurData = NULL;
- new XMLDefault(
- String( XML_CHAR_N_TO_OUSTRING( s, len )), pCurNode );
+ new XMLDefault(
+ String( XML_CHAR_N_TO_OUSTRING( s, len )), pCurNode );
}
/*****************************************************************************/
@@ -1239,8 +1235,8 @@ XMLFile *SimpleXMLParser::Execute( SvMemoryStream *pStream )
if ( !pXMLFile )
pXMLFile = new XMLFile( String());
- pCurNode = pXMLFile;
- pCurData = NULL;
+ pCurNode = pXMLFile;
+ pCurData = NULL;
ULONG nPos = pStream->Tell();
pStream->Seek( STREAM_SEEK_TO_END );
@@ -1264,7 +1260,7 @@ XMLFile *SimpleXMLParser::Execute( SvMemoryStream *pStream )
aErrorInformation.nColumn = XML_GetErrorColumnNumber( aParser );
aErrorInformation.sMessage = String::CreateFromAscii( "ERROR: " );
- if ( pXMLFile->GetName().Len())
+ if ( pXMLFile->GetName().Len())
aErrorInformation.sMessage += pXMLFile->GetName();
else
aErrorInformation.sMessage += String::CreateFromAscii( "XML-File" );
@@ -1339,15 +1335,15 @@ void XMLUtil::QuotHTML( String &rString )
//case '\'': sReturn += "\'";i++;break;
//case '&' : sRetrun += "&";i++;break;
default: sReturn.append( SLASH );break;
-
+
}
}
- break;
-
- case '<':
- sReturn.append( QLT );
+ break;
+
+ case '<':
+ sReturn.append( QLT );
break;
-
+
case '>':
sReturn.append( QGT );
break;
@@ -1364,7 +1360,7 @@ void XMLUtil::QuotHTML( String &rString )
if (
( ( i + 4 ) < rString.Len()) &&
( String( rString.Copy( i, 5 ) ).Equals( QAMP ) )
- )
+ )
sReturn.append( rString.GetChar( i ) );
else
sReturn.append( QAMP );
@@ -1380,7 +1376,7 @@ void XMLUtil::QuotHTML( String &rString )
}
void XMLUtil::UnQuotHTML( String &rString ){
- UnQuotData( rString );
+ UnQuotData( rString );
}
void XMLUtil::UnQuotData( String &rString_in ){
@@ -1435,7 +1431,7 @@ void XMLUtil::dump(){
}
}
/*****************************************************************************/
-XMLUtil& XMLUtil::Instance(){
+XMLUtil& XMLUtil::Instance(){
/*****************************************************************************/
static XMLUtil instance;
return instance;
More information about the Libreoffice-commits
mailing list