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
;
31 * @brief A utility class to simplify the interaction with variant components.
33 * A component object holds all official components of a variant, and exposes
34 * utility methods to retrieve them, or create them using the appropriate
37 * Most methods return a component owned by the variant, but those that start
38 * with 'create' use a factory to instantiate a new component that will be
39 * owned by the caller.
42 std::auto_ptr
<Variant
> m_variant
;
44 IAnimatorFactory
* m_animator_factory
;
45 IStateFactory
* m_state_factory
;
47 QMap
<QString
, IMoveSerializer
*> m_move_serializers
;
50 IValidator
* m_validator
;
51 QMap
<int, IColor
*> m_players
;
53 explicit Components(Variant
*);
55 void setVariant(Variant
*);
57 IAnimator
* createAnimator(TaguaAPI
* api
) const;
58 IState
* createState() const;
60 IMoveSerializer
* moveSerializer(const QString
& type
);
63 IValidator
* validator();
64 IColor
* player(int index
);
65 QMap
<int, IColor
*> players();
70 #endif // COMPONENTS_H