#include "stdafx.h"
#include "HierarchyLoaderSimulator.h"
#include <Model/CppTagModel.h>
using namespace std;
namespace Simulators
{
Inheritable& HierarchyLoader::loadHierarchy(Inheritable &type, bool)
{
type.setParents(loadSupertypeHierarchy(type));
type.setExtendors(loadSubtypeHierarchy(type));
return type;
}
std::list<smart_ptr<Inheritable> > HierarchyLoader::loadSubtypeHierarchy(const Inheritable&, bool)
{
TagLocation location;
std::list<smart_ptr<Inheritable> > extendors;
smart_ptr<Struct> child1(new Struct("::Child1", ePublic, location));
child1->addMethod(Method("void", "Child1::publicMethod", ePublic, TagLocation()));
child1->addMethod(Method("void", "Child1::protectedMethod", eProtected, TagLocation()));
child1->addMethod(Method("void", "Child1::privateMethod", ePrivate, TagLocation()));
smart_ptr<Class> child2(new Class("::Child2", ePublic, location));
smart_ptr<Class> child2_1(new Class("Namespace1::Child2_1", ePublic, location));
smart_ptr<Class> child2_2(new Class("::Child2_2", ePublic, location));
smart_ptr<Struct> child2_2_1(new Struct("::Child2_2_1", ePublic, location));
smart_ptr<Class> child2_3(new Class("::?Child2_3", ePublic, location));
extendors.clear();
extendors.push_back(child2_2_1);
child2_2->setExtendors(extendors);
extendors.clear();
extendors.push_back(child2_1);
extendors.push_back(child2_2);
extendors.push_back(child2_3);
child2->setExtendors(extendors);
extendors.clear();
extendors.push_back(child1);
extendors.push_back(child2);
return extendors;
}
std::list<smart_ptr<Inheritable> > HierarchyLoader::loadSupertypeHierarchy(const Inheritable &tag, bool)
{
TagLocation location;
std::list<smart_ptr<Inheritable> > parents;
smart_ptr<Struct> parent1(new Struct("::Parent1", ePublic, location));
smart_ptr<Class> parent1_1(new Class("Namespace1::Parent_1_1", ePublic, location));
smart_ptr<Class> parent1_2(new Class("::Parent1_2", ePublic, location));
smart_ptr<Struct> parent1_2_1(new Struct("::Parent1_2_1", ePublic, location));
smart_ptr<Class> parent2(new Class("::Parent2", ePublic, location));
parents.clear();
parents.push_back(parent1_2_1);
parent1_2->setParents(parents);
parents.clear();
parents.push_back(parent1_1);
parents.push_back(parent1_2);
parent1->setParents(parents);
parents.clear();
parents.push_back(parent1);
parents.push_back(parent2);
return parents;
}
}