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 {
23 const unsigned int VALIDATE_MATCH_CASELESS = 0x0001; //use when you want to
24 // make caseless match
25 const unsigned int VALIDATE_MATCH_FULL = 0x0002; //use when you want
29 const std::string LOWER_P = "p";
30 const std::string UPPER_P = "P";
33 * Validates value against pattern
34 * @param pattern Regexp pattern
35 * @param value String to validate
36 * @param options Modifiers for a match.
37 * @return True when value is matched against pattern
39 bool validate(const std::string &pattern,
40 const std::string &value,
41 unsigned int options = 0);
44 * Filter value against pattern(Any character except "0-9+#*Pp" will be removed
46 * @param pattern Regexp pattern
47 * @param value String to be filtered
48 * @return filtered value
50 std::string filter(const std::string &pattern,
51 const std::string &value);
54 * Replace character "p" in value by "P"
55 * @param value String to be replaced
56 * @return replaced value
58 std::string toUpper(const std::string &value);
60 } // WrtDeviceApisCommon
62 #endif // WRTDEVICEAPIS_COMMONS_REGEX_H_