• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  * Description: 系统适配层字符串接口(此文件为DEMO,需集成方适配修改)
15  */
16 #ifndef HILINK_STR_ADAPTER_H
17 #define HILINK_STR_ADAPTER_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 /*
24  * 描述: 用于计算字符串的长度
25  * 参数: src,待计算长度的字符串
26  * 返回: 字符串长度
27  */
28 unsigned int HILINK_Strlen(const char *src);
29 
30 /*
31  * 描述: 用于在字符串str中查找字符ch
32  * 参数: str,待查找字符串
33  *       ch,待查找字符
34  * 返回: NULL没有查找到字符,非NULL指向ch的指针
35  */
36 char *HILINK_Strchr(const char *str, int ch);
37 
38 /*
39  * 描述: 在字符串str中逆向查找字符ch
40  * 参数: str,字符串
41  *       c,待查找字符
42  * 返回: NULL没有查找到字符,非NULL指向ch的指针
43  */
44 char *HILINK_Strrchr(const char *str, int ch);
45 
46 /*
47  * 描述: 把字符串转换成int整形数字
48  * 参数: str,传入需要转换成 int 类型字符串
49  * 返回: 字符串转换成的int整形数字
50  */
51 int HILINK_Atoi(const char *str);
52 
53 /*
54  * 描述: 在str1中查找是否存在str2
55  * 参数: str1,被查找目标
56  *       str2,要查找对象
57  * 返回: NULL不存在,非NULLstr2在str1中首次出现位置的指针
58  */
59 char *HILINK_Strstr(const char *str1, const char *str2);
60 
61 /*
62  * 描述: 比较两个字符串str1和str2
63  * 参数: str1,目标字符串1
64  *       str2,目标字符串2
65  * 返回: 0成功,小于0表示str1小于str2, 大于0表示str1大于str2
66  */
67 int HILINK_Strcmp(const char *str1, const char *str2);
68 
69 /*
70  * 描述: 比较两个字符串str1和str2
71  * 参数: str1,目标字符串1
72  *       str2,目标字符串2
73  *       len,比较的长度
74  * 返回: 0成功,小于0表示str1小于str2, 大于0表示str1大于str2
75  */
76 int HILINK_Strncmp(const char *str1, const char *str2, unsigned int len);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* HILINK_STR_ADAPTER_H */
83