46 lines
1.0 KiB
C++
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
|