libavutil/avstring.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2007 Mans Rullgard
00003  *
00004  * This file is part of Libav.
00005  *
00006  * Libav is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * Libav is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with Libav; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #ifndef AVUTIL_AVSTRING_H
00022 #define AVUTIL_AVSTRING_H
00023 
00024 #include <stddef.h>
00025 #include "attributes.h"
00026 
00041 int av_strstart(const char *str, const char *pfx, const char **ptr);
00042 
00053 int av_stristart(const char *str, const char *pfx, const char **ptr);
00054 
00067 char *av_stristr(const char *haystack, const char *needle);
00068 
00084 size_t av_strlcpy(char *dst, const char *src, size_t size);
00085 
00102 size_t av_strlcat(char *dst, const char *src, size_t size);
00103 
00116 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
00117 
00121 char *av_d2str(double d);
00122 
00137 char *av_get_token(const char **buf, const char *term);
00138 
00142 static inline int av_toupper(int c)
00143 {
00144     if (c >= 'a' && c <= 'z')
00145         c ^= 0x20;
00146     return c;
00147 }
00148 
00152 static inline int av_tolower(int c)
00153 {
00154     if (c >= 'A' && c <= 'Z')
00155         c ^= 0x20;
00156     return c;
00157 }
00158 
00159 /*
00160  * Locale-independent case-insensitive compare.
00161  * @note This means only ASCII-range characters are case-insensitive
00162  */
00163 int av_strcasecmp(const char *a, const char *b);
00164 
00169 int av_strncasecmp(const char *a, const char *b, size_t n);
00170 
00175 #endif /* AVUTIL_AVSTRING_H */