]> git.localhorst.tv Git - l2e.git/blobdiff - src/loader/TypeDescription.cpp
new object file format in compiler
[l2e.git] / src / loader / TypeDescription.cpp
index bcc480c6af6659ef6241c14bcf97a59ee01a68ad..1bb6c6505309117000822b92135c616cfb1d92a3 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * TypeDescription.cpp
- *
- *  Created on: Sep 4, 2012
- *      Author: holy
- */
-
 #include "TypeDescription.h"
 
 #include <algorithm>
@@ -30,6 +23,9 @@ void TypeDescription::AddField(const std::string &n, const FieldDescription &f)
        } else {
                fields.insert(std::make_pair(n, f));
        }
+       if (f.IsReferenced() || f.IsAggregate()) {
+               link = true;
+       }
 }
 
 bool TypeDescription::HasField(const std::string &name) const {
@@ -114,6 +110,20 @@ const TypeDescription &TypeDescription::Get(int id) {
 }
 
 
+int TypeDescription::GetMaxSize() {
+       int max = 0;
+       for (map<int, TypeDescription>::const_iterator
+                       i(typeDescriptions.begin()),
+                       end(typeDescriptions.end());
+                       i != end; ++i) {
+               if (i->second.Size() > max) {
+                       max = i->second.Size();
+               }
+       }
+       return max;
+}
+
+
 void TypeDescription::WriteSourceWiki(std::ostream &out) {
        vector<string> types;
        for (map<int, TypeDescription>::const_iterator i(typeDescriptions.begin()), end(typeDescriptions.end()); i != end; ++i) {
@@ -134,6 +144,8 @@ void TypeDescription::WriteSourceWiki(std::ostream &out) {
                const TypeDescription &td(Get(GetTypeId(*i)));
                out << "h3. " << td.TypeName() << endl << endl;
 
+               out << "Type ID: @" << td.TypeId() << "@" << endl << endl;
+
                if (td.Description()) {
                        out << td.Description() << endl << endl;
                }