summaryrefslogtreecommitdiff
path: root/l10ntools/layout
diff options
context:
space:
mode:
authorJoseph Powers <jpowers27@cox.net>2011-01-23 18:32:10 -0800
committerJoseph Powers <jpowers27@cox.net>2011-01-23 18:32:10 -0800
commit9440f6e585e79861f4dff4793aa0cfc1109041b6 (patch)
tree90e3b8b2e3a5d4f7c4ccc6e262677e0ddf15ea43 /l10ntools/layout
parentf461a9b041dcb6e3bbd6db63a84c133cd6931deb (diff)
Remove DECLARE_LIST( XMLChildNodeList, XMLChildNode* )
Diffstat (limited to 'l10ntools/layout')
-rw-r--r--l10ntools/layout/layoutparse.cxx14
-rw-r--r--l10ntools/layout/tralay.cxx17
2 files changed, 20 insertions, 11 deletions
diff --git a/l10ntools/layout/layoutparse.cxx b/l10ntools/layout/layoutparse.cxx
index 1405d7aa42a4..2d0e2f51b7f5 100644
--- a/l10ntools/layout/layoutparse.cxx
+++ b/l10ntools/layout/layoutparse.cxx
@@ -45,11 +45,15 @@ LayoutXMLFile::SearchL10NElements( XMLParentNode* pCur, int )
/* Recurse int children, SearchL10NElements does not do that for us. */
if ( XMLChildNodeList* lst = pCur->GetChildList() )
- for ( ULONG i = 0; i < lst->Count(); i++ )
- if ( lst->GetObject( i )->GetNodeType() == XML_NODE_TYPE_ELEMENT )
- HandleElement( ( XMLElement* )lst->GetObject( i ) );
- else if ( lst->GetObject( i )->GetNodeType() == XML_NODE_TYPE_COMMENT )
- lst->Remove( i-- );
+ for ( size_t i = 0; i < lst->size(); i++ )
+ if ( (*lst)[ i ]->GetNodeType() == XML_NODE_TYPE_ELEMENT )
+ HandleElement( ( XMLElement* )(*lst)[ i ] );
+ else if ( (*lst)[ i ]->GetNodeType() == XML_NODE_TYPE_COMMENT ) {
+ XMLChildNodeList::iterator it = lst->begin();
+ ::std::advance( it, i );
+ lst->erase( it );
+ i--;
+ }
}
std::vector<XMLAttribute*>
diff --git a/l10ntools/layout/tralay.cxx b/l10ntools/layout/tralay.cxx
index 30fb0dd4f1cb..3ae549a38c97 100644
--- a/l10ntools/layout/tralay.cxx
+++ b/l10ntools/layout/tralay.cxx
@@ -214,7 +214,6 @@ translateElement( XMLElement* element, ByteString const& lang,
{
ByteString translation;
entry->GetText( translation, STRING_TYP_TEXT, lang, true );
- // ByteString original = removeContent( element );
if ( !translation.Len() )
translation = BSTRING( ( *i )->GetValue() );
delete translateAttribute( attributes, **i , STRING( translation ) );
@@ -250,17 +249,23 @@ static void make_directory( ByteString const& name )
static void insertMarker( XMLParentNode *p, ByteString const& file )
{
if ( XMLChildNodeList* lst = p->GetChildList() )
- if ( lst->Count() )
+ if ( !lst->empty() )
{
- ULONG i = 1;
+ size_t i = 1;
// Skip newline, if possible.
- if ( lst->Count() > 1
- && lst->GetObject( 2 )->GetNodeType() == XML_NODE_TYPE_DEFAULT )
+ if ( lst->size() > 2
+ && (*lst)[ 2 ]->GetNodeType() == XML_NODE_TYPE_DEFAULT )
i++;
OUString marker = OUString(RTL_CONSTASCII_USTRINGPARAM("\n NOTE: This file has been generated automagically by transex3/layout/tralay,\n from source template: "))
+ STRING( file )
+ OUString(RTL_CONSTASCII_USTRINGPARAM(".\n Do not edit, changes will be lost.\n"));
- lst->Insert( new XMLComment( marker, 0 ), i );
+ if ( i < lst->size() ) {
+ XMLChildNodeList::iterator it = lst->begin();
+ ::std::advance( it, i );
+ lst->insert( it, new XMLComment( marker, 0 ) );
+ } else {
+ lst->push_back( new XMLComment( marker, 0 ) );
+ }
}
}