1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
// Description:
// Different kinds of selectable factories.
//
// Copyright (C) 2001 Frank Becker
//
// 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
//
#ifndef _SelectableFactory_hpp_
#define _SelectableFactory_hpp_
#include <string>
#include <hashMap.hpp>
#include <Trace.hpp>
#include <Point.hpp>
#include <Tokenizer.hpp>
#include <HashString.hpp>
#include <FindHash.hpp>
#include <Selectable.hpp>
#include <tinyxml.h>
class SelectableFactory
{
public:
static SelectableFactory *getFactory( const string &name);
static void cleanup( void);
virtual Selectable *createSelectable( TiXmlNode *) = 0;
protected:
SelectableFactory( void) {}
virtual ~SelectableFactory() {}
static hash_map<
const string, SelectableFactory*, hash<const string>, equal_to<const string> > _sfMap;
void posToPoint2D( const string &pos, Point2D &point);
string getAttribute( const TiXmlElement* elem, string attr);
void getBasics(TiXmlElement* elem,Point2D &pos, string &text,string &info);
private:
static bool _initialized;
};
class ActionItemFactory: public SelectableFactory
{
public:
ActionItemFactory( void);
virtual ~ActionItemFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
class MenuItemFactory: public SelectableFactory
{
public:
MenuItemFactory( void);
virtual ~MenuItemFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
class TextItemFactory: public SelectableFactory
{
public:
TextItemFactory( void);
virtual ~TextItemFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
class BoolFactory: public SelectableFactory
{
public:
BoolFactory( void);
virtual ~BoolFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
class EnumFactory: public SelectableFactory
{
public:
EnumFactory( void);
virtual ~EnumFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
class FloatFactory: public SelectableFactory
{
public:
FloatFactory( void);
virtual ~FloatFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
class LeaderBoardFactory: public SelectableFactory
{
public:
LeaderBoardFactory( void);
virtual ~LeaderBoardFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
class ResolutionFactory: public SelectableFactory
{
public:
ResolutionFactory( void);
virtual ~ResolutionFactory();
virtual Selectable *createSelectable( TiXmlNode *node);
};
#endif
|