Changeset 561 for trunk/tools/linguist/shared/proitems.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/tools/linguist/shared/proitems.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information ([email protected]) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation ([email protected]) 5 6 ** 6 7 ** This file is part of the Qt Linguist of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you 37 ** @nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 59 59 60 60 // --------------- ProBlock ---------------- 61 61 62 ProBlock::ProBlock(ProBlock *parent) 62 63 { 63 64 m_blockKind = 0; 64 65 m_parent = parent; 66 65 67 } 66 68 67 69 ProBlock::~ProBlock() 68 70 { 69 qDeleteAll(m_proitems); 71 foreach (ProItem *itm, m_proitems) 72 if (itm->kind() == BlockKind) 73 static_cast<ProBlock *>(itm)->deref(); 74 else 75 delete itm; 70 76 } 71 77 … … 110 116 } 111 117 112 bool ProBlock::Accept(AbstractProItemVisitor *visitor) 113 { 114 visitor->visitBeginProBlock(this); 115 foreach (ProItem *item, m_proitems) { 116 if (!item->Accept(visitor)) 117 return false; 118 ProItem::ProItemReturn ProBlock::Accept(AbstractProItemVisitor *visitor) 119 { 120 if (visitor->visitBeginProBlock(this) == ReturnSkip) 121 return ReturnTrue; 122 ProItemReturn rt = ReturnTrue; 123 for (int i = 0; i < m_proitems.count(); ++i) { 124 rt = m_proitems.at(i)->Accept(visitor); 125 if (rt != ReturnTrue && rt != ReturnFalse) { 126 if (rt == ReturnLoop) { 127 rt = ReturnTrue; 128 while (visitor->visitProLoopIteration()) 129 for (int j = i; ++j < m_proitems.count(); ) { 130 rt = m_proitems.at(j)->Accept(visitor); 131 if (rt != ReturnTrue && rt != ReturnFalse) { 132 if (rt == ReturnNext) { 133 rt = ReturnTrue; 134 break; 135 } 136 if (rt == ReturnBreak) 137 rt = ReturnTrue; 138 goto do_break; 139 } 140 } 141 do_break: 142 visitor->visitProLoopCleanup(); 143 } 144 break; 145 } 118 146 } 119 return visitor->visitEndProBlock(this); 147 visitor->visitEndProBlock(this); 148 return rt; 120 149 } 121 150 … … 149 178 } 150 179 151 boolProVariable::Accept(AbstractProItemVisitor *visitor)180 ProVariable::Accept(AbstractProItemVisitor *visitor) 152 181 { 153 182 visitor->visitBeginProVariable(this); 154 foreach (ProItem *item, m_proitems) { 155 if (!item->Accept(visitor)) 156 return false; 157 } 158 return visitor->visitEndProVariable(this); 183 foreach (ProItem *item, m_proitems) 184 item->Accept(visitor); // cannot fail 185 visitor->visitEndProVariable(this); 186 return ReturnTrue; 159 187 } 160 188 … … 191 219 } 192 220 193 bool ProValue::Accept(AbstractProItemVisitor *visitor) 194 { 195 return visitor->visitProValue(this); 221 ProItem::ProItemReturn ProValue::Accept(AbstractProItemVisitor *visitor) 222 { 223 visitor->visitProValue(this); 224 return ReturnTrue; 196 225 } 197 226 … … 217 246 } 218 247 219 boolProFunction::Accept(AbstractProItemVisitor *visitor)248 ProFunction::Accept(AbstractProItemVisitor *visitor) 220 249 { 221 250 return visitor->visitProFunction(this); … … 243 272 } 244 273 245 bool ProCondition::Accept(AbstractProItemVisitor *visitor) 246 { 247 return visitor->visitProCondition(this); 274 ProItem::ProItemReturn ProCondition::Accept(AbstractProItemVisitor *visitor) 275 { 276 visitor->visitProCondition(this); 277 return ReturnTrue; 248 278 } 249 279 … … 269 299 } 270 300 271 bool ProOperator::Accept(AbstractProItemVisitor *visitor) 272 { 273 return visitor->visitProOperator(this); 301 ProItem::ProItemReturn ProOperator::Accept(AbstractProItemVisitor *visitor) 302 { 303 visitor->visitProOperator(this); 304 return ReturnTrue; 274 305 } 275 306 … … 316 347 } 317 348 318 bool ProFile::Accept(AbstractProItemVisitor *visitor) 319 { 320 visitor->visitBeginProFile(this); 321 foreach (ProItem *item, m_proitems) { 322 if (!item->Accept(visitor)) 323 return false; 324 } 349 ProItem::ProItemReturn ProFile::Accept(AbstractProItemVisitor *visitor) 350 { 351 ProItemReturn rt; 352 if ((rt = visitor->visitBeginProFile(this)) != ReturnTrue) 353 return rt; 354 ProBlock::Accept(visitor); // cannot fail 325 355 return visitor->visitEndProFile(this); 326 356 }
Note:
See TracChangeset
for help on using the changeset viewer.