44 lines
975 B
C++
44 lines
975 B
C++
|
|
#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
|