Revision: 6275
Author: nogu.dev
Date: Wed Mar 24 15:04:11 2010
Log: * qt4/immodule/quiminputcontext.cpp
- (QUimInputContext::clearPreedit,
QUimInputContext::pushbackPreeditString,
QUimInputContext::getPreeditString,
QUimInputContext::getPreeditCursorPosition,
QUimInputContext::getPreeditSelectionLength,
QUimInputContext::getPreeditAttrs):
- Change psegs from QList<PreeditSegment*> to QList<PreeditSegment>
for efficiency.
* qt4/immodule/quiminputcontext.h
- Ditto.
http://code.google.com/p/uim/source/detail?r=6275
Modified:
/trunk/qt4/immodule/quiminputcontext.cpp
/trunk/qt4/immodule/quiminputcontext.h
=======================================
--- /trunk/qt4/immodule/quiminputcontext.cpp Wed Mar 24 15:04:02 2010
+++ /trunk/qt4/immodule/quiminputcontext.cpp Wed Mar 24 15:04:11 2010
@@ -584,12 +584,12 @@
void QUimInputContext::clearPreedit()
{
while ( !psegs.isEmpty() )
- delete psegs.takeFirst();
+ psegs.takeFirst();
}
void QUimInputContext::pushbackPreeditString( int attr, const QString& str
)
{
- PreeditSegment * ps = new PreeditSegment( attr, str );
+ PreeditSegment ps( attr, str );
psegs.append( ps );
}
@@ -637,17 +637,17 @@
{
QString pstr;
- QList<PreeditSegment*>::ConstIterator seg = psegs.begin();
- const QList<PreeditSegment*>::ConstIterator end = psegs.end();
+ QList<PreeditSegment>::ConstIterator seg = psegs.begin();
+ const QList<PreeditSegment>::ConstIterator end = psegs.end();
for ( ; seg != end; ++seg )
{
- if ( ( *seg ) ->attr & UPreeditAttr_Separator && ( *seg )
->str.isEmpty() )
+ if ( ( *seg ).attr & UPreeditAttr_Separator && ( *seg
).str.isEmpty() )
{
pstr += DEFAULT_SEPARATOR_STR;
}
else
{
- pstr += ( *seg ) ->str;
+ pstr += ( *seg ).str;
}
}
@@ -660,22 +660,22 @@
return 0;
int cursorPos = 0;
- QList<PreeditSegment*>::ConstIterator seg = psegs.begin();
- const QList<PreeditSegment*>::ConstIterator end = psegs.end();
+ QList<PreeditSegment>::ConstIterator seg = psegs.begin();
+ const QList<PreeditSegment>::ConstIterator end = psegs.end();
for ( ; seg != end; ++seg )
{
- if ( ( *seg ) ->attr & UPreeditAttr_Cursor )
+ if ( ( *seg ).attr & UPreeditAttr_Cursor )
{
return cursorPos;
}
- else if ( ( *seg ) ->attr & UPreeditAttr_Separator
- && ( *seg ) ->str.isEmpty() )
+ else if ( ( *seg ).attr & UPreeditAttr_Separator
+ && ( *seg ).str.isEmpty() )
{
cursorPos += QString( DEFAULT_SEPARATOR_STR ).length();
}
else
{
- cursorPos += ( *seg ) ->str.length();
+ cursorPos += ( *seg ).str.length();
}
}
@@ -686,8 +686,8 @@
{
int selectionLength = 0;
- QList<PreeditSegment*>::ConstIterator seg = psegs.begin();
- const QList<PreeditSegment*>::ConstIterator end = psegs.end();
+ QList<PreeditSegment>::ConstIterator seg = psegs.begin();
+ const QList<PreeditSegment>::ConstIterator end = psegs.end();
for ( ; seg != end; ++seg )
{
// In converting state, uim encodes UPreeditAttr_Cursor into
@@ -697,9 +697,9 @@
// UPreeditAttr_Underline or UPreeditAttr_Reverse to detect
// logical selection length. They are sometimes disabled by
// user preference.
- if ( ( *seg ) ->attr & UPreeditAttr_Cursor )
- {
- selectionLength = ( *seg ) ->str.length();
+ if ( ( *seg ).attr & UPreeditAttr_Cursor )
+ {
+ selectionLength = ( *seg ).str.length();
return selectionLength;
}
}
@@ -722,12 +722,12 @@
const int DUMMY = 0;
QList<QInputMethodEvent::Attribute> attrs;
- QList<PreeditSegment *>::ConstIterator seg = psegs.begin();
- const QList<PreeditSegment *>::ConstIterator end = psegs.end();
+ QList<PreeditSegment>::ConstIterator seg = psegs.begin();
+ const QList<PreeditSegment>::ConstIterator end = psegs.end();
int segPos = 0;
for ( ; seg != end; ++seg ) {
- int uimAttr = ( *seg )->attr;
- int segStrLen = ( *seg )->str.length();
+ int uimAttr = ( *seg ).attr;
+ int segStrLen = ( *seg ).str.length();
QTextCharFormat segFmt;
if ( uimAttr & UPreeditAttr_Cursor ) {
=======================================
--- /trunk/qt4/immodule/quiminputcontext.h Mon Mar 22 06:53:58 2010
+++ /trunk/qt4/immodule/quiminputcontext.h Wed Mar 24 15:04:11 2010
@@ -176,7 +176,7 @@
bool candwinIsActive;
bool m_isComposing;
- QList<PreeditSegment*> psegs;
+ QList<PreeditSegment> psegs;
CandidateWindow *cwin;
static QUimHelperManager *m_HelperManager;
To unsubscribe from this group, send email to uim-commit+unsubscribegooglegroups.com or
reply to this email with the words "REMOVE ME" as the subject.