ucx/properties.h

Fri, 12 Jul 2013 20:50:18 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Fri, 12 Jul 2013 20:50:18 +0200
changeset 108
d2b1e67b2b48
child 109
75cb6590358b
permissions
-rw-r--r--

new properties parser

olaf@108 1 /*
olaf@108 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
olaf@108 3 *
olaf@108 4 * Copyright 2013 Olaf Wintermann. All rights reserved.
olaf@108 5 *
olaf@108 6 * Redistribution and use in source and binary forms, with or without
olaf@108 7 * modification, are permitted provided that the following conditions are met:
olaf@108 8 *
olaf@108 9 * 1. Redistributions of source code must retain the above copyright
olaf@108 10 * notice, this list of conditions and the following disclaimer.
olaf@108 11 *
olaf@108 12 * 2. Redistributions in binary form must reproduce the above copyright
olaf@108 13 * notice, this list of conditions and the following disclaimer in the
olaf@108 14 * documentation and/or other materials provided with the distribution.
olaf@108 15 *
olaf@108 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
olaf@108 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
olaf@108 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
olaf@108 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
olaf@108 20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
olaf@108 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
olaf@108 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
olaf@108 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
olaf@108 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
olaf@108 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
olaf@108 26 * POSSIBILITY OF SUCH DAMAGE.
olaf@108 27 */
olaf@108 28
olaf@108 29 #ifndef PROPERTIES_H
olaf@108 30 #define PROPERTIES_H
olaf@108 31
olaf@108 32 #include "ucx.h"
olaf@108 33 #include "map.h"
olaf@108 34
olaf@108 35 #ifdef __cplusplus
olaf@108 36 extern "C" {
olaf@108 37 #endif
olaf@108 38
olaf@108 39 typedef struct {
olaf@108 40 char *buffer;
olaf@108 41 size_t buflen;
olaf@108 42 size_t pos;
olaf@108 43 char *tmp;
olaf@108 44 size_t tmplen;
olaf@108 45 size_t tmpcap;
olaf@108 46 char delimiter;
olaf@108 47 char comment1;
olaf@108 48 char comment2;
olaf@108 49 char comment3;
olaf@108 50 } UcxPropParser;
olaf@108 51
olaf@108 52
olaf@108 53 UcxPropParser *ucx_prop_new();
olaf@108 54 void ucx_prop_free(UcxPropParser *parser);
olaf@108 55 void ucx_prop_fill(UcxPropParser *parser, char *buf, size_t len);
olaf@108 56 int ucx_prop_parse(UcxPropParser *parser, sstr_t *name, sstr_t *value);
olaf@108 57
olaf@108 58 #ifdef __cplusplus
olaf@108 59 }
olaf@108 60 #endif
olaf@108 61
olaf@108 62 #endif /* PROPERTIES_H */
olaf@108 63

mercurial