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 */
int size
int av_isxdigit(int c)
Locale-independent conversion of ASCII isxdigit.
Definition: avstring.c:231
char * av_stristr(const char *haystack, const char *needle)
Locate the first case-independent occurrence in the string haystack of the string needle...
Definition: avstring.c:54
int av_strncasecmp(const char *a, const char *b, size_t n)
Locale-independent case-insensitive compare.
Definition: avstring.c:166
int av_isdigit(int c)
Locale-independent conversion of ASCII isdigit.
Definition: avstring.c:215
Macro definitions for various function/variable attributes.
int av_stristart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str independent of case.
Definition: avstring.c:43
const char * av_basename(const char *path)
Thread safe basename.
Definition: avstring.c:177
#define b
Definition: input.c:52
static int av_tolower(int c)
Locale-independent conversion of ASCII characters to lowercase.
Definition: avstring.h:182
int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
Definition: avstring.c:225
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition: avstring.c:81
char * av_get_token(const char **buf, const char *term)
Unescape the given string until a non escaped terminating char, and return the token corresponding to...
Definition: avstring.c:121
#define av_printf_format(fmtpos, attrpos)
Definition: attributes.h:117
int av_strcasecmp(const char *a, const char *b)
Definition: avstring.c:156
AVFifoBuffer ** buf
single buffer for interleaved, per-channel buffers for planar
Definition: audio_fifo.c:35
size_t char * av_d2str(double d)
Convert a number to a av_malloced string.
Definition: avstring.c:111
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
Definition: avstring.c:91
static int av_toupper(int c)
Locale-independent conversion of ASCII characters to uppercase.
Definition: avstring.h:172
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
Definition: avstring.c:32
int av_isgraph(int c)
Locale-independent conversion of ASCII isgraph.
Definition: avstring.c:220
char * av_strnstr(const char *haystack, const char *needle, size_t hay_length)
Locate the first occurrence of the string needle in the string haystack where not more than hay_lengt...
Definition: avstring.c:67
const char * av_dirname(char *path)
Thread safe dirname.
Definition: avstring.c:194
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...) av_printf_format(3
Append output to a string, according to a format.