Merge "Add ApplyCustomFragmentPrefix" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / input-filter.h
1 #ifndef DALI_INPUT_FILTER_H
2 #define DALI_INPUT_FILTER_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/property-map.h>
23
24 // INTERNAL INCLUDES
25 #include <dali-toolkit/public-api/controls/text-controls/input-filter-properties.h>
26 #include <regex>
27
28 namespace Dali
29 {
30 namespace Toolkit
31 {
32 namespace Text
33 {
34 /**
35  * Class to handle the input text filtering
36  */
37 class InputFilter : public ConnectionTracker
38 {
39 public:
40   /**
41    * @brief Constructor
42    */
43   InputFilter();
44
45 public: // Intended for internal use
46   /**
47    * @brief Used to set options of input filter.
48    * @param[in] map The property map describing the option.
49    */
50   void SetProperties(const Property::Map& map);
51
52   /**
53    * @brief Retrieve property map of input filter options.
54    * @param[out] map The input filter option.
55    */
56   void GetProperties(Property::Map& map);
57
58   /**
59    * @brief Check if the source is contained in regex.
60    * @param[in] type ACCEPTED or REJECTED
61    * @param[in] source The original text.
62    * @return @e true if the source is contained in regex, otherwise returns @e false.
63    */
64   bool Contains(Toolkit::InputFilter::Property::Type type, std::string source);
65
66 private:
67   std::string mAccepted;
68   std::string mRejected;
69 };
70
71 } // namespace Text
72
73 } // namespace Toolkit
74
75 } // namespace Dali
76
77 #endif // DALI_INPUT_FILTER_H