~ubuntu-branches/ubuntu/trusty/plee-the-bear/trusty-proposed

« back to all changes in this revision

Viewing changes to bear-factory/model-editor/src/bf/history/action_set_item_field.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
 
/*
2
 
    Bear Engine - Model editor
3
 
 
4
 
    Copyright (C) 2005-2009 Julien Jorge, Sebastien Angibaud
5
 
 
6
 
    This program is free software; you can redistribute it and/or modify it
7
 
    under the terms of the GNU General Public License as published by the
8
 
    Free Software Foundation; either version 2 of the License, or (at your
9
 
    option) any later version.
10
 
 
11
 
    This program is distributed in the hope that it will be useful, but WITHOUT
12
 
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
 
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14
 
    more details.
15
 
 
16
 
    You should have received a copy of the GNU General Public License along
17
 
    with this program; if not, write to the Free Software Foundation, Inc.,
18
 
    51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
 
 
20
 
    contact: plee-the-bear@gamned.org
21
 
 
22
 
    Please add the tag [Bear] in the subject of your mails.
23
 
*/
24
 
/**
25
 
 * \file bf/history/action_set_item_field.hpp
26
 
 * \brief The action of changing the value of a field of an item.
27
 
 * \author S�bastien Angibaud
28
 
 */
29
 
#ifndef __BF_ACTION_SET_ITEM_FIELD_HPP__
30
 
#define __BF_ACTION_SET_ITEM_FIELD_HPP__
31
 
 
32
 
#include "bf/history/model_action.hpp"
33
 
#include <string>
34
 
 
35
 
namespace bf
36
 
{
37
 
  class item_instance;
38
 
 
39
 
  /**
40
 
   * \brief The action of changing the value of a field of an item.
41
 
   * \author S�bastien Angibaud
42
 
   */
43
 
  template<typename ValueType>
44
 
  class action_set_item_field:
45
 
    public model_action
46
 
  {
47
 
  public:
48
 
    /**
49
 
     * \brief Constructor. Remove the value of a field.
50
 
     * \param item The item to modify.
51
 
     * \param name The name of the field to change.
52
 
     */
53
 
    action_set_item_field( item_instance* item, const std::string& name );
54
 
 
55
 
    /**
56
 
     * \brief Constructor. Give a new value to a field.
57
 
     * \param item The item to modify.
58
 
     * \param name The name of the field to change.
59
 
     * \param val The new value of the field.
60
 
     */
61
 
    action_set_item_field
62
 
    ( item_instance* item, const std::string& name, const ValueType& val );
63
 
 
64
 
    /**
65
 
     * \remark Calling execute() two times will restore the initial value.
66
 
     */
67
 
    void execute( gui_model& mdl );
68
 
    void undo( gui_model& mdl );
69
 
 
70
 
    bool is_identity( const gui_model& gui ) const;
71
 
    wxString get_description() const;
72
 
 
73
 
  private:
74
 
    /** \brief The item to modify. */
75
 
    item_instance* const m_item;
76
 
 
77
 
    /** \brief The name of the field to set. */
78
 
    const std::string m_name;
79
 
 
80
 
    /** \brief The new value of the field. */
81
 
    ValueType m_value;
82
 
 
83
 
    /** \brief Tell if a value has been given to m_value. */
84
 
    bool m_has_value;
85
 
 
86
 
  }; // class action_set_item_field
87
 
} // namespace bf
88
 
 
89
 
#include "bf/history/impl/action_set_item_field.tpp"
90
 
 
91
 
#endif // __BF_ACTION_SET_ITEM_FIELD_HPP__