Commit 8bfbc960 authored by Julian Kranz's avatar Julian Kranz
Browse files

Merge pull request #19 from newgre/master

Cleanup in statement class
parents 7719ddc8 304075d4
......@@ -6,41 +6,34 @@
*/
#pragma once
#include "statement_visitor.h"
#include <iosfwd>
#include <string>
#include <vector>
#include "cppgdsl/rreil/statement/statement_visitor.h"
namespace gdsl {
namespace rreil {
typedef std::vector<rreil::statement*> statements_t;
// Acts as the base class for all expression and statement types in the RReil
// language.
class statement {
private:
virtual void put(std::ostream &out) const = 0;
public:
virtual ~statement() {
}
public:
virtual ~statement() {}
virtual void accept(statement_visitor &v) = 0;
std::string to_string() const;
friend std::ostream& operator<<(std::ostream &out, const statement &_this);
virtual void accept(statement_visitor &v) = 0;
private:
virtual void put(std::ostream &out) const = 0;
friend std::ostream &operator<<(std::ostream &out,
const statement &statement);
};
std::ostream& operator<<(std::ostream &out, const statement &_this);
typedef std::vector<rreil::statement*> statements_t;
// Appends the string representation of the given statement to the output
// stream.
std::ostream &operator<<(std::ostream &out, const statement &statement);
} // namespace rreil
} // namespace gdsl
#include "assign.h"
#include "branch.h"
#include "cbranch.h"
#include "floating.h"
#include "ite.h"
#include "load.h"
#include "prim.h"
#include "store.h"
#include "throw.h"
#include "while.h"
......@@ -7,14 +7,14 @@
#include <cppgdsl/rreil/statement/statement.h>
#include <sstream>
std::ostream &gdsl::rreil::operator<<(std::ostream &out,
const statement &statement) {
statement.put(out);
return out;
}
std::string gdsl::rreil::statement::to_string() const {
std::stringstream o;
o << *this;
return o.str();
}
std::ostream &gdsl::rreil::operator<<(std::ostream &out,
const statement &_this) {
_this.put(out);
return out;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment