summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-24 15:27:06 (UTC)
committer mickeyl <mickeyl>2004-04-24 15:27:06 (UTC)
commit186c4d03ea8bf3aee4c535453409f1234442bff3 (patch) (unidiff)
treedd01280746c114656496ca12553e73a35e2dbfbb
parentc9f1383f79380e7f50f257670a11f9b10024e958 (diff)
downloadopie-186c4d03ea8bf3aee4c535453409f1234442bff3.zip
opie-186c4d03ea8bf3aee4c535453409f1234442bff3.tar.gz
opie-186c4d03ea8bf3aee4c535453409f1234442bff3.tar.bz2
gcc 3.4 fixlet
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katetextline.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katetextline.h b/noncore/apps/tinykate/libkate/document/katetextline.h
index c2968cc..3518900 100644
--- a/noncore/apps/tinykate/libkate/document/katetextline.h
+++ b/noncore/apps/tinykate/libkate/document/katetextline.h
@@ -44,76 +44,76 @@ public:
44 typedef QValueListConstIterator<T> Iterator; 44 typedef QValueListConstIterator<T> Iterator;
45 Iterator curit; 45 Iterator curit;
46 46
47 FVPrivate() { curpos=-1; }; 47 FVPrivate() { curpos=-1; };
48}; 48};
49 49
50template<class T> 50template<class T>
51class FastValueList : public QValueList<T> 51class FastValueList : public QValueList<T>
52{ 52{
53public: 53public:
54 typedef QValueListIterator<T> Iterator; 54 typedef QValueListIterator<T> Iterator;
55 typedef QValueListConstIterator<T> ConstIterator; 55 typedef QValueListConstIterator<T> ConstIterator;
56protected: 56protected:
57 FVPrivate<T> *fvp; 57 FVPrivate<T> *fvp;
58 58
59 Iterator fastat( uint i ) { 59 Iterator fastat( uint i ) {
60 uint num=count(); 60 uint num=this->count();
61 if (i>=num) {return end();} 61 if (i>=num) {return this->end();}
62 if (fvp->curpos<0) { fvp->curpos=0; fvp->curit=begin(); } 62 if (fvp->curpos<0) { fvp->curpos=0; fvp->curit=this->begin(); }
63 uint curpos=(uint) fvp->curpos; 63 uint curpos=(uint) fvp->curpos;
64 Iterator curit(fvp->curit.node); 64 Iterator curit(fvp->curit.node);
65 if (curpos==i) return curit; 65 if (curpos==i) return curit;
66 66
67 int diff=i-curpos; 67 int diff=i-curpos;
68 bool forward; 68 bool forward;
69 if (diff<0) diff=-diff; 69 if (diff<0) diff=-diff;
70 if (((uint)diff < i) && ((uint)diff < num-i)) { // start from current node 70 if (((uint)diff < i) && ((uint)diff < num-i)) { // start from current node
71 forward=i > (uint)curpos; 71 forward=i > (uint)curpos;
72 } else if (i < num - i) { // start from first node 72 } else if (i < num - i) { // start from first node
73 curit=begin(); diff=i; forward=TRUE; 73 curit=this->begin(); diff=i; forward=TRUE;
74 } else { // start from last node 74 } else { // start from last node
75 curit=fromLast(); diff=num - i - 1; 75 curit=this->fromLast(); diff=num - i - 1;
76 if (diff<0) diff=0; 76 if (diff<0) diff=0;
77 forward=FALSE; 77 forward=FALSE;
78 } 78 }
79 if (forward) { 79 if (forward) {
80 while(diff--) curit++; 80 while(diff--) curit++;
81 } else { 81 } else {
82 while(diff--) curit--; 82 while(diff--) curit--;
83 } 83 }
84 fvp->curpos=i; fvp->curit=curit; 84 fvp->curpos=i; fvp->curit=curit;
85 return curit; 85 return curit;
86 } 86 }
87 ConstIterator fastat( uint i ) const { 87 ConstIterator fastat( uint i ) const {
88 uint num=count(); 88 uint num=this->count();
89 if (i>=num) {return end();} 89 if (i>=num) {return this->end();}
90 if (fvp->curpos<0) { fvp->curpos=0; fvp->curit=begin(); } 90 if (fvp->curpos<0) { fvp->curpos=0; fvp->curit=this->begin(); }
91 uint curpos=(uint) fvp->curpos; 91 uint curpos=(uint) fvp->curpos;
92 ConstIterator curit=fvp->curit; 92 ConstIterator curit=fvp->curit;
93 if (curpos==i) return curit; 93 if (curpos==i) return curit;
94 94
95 int diff=i-curpos; 95 int diff=i-curpos;
96 bool forward; 96 bool forward;
97 if (diff<0) diff=-diff; 97 if (diff<0) diff=-diff;
98 if (((uint)diff < i) && ((uint)diff < num-i)) { // start from current node 98 if (((uint)diff < i) && ((uint)diff < num-i)) { // start from current node
99 forward=i > (uint)curpos; 99 forward=i > (uint)curpos;
100 } else if (i < num - i) { // start from first node 100 } else if (i < num - i) { // start from first node
101 curit=begin(); diff=i; forward=TRUE; 101 curit=this->begin(); diff=i; forward=TRUE;
102 } else { // start from last node 102 } else { // start from last node
103 curit=fromLast(); diff=num - i - 1; 103 curit=this->fromLast(); diff=num - i - 1;
104 if (diff<0) diff=0; 104 if (diff<0) diff=0;
105 forward=FALSE; 105 forward=FALSE;
106 } 106 }
107 if (forward) { 107 if (forward) {
108 while(diff--) curit++; 108 while(diff--) curit++;
109 } else { 109 } else {
110 while(diff--) curit--; 110 while(diff--) curit--;
111 } 111 }
112 fvp->curpos=i; fvp->curit=curit; 112 fvp->curpos=i; fvp->curit=curit;
113 return curit; 113 return curit;
114 } 114 }
115 115
116public: 116public:
117 FastValueList() : QValueList<T>() 117 FastValueList() : QValueList<T>()
118 { fvp=new FVPrivate<T>(); } 118 { fvp=new FVPrivate<T>(); }
119 FastValueList(const FastValueList<T>& l) : QValueList<T>(l) 119 FastValueList(const FastValueList<T>& l) : QValueList<T>(l)
@@ -125,35 +125,35 @@ public:
125 } 125 }
126 126
127 Iterator append( const T& x ) { 127 Iterator append( const T& x ) {
128 fvp->curpos=-1; return QValueList<T>::append( x ); 128 fvp->curpos=-1; return QValueList<T>::append( x );
129 } 129 }
130 Iterator prepend( const T& x ) { 130 Iterator prepend( const T& x ) {
131 fvp->curpos=-1; return QValueList<T>::prepend( x ); 131 fvp->curpos=-1; return QValueList<T>::prepend( x );
132 } 132 }
133 133
134 Iterator remove( Iterator it ) { 134 Iterator remove( Iterator it ) {
135 fvp->curpos=-1; return QValueList<T>::remove( it ); 135 fvp->curpos=-1; return QValueList<T>::remove( it );
136 } 136 }
137 void remove( const T& x ) { 137 void remove( const T& x ) {
138 fvp->curpos=-1; QValueList<T>::remove( x ); 138 fvp->curpos=-1; QValueList<T>::remove( x );
139 } 139 }
140 140
141 T& operator[] ( uint i ) { detach(); return fastat(i); } 141 T& operator[] ( uint i ) { this->detach(); return fastat(i); }
142 const T& operator[] ( uint i ) const { return *fastat(i); } 142 const T& operator[] ( uint i ) const { return *fastat(i); }
143 Iterator at( uint i ) { detach(); return fastat(i); } 143 Iterator at( uint i ) { this->detach(); return fastat(i); }
144 ConstIterator at( uint i ) const { return ConstIterator( fastat(i) ); } 144 ConstIterator at( uint i ) const { return ConstIterator( fastat(i) ); }
145}; 145};
146 146
147 147
148/** 148/**
149 The TextLine represents a line of text. A text line that contains the 149 The TextLine represents a line of text. A text line that contains the
150 text, an attribute for each character, an attribute for the free space 150 text, an attribute for each character, an attribute for the free space
151 behind the last character and a context number for the syntax highlight. 151 behind the last character and a context number for the syntax highlight.
152 The attribute stores the index to a table that contains fonts and colors 152 The attribute stores the index to a table that contains fonts and colors
153 and also if a character is selected. 153 and also if a character is selected.
154*/ 154*/
155class TextLine : public KShared 155class TextLine : public KShared
156{ 156{
157 friend class KWBuffer; 157 friend class KWBuffer;
158 friend class KWBufBlock; 158 friend class KWBufBlock;
159 159