2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
19 class IAnimatorFactory
;
21 class IMoveSerializer
;
30 * @brief A utility class to simplify the interaction with variant components.
32 * A component object holds all official components of a variant, and exposes
33 * utility methods to retrieve them, or create them using the appropriate
36 * Most methods return a component owned by the variant, but those that start
37 * with 'create' use a factory to instantiate a new component that will be
38 * owned by the caller.
41 std::auto_ptr
<Variant
> m_variant
;
43 IAnimatorFactory
* m_animator_factory
;
46 QMap
<QString
, IMoveSerializer
*> m_move_serializers
;
49 IValidator
* m_validator
;
50 QMap
<int, IColor
*> m_players
;
52 explicit Components(Variant
*);
54 void setVariant(Variant
*);
56 IAnimator
* createAnimator(TaguaAPI
* api
) const;
57 IState
* createState() const;
59 IMoveSerializer
* moveSerializer(const QString
& type
);
62 IValidator
* validator();
63 IColor
* player(int index
);
64 QMap
<int, IColor
*> players();
69 #endif // COMPONENTS_H