FFmpeg  1.2.12
avstring.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007 Mans Rullgard
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg 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  * FFmpeg 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 FFmpeg; 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 
141 char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
142 
146 char *av_d2str(double d);
147 
162 char *av_get_token(const char **buf, const char *term);
163 
186 char *av_strtok(char *s, const char *delim, char **saveptr);
187 
191 static inline int av_isdigit(int c)
192 {
193  return c >= '0' && c <= '9';
194 }
195 
199 static inline int av_isgraph(int c)
200 {
201  return c > 32 && c < 127;
202 }
203 
207 static inline int av_isspace(int c)
208 {
209  return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v';
210 }
211 
215 static inline int av_toupper(int c)
216 {
217  if (c >= 'a' && c <= 'z')
218  c ^= 0x20;
219  return c;
220 }
221 
225 static inline int av_tolower(int c)
226 {
227  if (c >= 'A' && c <= 'Z')
228  c ^= 0x20;
229  return c;
230 }
231 
235 static inline int av_isxdigit(int c)
236 {
237  c = av_tolower(c);
238  return av_isdigit(c) || (c >= 'a' && c <= 'z');
239 }
240 
245 int av_strcasecmp(const char *a, const char *b);
246 
251 int av_strncasecmp(const char *a, const char *b, size_t n);
252 
253 
259 const char *av_basename(const char *path);
260 
267 const char *av_dirname(char *path);
268 
273 };
274 
283 #define AV_ESCAPE_FLAG_WHITESPACE 0x01
284 
290 #define AV_ESCAPE_FLAG_STRICT 0x02
291 
308 int av_escape(char **dst, const char *src, const char *special_chars,
309  enum AVEscapeMode mode, int flags);
310 
315 #endif /* AVUTIL_AVSTRING_H */