// Ryzom - MMORPG Framework // Copyright (C) 2010 Winch Gate Property Limited // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as // published by the Free Software Foundation, either version 3 of the // License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . /* Copyright, 2000 Nevrax Ltd. * * This file is part of NEVRAX NEL. * NEVRAX NEL is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * NEVRAX NEL is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * You should have received a copy of the GNU General Public License * along with NEVRAX NEL; see the file COPYING. If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. */ #include "field.h" #include "cond_node.h" CField::CField() { _Name = std::string(""); } CField::CField(std::string name) { _Name = name; } const std::vector &CField::getPossibleValues() const { return _PossibleValues; } void CField::addPossibleValue(IValue *value) { _PossibleValues.push_back( value ); } CField::~CField() { std::vector::iterator it_val = _PossibleValues.begin(); while ( ! _PossibleValues.empty() ) { delete _PossibleValues.front(); _PossibleValues.erase( _PossibleValues.begin() ); } } const std::string &CField::getName() const { return _Name; } ///////////////////////////////////////////////////////////////////////////////////////////// CBoolField::CBoolField() : CField() { _PossibleValues.push_back( new CValue(true) ); _PossibleValues.push_back( new CValue(false) ); } CBoolField::CBoolField(std::string name) : CField( name ) { _PossibleValues.push_back( new CValue(true) ); _PossibleValues.push_back( new CValue(false) ); } ICondNode *CBoolField::createNode(int key, int pos, std::vector &) { ICondNode *node = new CEqualNode(this, pos); return node; } ///////////////////////////////////////////////////////////////////////////////////////////// CStringField::CStringField() : CField() { } CStringField::CStringField(std::string name, std::vector &values) : CField(name) { std::vector::iterator it_val = values.begin(); while ( it_val != values.end() ) { _PossibleValues.push_back( new CValue( *it_val ) ); it_val++; } } ICondNode *CStringField::createNode(int key, int pos, std::vector &) { return new CEqualNode(this, pos); } ///////////////////////////////////////////////////////////////////////////////////////////// CIntField::CIntField() : CField() { } CIntField::CIntField(std::string name, std::vector &values) : CField( name ) { std::vector::iterator it_val = values.begin(); while ( it_val != values.end() ) { _PossibleValues.push_back( new CValue( *it_val ) ); it_val++; } } ICondNode *CIntField::createNode(int key, int pos, std::vector &) { return new CEqualNode(this, pos); } ///////////////////////////////////////////////////////////////////////////////////////////// /* CRealField::CRealField() : CField() { } CRealField::CRealField(std::string name, std::vector &values) : CField( name ) { std::vector::iterator it_val = values.begin(); while ( it_val != values.end() ) { _PossibleValues.push_back( new CValue( *it_val ) ); it_val++; } } ICondNode *CRealField::createNode(int key, int pos, std::vector &) { return new CEqualNode(this, pos); } void CRealField::computeRanges(int key, int pos, std::vector &records) { int max_gain_attrib = -1; double max_gain = 0; std::vector::iterator it_r = records.begin(); while ( it_r != records.end() ) { it_r++; } } */