]> git.localhorst.tv Git - l2e.git/commitdiff
added utility function to create headers
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 2 Sep 2012 17:19:40 +0000 (19:19 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Sun, 2 Sep 2012 17:19:40 +0000 (19:19 +0200)
src/loader/ParsedSource.cpp
src/loader/ParsedSource.h

index bceed089f0377f4a4678edc84414afa4d7c3084b..90498e71f3e17ee5e2b96dea5d58803994851cc3 100644 (file)
@@ -103,6 +103,12 @@ const Definition &ParsedSource::GetDefinition(const std::string &name) const {
        }
 }
 
+void ParsedSource::WriteHeader(std::ostream &out) const {
+       for (std::set<string>::const_iterator i(exports.begin()), end(exports.end()); i != end; ++i) {
+               out << GetDeclaration(*i).TypeName() << ' ' << *i << std::endl;
+       }
+}
+
 
 Definition::~Definition() {
        if (isLiteral) {
index 8401777f54e0f43ebac98a6ed2e3286a268ec87f..98ecd8423c401652f235c01a5ed7d68d40b1379b 100644 (file)
@@ -206,6 +206,9 @@ public:
        const std::map<std::string, Definition *> &Definitions() const { return definitions; }
        const std::set<std::string> &Exports() const { return exports; }
 
+public:
+       void WriteHeader(std::ostream &) const;
+
 private:
        std::map<std::string, Declaration *> declarations;
        std::map<std::string, Definition *> definitions;