fork download
  1.  
  2. /*!
  3.  * \brief NodeIteratorによって返されるようなQDomNodeの並びから木構造を構築するクラスです。
  4.  */
  5. class Builder
  6. {
  7. public:
  8. Builder(QDomNode const &root);
  9.  
  10. void push(Point const &point);
  11.  
  12. private:
  13. QStack<Point> m_stack;
  14. };
  15.  
  16. TM::DOM::Builder::Builder(QDomNode const &root)
  17. {
  18. m_stack.push(Point(root));
  19. }
  20.  
  21. void TM::DOM::Builder::push(Point const &point)
  22. {
  23. if(point.position() == TM::DOM::Point::Close)
  24. {
  25. Point tmp = m_stack.pop();
  26. qDebug() << "</" << point->nodeName() << ">";
  27. Q_ASSERT(point->nodeName() == tmp->nodeName());
  28. }
  29. else
  30. {
  31. QDomNode clone = point->cloneNode(false);
  32. m_stack.top()->appendChild(clone);
  33. if(clone.isElement())
  34. {
  35. qDebug() << "<" << clone.nodeName() << ">";
  36. m_stack.push(Point(clone));
  37. }
  38. else qDebug() << clone.nodeValue();
  39. }
  40. }
  41.  
  42.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:8:19: error: expected ')' before 'const'
  Builder(QDomNode const &root);
                   ^
prog.cpp:10:12: error: 'Point' has not been declared
  void push(Point const &point);
            ^
prog.cpp:13:2: error: 'QStack' does not name a type
  QStack<Point> m_stack;
  ^
prog.cpp:16:1: error: 'TM' does not name a type
 TM::DOM::Builder::Builder(QDomNode const &root)
 ^
prog.cpp:21:6: error: 'TM' has not been declared
 void TM::DOM::Builder::push(Point const &point)
      ^
prog.cpp:21:35: error: variable or field 'push' declared void
 void TM::DOM::Builder::push(Point const &point)
                                   ^
prog.cpp:21:29: error: 'Point' was not declared in this scope
 void TM::DOM::Builder::push(Point const &point)
                             ^
stdout
Standard output is empty