~ubuntu-branches/ubuntu/natty/plee-the-bear/natty

« back to all changes in this revision

Viewing changes to bear-factory/bear-editor/src/bf/item_instance.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge, Julien Jorge
  • Date: 2010-11-17 20:13:34 UTC
  • mfrom: (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101117201334-o4dp7uq437to7oxb
Tags: 0.5.1-1
[ Julien Jorge ]
* New upstream release (Closes: #565062, #546514).
* Add armhf architecture (Closes: #604689).
* Remove patches integrated upstream: rpath-editors.diff, rpath-game.diff,
  editors-menu-section.diff.
* Bump the Standard-Version, no changes.
* Update my email address.
* Set build dependency of libclaw to 1.6.0.
* Add the missing ${misc:Depends} in debian/control.
* List gettext translations in bear-factory.install and plee-the-bear.install.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
    Bear Engine - Editor library
3
3
 
4
 
    Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
 
4
    Copyright (C) 2005-2010 Julien Jorge, Sebastien Angibaud
5
5
 
6
6
    This program is free software; you can redistribute it and/or modify it
7
7
    under the terms of the GNU General Public License as published by the
37
37
 
38
38
#include <claw/assert.hpp>
39
39
 
40
 
#include "bf/animation.hpp"
 
40
#include "bf/any_animation.hpp"
41
41
#include "bf/custom_type.hpp"
42
42
#include "bf/item_rendering_parameters.hpp"
 
43
#include "bf/sample.hpp"
43
44
#include "bf/type_field.hpp"
44
45
#include "bf/libeditor_export.hpp"
45
46
 
105
106
                                                                        \
106
107
  private:                                                              \
107
108
  std::map<std::string, type> m_ ## name;                               \
108
 
  std::map< std::string, std::list<type> > m_ ## name ## _list
 
109
  std::map< std::string, std::list<type> > m_ ## name ## _list;         \
 
110
                                                                        \
 
111
  friend struct field_map_by_type<type>;                                \
 
112
  friend struct field_map_by_type< std::list<type> >
109
113
 
110
114
namespace bf
111
115
{
117
121
   */
118
122
  class BEAR_EDITOR_EXPORT item_instance
119
123
  {
 
124
  private:
 
125
    template<typename T> struct field_map_by_type;
 
126
 
 
127
    /**
 
128
     * \brief Function object to tell if a value has been given to a field.
 
129
     *
 
130
     * \b Template \b parameters:
 
131
     * - \param T The type of the field data.
 
132
     */
 
133
    template<typename T>
 
134
    struct field_has_value
 
135
    {
 
136
      bool operator()
 
137
        ( const item_instance& item, const std::string& field_name ) const;
 
138
    }; // field_has_value
 
139
 
 
140
    /**
 
141
     * \brief Function object to erase the value of a field.
 
142
     *
 
143
     * \b Template \b parameters:
 
144
     * - \param T The type of the field data.
 
145
     */
 
146
    template<typename T>
 
147
    struct erase_field_value
 
148
    {
 
149
      void operator()
 
150
        ( item_instance& item, const std::string& field_name ) const;
 
151
    }; // erase_field_value
 
152
 
120
153
  public:
121
154
    item_instance( item_class const* c );
122
155
    item_instance( const item_instance& that );
135
168
    const std::string& get_id() const;
136
169
    void set_id( const std::string& id );
137
170
 
 
171
    bool has_value( const std::string& field_name ) const;
138
172
    bool has_value( const type_field& f ) const;
139
173
    void delete_value( const type_field& f );
140
174
 
141
175
    bool get_fixed() const;
142
176
    void set_fixed( bool b );
 
177
    void rename_item_reference_fields
 
178
    ( const std::map<std::string, std::string>& map_id );
143
179
 
144
180
    void compile( compiled_file& f,
145
181
                  const std::map<std::string, unsigned int>& id_to_int ) const;
146
182
 
147
183
    bool check
148
 
    ( std::string& error_msg,
149
 
      const std::map<std::string,item_instance*>& map_id );
 
184
    ( const std::map<std::string,item_instance*>& map_id );
150
185
 
151
186
  private:
152
187
    bool check_mass_for_fixed_item(std::string& error_msg) const;
208
243
    FIELD_TYPE( bool_type, bool );
209
244
    FIELD_TYPE( string_type, string );
210
245
    FIELD_TYPE( sprite, sprite );
211
 
    FIELD_TYPE( animation_file_type, animation );
 
246
    FIELD_TYPE( any_animation, animation );
212
247
    FIELD_TYPE( item_reference_type, item_reference );
213
248
    FIELD_TYPE( font_file_type, font );
214
 
    FIELD_TYPE( sample_file_type, sample );
 
249
    FIELD_TYPE( sample, sample );
 
250
 
215
251
  }; // class item_instance
216
252
} // namespace bf
217
253
 
218
 
#include "bf/impl/item_instance.tpp"
219
 
 
220
254
#endif // __BF_ITEM_INSTANCE_HPP__