jtlc/nodes/Node.h
josh 8333a037c9 made IntegerNode hold a 64-bit integer
git-svn-id: svn://anubis/jtlc/trunk@12 f5bc74b8-7b62-4e90-9214-7121d538519f
2010-01-13 19:46:35 +00:00

46 lines
1.0 KiB
C++

#ifndef NODE_H
#define NODE_H NODE_H
#include <stdint.h>
#include <vector>
#include <string>
#include "util/refptr.h"
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 uint64_t getInteger() { return 0x0ULL; }
virtual std::string getString() { return ""; }
virtual void process(FILE * out) { }
protected:
std::vector< refptr<Node> > m_children;
};
class IntegerNode : public Node
{
public:
IntegerNode(uint64_t integer) { m_integer = integer; }
unsigned long getInteger() { return m_integer; }
protected:
uint64_t 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