2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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.
16 #ifndef WRTDEVICEAPIS_COMMONS_REGEX_H_
17 #define WRTDEVICEAPIS_COMMONS_REGEX_H_
21 namespace WrtDeviceApis {
24 const unsigned int VALIDATE_MATCH_CASELESS = 0x0001; //use when you want to make caseless match
25 const unsigned int VALIDATE_MATCH_FULL = 0x0002; //use when you want supplied text matches a supplied pattern exactly
26 const std::string LOWER_P = "p";
27 const std::string UPPER_P = "P";
30 * Validates value against pattern
31 * @param pattern Regexp pattern
32 * @param value String to validate
33 * @param options Modifiers for a match.
34 * @return True when value is matched against pattern
36 bool validate(const std::string &pattern,
37 const std::string &value,
38 unsigned int options = 0);
41 * Filter value against pattern(Any character except "0-9+#*Pp" will be removed from value)
42 * @param pattern Regexp pattern
43 * @param value String to be filtered
44 * @return filtered value
46 std::string filter(const std::string &pattern,
47 const std::string &value);
50 * Replace character "p" in value by "P"
51 * @param value String to be replaced
52 * @return replaced value
54 std::string toUpper(const std::string &value);
57 } // WrtDeviceApisCommon
59 #endif // WRTDEVICEAPIS_COMMONS_REGEX_H_