1 #ifndef DALI_INPUT_FILTER_H
2 #define DALI_INPUT_FILTER_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/property-map.h>
25 #include <dali-toolkit/public-api/controls/text-controls/input-filter-properties.h>
35 * Class to handle the input text filtering
37 class InputFilter : public ConnectionTracker
45 public: // Intended for internal use
47 * @brief Used to set options of input filter.
48 * @param[in] map The property map describing the option.
50 void SetProperties(const Property::Map& map);
53 * @brief Retrieve property map of input filter options.
54 * @param[out] map The input filter option.
56 void GetProperties(Property::Map& map);
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.
64 bool Contains(Toolkit::InputFilter::Property::Type type, std::string source);
67 * @brief Filtering the text using regex.
68 * @param[in] type ACCEPTED or REJECTED
69 * @param[in,out] text The string value to filter and write back.
70 * @return @e true if the text is filtered by the regex, otherwise returns @e false.
72 bool Filter(Toolkit::InputFilter::Property::Type type, std::string& text);
75 std::string mAccepted;
76 std::string mRejected;
81 } // namespace Toolkit
85 #endif // DALI_INPUT_FILTER_H