// fragmentactfact.cpp -- the action factory for fragment actions // // Written by Frederic Bouvier, started May 2002. // // Copyright (C) 2002 Frederic Bouvier - fredb@users.sourceforge.net // // This program 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 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 // General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // $Id: fragmentactfact.cpp,v 1.9 2005/05/09 07:01:52 fredb Exp $ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "fragmentactfact.hpp" #include #include "fragmentact.hpp" FGSD_FragmentActionFactory::~FGSD_FragmentActionFactory() { } FGSD_Action *FGSD_FragmentActionFactory::createAction( const char *__project, SGPropertyNode *__node ) { FGSD_Action *ret = 0; SGPropertyNode *nm = __node->getChild( "name" ); if ( nm ) { std::string name = nm->getStringValue(); if ( name == "move-up" ) ret = new FGSD_MoveFragmentAction( true ); else if ( name == "move-down" ) ret = new FGSD_MoveFragmentAction( false ); else if ( name == "add" ) ret = new FGSD_AddRemoveFragmentAction( true ); else if ( name == "remove" ) ret = new FGSD_AddRemoveFragmentAction( false ); if ( ret ) ret->load( __project, __node ); } return ret; } std::string FGSD_FragmentActionFactory::getName() const { return "map-fragment"; } FGSD_FragmentActionFactory fragmentActionFactory;