From ba714f2fe9064dd49b4c4a387502579b38a73223 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Sun, 2 Sep 2012 19:19:40 +0200 Subject: [PATCH] added utility function to create headers --- src/loader/ParsedSource.cpp | 6 ++++++ src/loader/ParsedSource.h | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/loader/ParsedSource.cpp b/src/loader/ParsedSource.cpp index bceed08..90498e7 100644 --- a/src/loader/ParsedSource.cpp +++ b/src/loader/ParsedSource.cpp @@ -103,6 +103,12 @@ const Definition &ParsedSource::GetDefinition(const std::string &name) const { } } +void ParsedSource::WriteHeader(std::ostream &out) const { + for (std::set::const_iterator i(exports.begin()), end(exports.end()); i != end; ++i) { + out << GetDeclaration(*i).TypeName() << ' ' << *i << std::endl; + } +} + Definition::~Definition() { if (isLiteral) { diff --git a/src/loader/ParsedSource.h b/src/loader/ParsedSource.h index 8401777..98ecd84 100644 --- a/src/loader/ParsedSource.h +++ b/src/loader/ParsedSource.h @@ -206,6 +206,9 @@ public: const std::map &Definitions() const { return definitions; } const std::set &Exports() const { return exports; } +public: + void WriteHeader(std::ostream &) const; + private: std::map declarations; std::map definitions; -- 2.39.2