Libav
avstring.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Mans Rullgard
3  *
4  * This file is part of Libav.
5  *
6  * Libav is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * Libav is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with Libav; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVUTIL_AVSTRING_H
22 #define AVUTIL_AVSTRING_H
23 
24 #include <stddef.h>
25 #include "attributes.h"
26 
41 int av_strstart(const char *str, const char *pfx, const char **ptr);
42 
53 int av_stristart(const char *str, const char *pfx, const char **ptr);
54 
67 char *av_stristr(const char *haystack, const char *needle);
68 
82 char *av_strnstr(const char *haystack, const char *needle, size_t hay_length);
83 
99 size_t av_strlcpy(char *dst, const char *src, size_t size);
100 
117 size_t av_strlcat(char *dst, const char *src, size_t size);
118 
131 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
132 
136 char *av_d2str(double d);
137 
152 char *av_get_token(const char **buf, const char *term);
153 
157 int av_isdigit(int c);
158 
162 int av_isgraph(int c);
163 
167 int av_isspace(int c);
168 
172 static inline int av_toupper(int c)
173 {
174  if (c >= 'a' && c <= 'z')
175  c ^= 0x20;
176  return c;
177 }
178 
182 static inline int av_tolower(int c)
183 {
184  if (c >= 'A' && c <= 'Z')
185  c ^= 0x20;
186  return c;
187 }
188 
192 int av_isxdigit(int c);
193 
194 /*
195  * Locale-independent case-insensitive compare.
196  * @note This means only ASCII-range characters are case-insensitive
197  */
198 int av_strcasecmp(const char *a, const char *b);
199 
204 int av_strncasecmp(const char *a, const char *b, size_t n);
205 
206 
212 const char *av_basename(const char *path);
213 
220 const char *av_dirname(char *path);
221 
226 #endif /* AVUTIL_AVSTRING_H */