created nodes subdir and moved Node.{h,cc} there
git-svn-id: svn://anubis/jtlc/trunk@11 f5bc74b8-7b62-4e90-9214-7121d538519f
This commit is contained in:
1 parent
93fe98f7fd
commit
19dd46d14d
6 files changed
+30
-4
No files matched your search
@@ -1,22 +0,0 @@
|
||||
|
||||
#include "Node.h"
|
||||
#include <vector>
|
||||
#include "util/refptr.h"
|
||||
using namespace std;
|
||||
|
||||
void Node::addChildren(refptr<Node> other)
|
||||
{
|
||||
if (other.isNull())
|
||||
return;
|
||||
|
||||
for (vector< refptr<Node> >::const_iterator it = other->m_children.begin();
|
||||
it != other->m_children.end();
|
||||
it++)
|
||||
{
|
||||
addChild(*it);
|
||||
}
|
||||
}
|
||||
|
||||
Node::~Node()
|
||||
{
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
|
||||
#ifndef NODES_H
|
||||
#define NODES_H NODES_H
|
||||
|
||||
#include "util/refptr.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
virtual ~Node();
|
||||
void addChild(refptr<Node> child) { m_children.push_back(child); }
|
||||
void addChildren(refptr<Node> other);
|
||||
std::vector< refptr<Node> > & getChildren() { return m_children; }
|
||||
|
||||
virtual unsigned long getInteger() { return 0ul; }
|
||||
virtual std::string getString() { return ""; }
|
||||
|
||||
protected:
|
||||
std::vector< refptr<Node> > m_children;
|
||||
};
|
||||
|
||||
|
||||
class IntegerNode : public Node
|
||||
{
|
||||
public:
|
||||
IntegerNode(unsigned long integer) { m_integer = integer; }
|
||||
unsigned long getInteger() { return m_integer; }
|
||||
protected:
|
||||
unsigned long m_integer;
|
||||
};
|
||||
|
||||
class StringNode : public Node
|
||||
{
|
||||
public:
|
||||
StringNode(const std::string & str) { m_string = str; }
|
||||
std::string getString() { return m_string; }
|
||||
protected:
|
||||
std::string m_string;
|
||||
};
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
#define PARSER_H
|
||||
|
||||
#include "util/refptr.h"
|
||||
#include "parser/Node.h"
|
||||
#include "nodes/Node.h"
|
||||
|
||||
#define YYSTYPE refptr<Node>
|
||||
|
||||
|
||||
Reference in new issue
Block a user