BlacklistTextFieldModel.hpp
1 /*
2  * Copyright © 2013 mathdu07
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 3 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
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef BLACKLISTTEXTFIELDMODEL_H_
19 #define BLACKLISTTEXTFIELDMODEL_H_
20 
21 #include <SFML/UI/Model/TextFieldModel.hpp>
22 #include <set>
23 #include <vector>
24 
25 namespace sf
26 {
27 namespace ui
28 {
29 
31 {
32  //CONSTRUCTORS/DESTRUCTORS -------------------------------------------
33 public:
41 
42  virtual ~BlacklistTextFieldModel();
43  //--------------------------------------------------------------------
44 
45  //METHODS ------------------------------------------------------------
53  virtual bool isCharAllowed(sf::Uint32 c) const;
54 
62  void addCharDenied(sf::Uint32 c);
63 
71  void rmCharDenied(sf::Uint32 c);
72  //--------------------------------------------------------------------
73 
74  //GETTERS/SETTERS ----------------------------------------------------
75 public:
81  std::vector<sf::Uint32> getCharsDenied() const;
82  //--------------------------------------------------------------------
83 
84  //FIELDS -------------------------------------------------------------
85 protected:
86  std::set<sf::Uint32> m_blacklist;
87  //--------------------------------------------------------------------
88 };
89 
90 } /* namespace ui */
91 } /* namespace sf */
92 #endif /* BLACKLISTTEXTFIELDMODEL_H_ */
93 
BlacklistTextFieldModel()
Creates a text field model that denies character present in the blacklist Notice that the blacklist i...
A textfield model that denies some chars.
virtual bool isCharAllowed(sf::Uint32 c) const
void addCharDenied(sf::Uint32 c)
Add a character to the blacklist.
std::vector< sf::Uint32 > getCharsDenied() const
void rmCharDenied(sf::Uint32 c)
Removes a character to the blacklist.
The abstract class that defines what can be typed into the text field.