2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali-toolkit/internal/text/hidden-text.h>
20 #include <dali-toolkit/internal/text/input-filter.h>
24 using namespace Dali::Toolkit;
32 const char* const PROPERTY_ACCEPTED = "accepted";
33 const char* const PROPERTY_REJECTED = "rejected";
35 InputFilter::InputFilter()
41 void InputFilter::SetProperties(const Property::Map& map)
43 const Property::Map::SizeType count = map.Count();
45 for(Property::Map::SizeType position = 0; position < count; ++position)
47 KeyValuePair keyValue = map.GetKeyValue(position);
48 Property::Key& key = keyValue.first;
49 Property::Value& value = keyValue.second;
51 if(key == Toolkit::InputFilter::Property::ACCEPTED || key == PROPERTY_ACCEPTED)
55 else if(key == Toolkit::InputFilter::Property::REJECTED || key == PROPERTY_REJECTED)
62 void InputFilter::GetProperties(Property::Map& map)
64 map[Toolkit::InputFilter::Property::ACCEPTED] = mAccepted.c_str();
65 map[Toolkit::InputFilter::Property::REJECTED] = mRejected.c_str();
68 bool InputFilter::Contains(Toolkit::InputFilter::Property::Type type, std::string source)
73 if(type == Toolkit::InputFilter::Property::ACCEPTED)
81 else if(type == Toolkit::InputFilter::Property::REJECTED)
90 match = std::regex_match(source, pattern);
97 } // namespace Toolkit