1 // Aseprite Document Library
2 // Copyright (c) 2001-2015 David Capello
3 //
4 // This file is released under the terms of the MIT license.
5 // Read LICENSE.txt for more information.
6 
7 #ifndef DOC_USER_DATA_H_INCLUDED
8 #define DOC_USER_DATA_H_INCLUDED
9 #pragma once
10 
11 #include "doc/color.h"
12 
13 #include <string>
14 
15 namespace doc {
16 
17   class UserData {
18   public:
UserData()19     UserData() : m_color(0) {
20     }
21 
size()22     size_t size() const { return m_text.size(); }
isEmpty()23     bool isEmpty() const {
24       return m_text.empty() && !doc::rgba_geta(m_color);
25     }
26 
text()27     const std::string& text() const { return m_text; }
color()28     color_t color() const { return m_color; }
29 
setText(const std::string & text)30     void setText(const std::string& text) { m_text = text; }
setColor(color_t color)31     void setColor(color_t color) { m_color = color; }
32 
33     bool operator==(const UserData& other) const {
34       return (m_text == other.m_text &&
35               m_color == other.m_color);
36     }
37 
38     bool operator!=(const UserData& other) const {
39       return !operator==(other);
40     }
41 
42   private:
43     std::string m_text;
44     color_t m_color;
45   };
46 
47 } // namespace doc
48 
49 #endif
50