• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • KDevelop AutoTools Parser
 

KDevelop AutoTools Parser

  • buildtools
  • lib
  • parsers
  • autotools
autotoolsast.cpp
1 /***************************************************************************
2  * Copyright (C) 2005 by Alexander Dymo *
3  * adymo@kdevelop.org *
4  * *
5  * Copyright (c) 2005 by Matt Rogers *
6  * mattr@kde.org *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU Library General Public License as *
10  * published by the Free Software Foundation; either version 2 of the *
11  * License, or (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU Library General Public *
19  * License along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
22  ***************************************************************************/
23 #include "autotoolsast.h"
24 
25 namespace AutoTools {
26 
27 //AST
28 
29 AST::~AST()
30 {
31  for (TQValueList<AST*>::iterator it = m_children.begin(); it != m_children.end(); ++it)
32  {
33  AST *node = *it;
34  delete node;
35  }
36 }
37 
38 void AST::addChildAST(AST *node)
39 {
40  m_children.append(node);
41 }
42 
43 void AST::writeBack(TQString &buffer)
44 {
45  for (TQValueList<AST*>::const_iterator it = m_children.constBegin();
46  it != m_children.constEnd(); ++it)
47  {
48  if (*it)
49  (*it)->writeBack(buffer);
50  }
51 }
52 
53 TQString AST::indentation()
54 {
55  TQString result;
56  for (int i = 0; i < depth(); i++)
57  result += '\t';
58  return result;
59 }
60 
61 bool AST::hasChildren() const
62 {
63  return !m_children.isEmpty();
64 }
65 
66 TQValueList<AST*> AST::children() const
67 {
68  return m_children;
69 }
70 
71 //ProjectAST
72 
73 void ProjectAST::writeBack(TQString &buffer)
74 {
75  if ( isRule() )
76  buffer += scopedID;
77  else
78  buffer += indentation();
79 
80  AST::writeBack(buffer);
81 
82 }
83 
84 void ProjectAST::addChildAST(AST *node)
85 {
86  statements.append(node);
87  AST::addChildAST(node);
88 }
89 
90 void AssignmentAST::writeBack(TQString &buffer)
91 {
92  buffer += indentation() + scopedID + " " + op + values.join("");
93 }
94 
95 void AutomakeTargetAST::writeBack( TQString& buffer )
96 {
97  buffer += target + ":" + deps.join("");
98 }
99 
100 void ConditionAST::writeBack( TQString& buffer )
101 {
102  buffer += indentation() + type + " " + conditionName;
103 }
104 
105 void NewLineAST::writeBack(TQString &buffer)
106 {
107  buffer += "\n";
108 }
109 
110 void CommentAST::writeBack(TQString &buffer)
111 {
112  buffer += indentation() + comment;
113 }
114 
115 }
116 
117 // kate: indent-mode csands; tab-width 4; space-indent off;
AutoTools::AST::indentation
virtual TQString indentation()
Definition: autotoolsast.cpp:53
AutoTools::NewLineAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition: autotoolsast.cpp:105
AutoTools::AST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition: autotoolsast.cpp:43
AutoTools::ProjectAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition: autotoolsast.cpp:73
AutoTools::AST::AST
AST(NodeType nodeType)
Constructs AST with given node type.
Definition: autotoolsast.h:60
AutoTools::ProjectAST::addChildAST
virtual void addChildAST(AST *node)
Adds child AST node to this node.
Definition: autotoolsast.cpp:84
AutoTools::AST::hasChildren
bool hasChildren() const
Definition: autotoolsast.cpp:61
AutoTools::AST::addChildAST
virtual void addChildAST(AST *node)
Adds child AST node to this node.
Definition: autotoolsast.cpp:38
AutoTools::CommentAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition: autotoolsast.cpp:110
AutoTools::AST
AST node.
Definition: autotoolsast.h:46
AutoTools::AssignmentAST::writeBack
virtual void writeBack(TQString &buffer)
Writes information stored in the AST into the buffer.
Definition: autotoolsast.cpp:90
AutoTools::AST::children
TQValueList< AST * > children() const
Get the children of this ast.
Definition: autotoolsast.cpp:66
AutoTools
Definition: autotoolsast.cpp:25
AutoTools::AST::depth
int depth() const
Definition: autotoolsast.h:83

KDevelop AutoTools Parser

Skip menu "KDevelop AutoTools Parser"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

KDevelop AutoTools Parser

Skip menu "KDevelop AutoTools Parser"
  • buildtools
  •   lib
  •     base
  •     parsers
  •       autotools
  •       qmake
  •     widgets
  •   api
  • languages
  •   lib
  •     debugger
  •     designer_integration
  •     interfaces
  • lib
  •   catalog
  •   interfaces
  •     extensions
  •     external
  •     extras
  •   util
  •   widgets
  •     propeditor
  • parts
  •   documentation
  •     interfaces
  • src
  •   profileengine
  •     lib
Generated for KDevelop AutoTools Parser by doxygen 1.8.13
This website is maintained by Timothy Pearson.