[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: [PATCH] kotext optimizations
From: Raul Fernandes <rgfernandes () correioweb ! com ! br>
Date: 2004-10-22 4:00:58
Message-ID: 200410221147.29268.rgfernandes () correioweb ! com ! br
[Download RAW message or body]
Changed QString to const QString&, it++ to ++it and cached the result in
for( ;it!=QStringList.end();).
Raul Fernandes
rgfernandes@correioweb.com.br
["koffice-kotext-cvs.patch" (text/x-diff)]
Index: koffice/lib/kotext/koparagcounter.cc
===================================================================
RCS file: /home/kde/koffice/lib/kotext/koparagcounter.cc,v
retrieving revision 1.47
diff -u -3 -p -u -r1.47 koparagcounter.cc
--- koffice/lib/kotext/koparagcounter.cc 11 Aug 2004 15:30:19 -0000 1.47
+++ koffice/lib/kotext/koparagcounter.cc 21 Oct 2004 09:38:26 -0000
@@ -146,7 +146,7 @@ void KoParagCounter::load( QDomElement &
invalidate();
}
-static int importCounterType( QChar numFormat )
+static int importCounterType( const QChar &numFormat )
{
if ( numFormat == '1' )
return KoParagCounter::STYLE_NUM;
@@ -495,19 +495,19 @@ void KoParagCounter::save( QDomElement &
element.setAttribute( "align", m_align );
}
-void KoParagCounter::setCustom( QString c )
+void KoParagCounter::setCustom( const QString &c )
{
m_custom = c;
invalidate();
}
-void KoParagCounter::setCustomBulletCharacter( QChar c )
+void KoParagCounter::setCustomBulletCharacter( const QChar &c )
{
m_customBulletChar = c;
invalidate();
}
-void KoParagCounter::setCustomBulletFont( QString f )
+void KoParagCounter::setCustomBulletFont( const QString &f )
{
m_customBulletFont = f;
invalidate();
@@ -525,7 +525,7 @@ void KoParagCounter::setNumbering( Numbe
invalidate();
}
-void KoParagCounter::setPrefix( QString p )
+void KoParagCounter::setPrefix( const QString &p )
{
m_prefix = p;
invalidate();
@@ -554,7 +554,7 @@ void KoParagCounter::setStyle( Style s )
invalidate();
}
-void KoParagCounter::setSuffix( QString s )
+void KoParagCounter::setSuffix( const QString &s )
{
m_suffix = s;
invalidate();
Index: koffice/lib/kotext/koparagcounter.h
===================================================================
RCS file: /home/kde/koffice/lib/kotext/koparagcounter.h,v
retrieving revision 1.21
diff -u -3 -p -u -r1.21 koparagcounter.h
--- koffice/lib/kotext/koparagcounter.h 11 Aug 2004 15:30:19 -0000 1.21
+++ koffice/lib/kotext/koparagcounter.h 21 Oct 2004 09:38:26 -0000
@@ -143,21 +143,21 @@ public:
/** Prefix and suffix strings.
*/
QString prefix() const;
- void setPrefix( QString p );
+ void setPrefix( const QString &p );
QString suffix() const;
- void setSuffix( QString s );
+ void setSuffix( const QString &s );
/** The character and font for STYLE_CUSTOMBULLET.
*/
QChar customBulletCharacter() const;
- void setCustomBulletCharacter( QChar c );
+ void setCustomBulletCharacter( const QChar &c );
QString customBulletFont() const;
- void setCustomBulletFont( QString f );
+ void setCustomBulletFont( const QString &f );
/** The string STYLE_CUSTOM.
*/
QString custom() const;
- void setCustom( QString c );
+ void setCustom( const QString &c );
/** Counter alignment
*/
Index: koffice/lib/kotext/koparaglayout.cc
===================================================================
RCS file: /home/kde/koffice/lib/kotext/koparaglayout.cc,v
retrieving revision 1.43
diff -u -3 -p -u -r1.43 koparaglayout.cc
--- koffice/lib/kotext/koparaglayout.cc 28 Aug 2004 11:59:39 -0000 1.43
+++ koffice/lib/kotext/koparaglayout.cc 21 Oct 2004 09:38:27 -0000
@@ -759,7 +759,8 @@ void KoParagLayout::saveParagLayout( QDo
KoTabulatorList tabList = layout.tabList();
KoTabulatorList::ConstIterator it = tabList.begin();
- for ( ; it != tabList.end() ; it++ )
+ KoTabulatorList::ConstIterator end = tabList.end();
+ for ( ; it != end ; ++it )
{
element = doc.createElement( "TABULATOR" );
parentElem.appendChild( element );
@@ -811,7 +812,8 @@ void KoParagLayout::saveOasis( KoGenStyl
KoXmlWriter tabsWriter( &buffer, 4 ); // indent==4: root,autostyle,style,parag-props
tabsWriter.startElement( "style:tab-stops" );
KoTabulatorList::ConstIterator it = m_tabList.begin();
- for ( ; it != m_tabList.end() ; it++ )
+ KoTabulatorList::ConstIterator end = m_tabList.end();
+ for ( ; it != end ; ++it )
{
tabsWriter.startElement( "style:tab-stop" );
tabsWriter.addAttributePt( "style:position", (*it).ptPos );
Index: koffice/lib/kotext/kotextparag.cc
===================================================================
RCS file: /home/kde/koffice/lib/kotext/kotextparag.cc,v
retrieving revision 1.224
diff -u -3 -p -u -r1.224 kotextparag.cc
--- koffice/lib/kotext/kotextparag.cc 3 Oct 2004 20:44:07 -0000 1.224
+++ koffice/lib/kotext/kotextparag.cc 21 Oct 2004 09:38:27 -0000
@@ -1086,8 +1086,9 @@ void KoTextParag::setTabList( const KoTa
KoZoomHandler* zh = textDocument()->formattingZoomHandler();
int * tabs = new int[ tabList.count() + 1 ]; // will be deleted by ~KoTextParag
KoTabulatorList::Iterator it = lst.begin();
+ KoTabulatorList::Iterator end = lst.end();
unsigned int i = 0;
- for ( ; it != lst.end() ; ++it, ++i )
+ for ( ; it != end ; ++it, ++i )
tabs[i] = zh->ptToLayoutUnitPixX( (*it).ptPos );
tabs[i] = 0;
assert( i == tabList.count() );
@@ -1361,7 +1362,8 @@ void KoTextParag::printRTDebug( int info
kdDebug(32500) << "Tab width: " << textDocument()->tabStopWidth() << endl;
} else {
KoTabulatorList::Iterator it = tabList.begin();
- for ( ; it != tabList.end() ; it++ )
+ KoTabulatorList::Iterator end = tabList.end();
+ for ( ; it != end ; ++it )
kdDebug(32500) << "Tab type:" << tabtype[(*it).type] << " at: " << (*it).ptPos << endl;
}
} else if ( info == 1 ) // formatting info
Index: koffice/lib/kotext/kohyphen/kohyphen.cpp
===================================================================
RCS file: /home/kde/koffice/lib/kotext/kohyphen/kohyphen.cpp,v
retrieving revision 1.12
diff -u -3 -p -u -r1.12 kohyphen.cpp
--- koffice/lib/kotext/kohyphen/kohyphen.cpp 11 Sep 2004 16:39:56 -0000 1.12
+++ koffice/lib/kotext/kohyphen/kohyphen.cpp 21 Oct 2004 09:38:27 -0000
@@ -88,7 +88,8 @@ KoHyphenator::KoHyphenator()
KoHyphenator::~KoHyphenator()
{
- for (QMap<QString, HyphenDict*>::iterator it = dicts.begin(); it != dicts.end(); it++)
+ QMap<QString, HyphenDict*>::iterator end = dicts.end();
+ for (QMap<QString, HyphenDict*>::iterator it = dicts.begin(); it != end; ++it)
{
if ((*it) != 0)
hnj_hyphen_free((*it));
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic