stream.h 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * Copyright 2007 Jacek Caban for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#ifndef HHCTRL_STREAM_H
#define HHCTRL_STREAM_H

22 23 24
#define BLOCK_BITS 12
#define BLOCK_SIZE (1 << BLOCK_BITS)
#define BLOCK_MASK (BLOCK_SIZE-1)
25 26 27 28 29 30 31 32 33 34 35 36 37 38

typedef struct {
    char *buf;
    int size;
    int len;
} strbuf_t;

typedef struct {
    IStream *str;
    char buf[BLOCK_SIZE];
    ULONG size;
    ULONG p;
} stream_t;

39 40 41 42 43 44 45 46
void strbuf_init(strbuf_t *buf) DECLSPEC_HIDDEN;
void strbuf_zero(strbuf_t *buf) DECLSPEC_HIDDEN;
void strbuf_free(strbuf_t *buf) DECLSPEC_HIDDEN;
void stream_init(stream_t *stream, IStream *str) DECLSPEC_HIDDEN;
void get_node_name(strbuf_t *node, strbuf_t *name) DECLSPEC_HIDDEN;
BOOL next_content(stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN;
BOOL next_node(stream_t *stream, strbuf_t *buf) DECLSPEC_HIDDEN;
const char *get_attr(const char *node, const char *name, int *len) DECLSPEC_HIDDEN;
47 48

#endif