World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
avstring.h
См. документацию.
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 <stdint.h>
26 #include "attributes.h"
27 
42 int av_strstart(const char *str, const char *pfx, const char **ptr);
43 
54 int av_stristart(const char *str, const char *pfx, const char **ptr);
55 
68 char *av_stristr(const char *haystack, const char *needle);
69 
83 char *av_strnstr(const char *haystack, const char *needle, size_t hay_length);
84 
100 size_t av_strlcpy(char *dst, const char *src, size_t size);
101 
118 size_t av_strlcat(char *dst, const char *src, size_t size);
119 
132 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4);
133 
140 static inline size_t av_strnlen(const char *s, size_t len)
141 {
142  size_t i;
143  for (i = 0; i < len && s[i]; i++)
144  ;
145  return i;
146 }
147 
156 char *av_asprintf(const char *fmt, ...) av_printf_format(1, 2);
157 
161 char *av_d2str(double d);
162 
177 char *av_get_token(const char **buf, const char *term);
178 
201 char *av_strtok(char *s, const char *delim, char **saveptr);
202 
206 static inline av_const int av_isdigit(int c)
207 {
208  return c >= '0' && c <= '9';
209 }
210 
214 static inline av_const int av_isgraph(int c)
215 {
216  return c > 32 && c < 127;
217 }
218 
222 static inline av_const int av_isspace(int c)
223 {
224  return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' ||
225  c == '\v';
226 }
227 
231 static inline av_const int av_toupper(int c)
232 {
233  if (c >= 'a' && c <= 'z')
234  c ^= 0x20;
235  return c;
236 }
237 
241 static inline av_const int av_tolower(int c)
242 {
243  if (c >= 'A' && c <= 'Z')
244  c ^= 0x20;
245  return c;
246 }
247 
251 static inline av_const int av_isxdigit(int c)
252 {
253  c = av_tolower(c);
254  return av_isdigit(c) || (c >= 'a' && c <= 'f');
255 }
256 
261 int av_strcasecmp(const char *a, const char *b);
262 
267 int av_strncasecmp(const char *a, const char *b, size_t n);
268 
273 char *av_strireplace(const char *str, const char *from, const char *to);
274 
280 const char *av_basename(const char *path);
281 
288 const char *av_dirname(char *path);
289 
301 int av_match_name(const char *name, const char *names);
302 
311 char *av_append_path_component(const char *path, const char *component);
312 
317 };
318 
327 #define AV_ESCAPE_FLAG_WHITESPACE (1 << 0)
328 
334 #define AV_ESCAPE_FLAG_STRICT (1 << 1)
335 
352 av_warn_unused_result
353 int av_escape(char **dst, const char *src, const char *special_chars,
354  enum AVEscapeMode mode, int flags);
355 
356 #define AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES 1
357 #define AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS 2
358 #define AV_UTF8_FLAG_ACCEPT_SURROGATES 4
359 #define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES 8
360 
361 #define AV_UTF8_FLAG_ACCEPT_ALL \
362  AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES|AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS|AV_UTF8_FLAG_ACCEPT_SURROGATES
363 
392 av_warn_unused_result
393 int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
394  unsigned int flags);
395 
401 int av_match_list(const char *name, const char *list, char separator);
402 
407 int av_sscanf(const char *string, const char *format, ...);
408 
413 #endif /* AVUTIL_AVSTRING_H */
av_utf8_decode
av_warn_unused_result int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, unsigned int flags)
av_isxdigit
static av_const int av_isxdigit(int c)
Definition: avstring.h:251
s
GLdouble s
Definition: SDL_opengl.h:2063
n
GLdouble n
Definition: SDL_opengl_glext.h:1955
av_get_token
char * av_get_token(const char **buf, const char *term)
av_stristr
char * av_stristr(const char *haystack, const char *needle)
av_strcasecmp
int av_strcasecmp(const char *a, const char *b)
av_isspace
static av_const int av_isspace(int c)
Definition: avstring.h:222
mode
EGLSyncKHR EGLenum mode
Definition: SDL_egl.h:1056
av_d2str
char char * av_d2str(double d)
av_basename
const char * av_basename(const char *path)
av_append_path_component
char * av_append_path_component(const char *path, const char *component)
av_escape
av_warn_unused_result int av_escape(char **dst, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
path
GLsizei const GLchar *const * path
Definition: SDL_opengl_glext.h:3733
av_dirname
const char * av_dirname(char *path)
format
SDL_AudioFormat format
Definition: SDL_audio.h:194
av_strtok
char * av_strtok(char *s, const char *delim, char **saveptr)
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2929
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: SDL_opengl_glext.h:2483
av_stristart
int av_stristart(const char *str, const char *pfx, const char **ptr)
av_sscanf
int av_sscanf(const char *string, const char *format,...)
AV_ESCAPE_MODE_QUOTE
@ AV_ESCAPE_MODE_QUOTE
Use single-quote escaping.
Definition: avstring.h:316
av_match_list
int av_match_list(const char *name, const char *list, char separator)
src
GLenum src
Definition: SDL_opengl_glext.h:1740
av_strireplace
char * av_strireplace(const char *str, const char *from, const char *to)
av_strnlen
size_t static size_t av_strnlen(const char *s, size_t len)
Definition: avstring.h:140
AV_ESCAPE_MODE_AUTO
@ AV_ESCAPE_MODE_AUTO
Use auto-selected escaping mode.
Definition: avstring.h:314
int32_t
signed __int32 int32_t
Definition: SDL_config.h:38
av_strncasecmp
int av_strncasecmp(const char *a, const char *b, size_t n)
names
GLuint GLuint * names
Definition: SDL_opengl_glext.h:4959
dst
GLenum GLenum dst
Definition: SDL_opengl_glext.h:1740
av_isgraph
static av_const int av_isgraph(int c)
Definition: avstring.h:214
av_isdigit
static av_const int av_isdigit(int c)
Definition: avstring.h:206
attributes.h
av_strstart
int av_strstart(const char *str, const char *pfx, const char **ptr)
av_strlcatf
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...) av_printf_format(3
uint8_t
unsigned __int8 uint8_t
Definition: SDL_config.h:35
av_toupper
static av_const int av_toupper(int c)
Definition: avstring.h:231
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
name
EGLImageKHR EGLint * name
Definition: SDL_egl.h:1497
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
av_strlcat
size_t av_strlcat(char *dst, const char *src, size_t size)
av_strnstr
char * av_strnstr(const char *haystack, const char *needle, size_t hay_length)
av_asprintf
char * av_asprintf(const char *fmt,...) av_printf_format(1
flags
EGLSyncKHR EGLint flags
Definition: SDL_egl.h:898
av_match_name
int av_match_name(const char *name, const char *names)
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:540
AV_ESCAPE_MODE_BACKSLASH
@ AV_ESCAPE_MODE_BACKSLASH
Use backslash escaping.
Definition: avstring.h:315
av_strlcpy
size_t av_strlcpy(char *dst, const char *src, size_t size)
AVEscapeMode
AVEscapeMode
Definition: avstring.h:313
av_tolower
static av_const int av_tolower(int c)
Definition: avstring.h:241