2
* =====================================================================================
4
* Filename: PccClass.cpp
9
* Created: 05.10.2009 16:57:14
13
* Author: Dominik 'domachine' Burgdoerfer (-), dominik.burgdoerfer@gmail.com
16
* =====================================================================================
20
# include "../dmcc/pcc/PccClass.hpp"
22
#include "../dmcc/Constructor.hpp"
27
* ==================================
28
* dmcc::pcc::PccClass Implementation
29
* ==================================
38
PccClass::PccClass(const std::string & name, const std::type_info * typeInfo) {
40
this->mTypeInfo = typeInfo;
50
PccClass::~PccClass() {
53
for(i = 0; i < mConstructors.size(); i++) {
54
delete mConstructors.at(i);
58
void PccClass::addConstructor(dmcc::Constructor * constructor) {
59
this->mConstructors.push_back(constructor);
62
void PccClass::setContext(PluginContext * context) {
63
this->mContext = context;
66
Constructor * PccClass::getConstructor(std::vector<boost::any> & params) {
68
for(i = 0; i < mConstructors.size(); i++) {
69
unsigned int matched = 0;
71
Constructor * current = mConstructors.at(i);
72
std::vector<const pcc::Argument *> * currentArgs = current->arguments();
74
for(j = 0; j < params.size(); j++) {
75
if(params.size() > currentArgs->size())
77
if(params.at(j).type() == *currentArgs->at(j)->type()) {
85
if(matched == params.size()) {
86
if(params.size() < currentArgs->size()) {
91
rArgs = currentArgs->size() - params.size();
94
for(iN = 0; iN < rArgs; iN++) {
95
boost::any * defaultArg = currentArgs->at(iN + params.size())->defaultArg();
102
for(iN = 0; iN < rArgs; iN++) {
103
boost::any * defaultArg = currentArgs->at(iN + params.size())->defaultArg();
104
if(defaultArg != 0) {
105
params.push_back(*defaultArg);
120
bool PccClass::operator==(const Class & clazz) {
121
return *mTypeInfo == clazz.stdTypeInfo();
124
bool PccClass::operator!=(const Class & clazz) {
125
return *mTypeInfo != clazz.stdTypeInfo();
128
bool PccClass::operator==(const std::type_info & typeInfo) {
129
return *mTypeInfo == typeInfo;
132
bool PccClass::operator!=(const std::type_info & typeInfo) {
133
return *mTypeInfo != typeInfo;
142
std::string PccClass::name() const {
146
const std::type_info & PccClass::stdTypeInfo() const {
150
PluginContext * PccClass::context() const {