* Validate brackets and comments once parsing ends. * @return @c false if matching brackets or comments fails. * @note Validation is destructive, that is, it transitions this object into an undefined state. */
| 205 | * @note Validation is destructive, that is, it transitions this object into an undefined state. |
| 206 | */ |
| 207 | bool validate() |
| 208 | { |
| 209 | for (std::size_t i = 0; i < m_stacks.size(); ++i) { |
| 210 | if (!m_stacks[i].validate()) { |
| 211 | qCWarning(UTIL) << "giving up formatting because the formatter inserted or removed the pair" |
| 212 | << m_stackStrings[i] << "across context-text boundaries"; |
| 213 | return false; |
| 214 | } |
| 215 | } |
| 216 | return true; |
| 217 | } |
| 218 | |
| 219 | private: |
| 220 | // the following 3 constants are indices into m_stacks and m_stackStrings |