1 | // Aseprite |
---|---|
2 | // Copyright (C) 2020 Igara Studio S.A. |
3 | // Copyright (C) 2001-2015 David Capello |
4 | // |
5 | // This program is distributed under the terms of |
6 | // the End-User License Agreement for Aseprite. |
7 | |
8 | #ifndef APP_CMD_SET_USER_DATA_H_INCLUDED |
9 | #define APP_CMD_SET_USER_DATA_H_INCLUDED |
10 | #pragma once |
11 | |
12 | #include "app/cmd.h" |
13 | #include "app/cmd/with_document.h" |
14 | #include "doc/object_id.h" |
15 | #include "doc/user_data.h" |
16 | |
17 | namespace doc { |
18 | class WithUserData; |
19 | } |
20 | |
21 | namespace app { |
22 | namespace cmd { |
23 | |
24 | class SetUserData : public Cmd |
25 | , public WithDocument |
26 | { |
27 | public: |
28 | SetUserData(doc::WithUserData* obj, const doc::UserData& userData, |
29 | app::Doc* doc); |
30 | |
31 | protected: |
32 | void onExecute() override; |
33 | void onUndo() override; |
34 | void onFireNotifications() override; |
35 | size_t onMemSize() const override { |
36 | return sizeof(*this) + |
37 | m_oldUserData.size() + |
38 | m_newUserData.size(); |
39 | } |
40 | |
41 | private: |
42 | doc::ObjectId m_objId; |
43 | doc::UserData m_oldUserData; |
44 | doc::UserData m_newUserData; |
45 | }; |
46 | |
47 | } // namespace cmd |
48 | } // namespace app |
49 | |
50 | #endif |
51 |