]> git.lizzy.rs Git - dragonfireclient.git/blob - src/util/coloredstring.h
Colored chat working as expected for both freetype and non-freetype builds. @nerzhul...
[dragonfireclient.git] / src / util / coloredstring.h
1 /*
2 Copyright (C) 2013 xyz, Ilya Zhuravlev <whatever@xyz.is>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published by
6 the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18
19 #ifndef COLOREDSTRING_HEADER
20 #define COLOREDSTRING_HEADER
21
22 #include <string>
23 #include <vector>
24 #include <SColor.h>
25
26 using namespace irr::video;
27
28 class ColoredString {
29 public:
30         ColoredString();
31         ColoredString(const std::wstring &s);
32         ColoredString(const std::wstring &string, const std::vector<SColor> &colors);
33         void operator=(const wchar_t *str);
34         size_t size() const;
35         ColoredString substr(size_t pos = 0, size_t len = std::string::npos) const;
36         const wchar_t *c_str() const;
37         const std::vector<SColor> &getColors() const;
38         const std::wstring &getString() const;
39 private:
40         std::wstring m_string;
41         std::vector<SColor> m_colors;
42 };
43
44 #endif