World of Might and Magic  0.2.0
Open reimplementation of Might and Magic 6 7 8 game engine
bprint.h
См. документацию.
1 /*
2  * Copyright (c) 2012 Nicolas George
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_BPRINT_H
22 #define AVUTIL_BPRINT_H
23 
24 #include <stdarg.h>
25 
26 #include "attributes.h"
27 #include "avstring.h"
28 
34 #define FF_PAD_STRUCTURE(name, size, ...) \
35 struct ff_pad_helper_##name { __VA_ARGS__ }; \
36 typedef struct name { \
37  __VA_ARGS__ \
38  char reserved_padding[size - sizeof(struct ff_pad_helper_##name)]; \
39 } name;
40 
82 FF_PAD_STRUCTURE(AVBPrint, 1024,
83  char *str;
84  unsigned len;
85  unsigned size;
86  unsigned size_max;
87  char reserved_internal_buffer[1];
88 )
89 
94 #define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1)
95 #define AV_BPRINT_SIZE_AUTOMATIC 1
96 #define AV_BPRINT_SIZE_COUNT_ONLY 0
97 
111 void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max);
112 
122 void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size);
123 
127 void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3);
128 
132 void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg);
133 
137 void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
138 
146 void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size);
147 
148 struct tm;
160 void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm);
161 
171 void av_bprint_get_buffer(AVBPrint *buf, unsigned size,
172  unsigned char **mem, unsigned *actual_size);
173 
177 void av_bprint_clear(AVBPrint *buf);
178 
185 static inline int av_bprint_is_complete(const AVBPrint *buf)
186 {
187  return buf->len < buf->size;
188 }
189 
201 int av_bprint_finalize(AVBPrint *buf, char **ret_str);
202 
216 void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars,
217  enum AVEscapeMode mode, int flags);
218 
219 #endif /* AVUTIL_BPRINT_H */
av_bprint_clear
void av_bprint_clear(AVBPrint *buf)
av_bprint_append_data
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
n
GLdouble n
Definition: SDL_opengl_glext.h:1955
av_bprint_chars
void av_bprint_chars(AVBPrint *buf, char c, unsigned n)
mode
EGLSyncKHR EGLenum mode
Definition: SDL_egl.h:1056
FF_PAD_STRUCTURE
FF_PAD_STRUCTURE(AVBPrint, 1024, char *str;unsigned len;unsigned size;unsigned size_max;char reserved_internal_buffer[1];) void av_bprint_init(AVBPrint *buf
av_bprintf
void av_bprintf(AVBPrint *buf, const char *fmt,...) av_printf_format(2
av_bprint_get_buffer
void av_bprint_get_buffer(AVBPrint *buf, unsigned size, unsigned char **mem, unsigned *actual_size)
buffer
EGLContext EGLenum EGLClientBuffer buffer
Definition: SDL_egl.h:952
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2929
buf
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: SDL_opengl_glext.h:2483
size_max
unsigned unsigned size_max
Definition: bprint.h:111
src
GLenum src
Definition: SDL_opengl_glext.h:1740
av_bprint_is_complete
static int av_bprint_is_complete(const AVBPrint *buf)
Definition: bprint.h:185
av_vbprintf
void void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg)
attributes.h
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
av_bprint_init_for_buffer
void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size)
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
av_bprint_escape
void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
flags
EGLSyncKHR EGLint flags
Definition: SDL_egl.h:898
size_init
unsigned size_init
Definition: bprint.h:111
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:540
av_bprint_strftime
void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm)
AVEscapeMode
AVEscapeMode
Definition: avstring.h:313
avstring.h