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 
84 size_t av_strlcpy(char *dst, const char *src, size_t size);
85 
102 size_t av_strlcat(char *dst, const char *src, size_t size);
103 
116 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
117 
121 char *av_d2str(double d);
122 
137 char *av_get_token(const char **buf, const char *term);
138 
142 static inline int av_toupper(int c)
143 {
144  if (c >= 'a' && c <= 'z')
145  c ^= 0x20;
146  return c;
147 }
148 
152 static inline int av_tolower(int c)
153 {
154  if (c >= 'A' && c <= 'Z')
155  c ^= 0x20;
156  return c;
157 }
158 
159 /*
160  * Locale-independent case-insensitive compare.
161  * @note This means only ASCII-range characters are case-insensitive
162  */
163 int av_strcasecmp(const char *a, const char *b);
164 
169 int av_strncasecmp(const char *a, const char *b, size_t n);
170 
175 #endif /* AVUTIL_AVSTRING_H */