src/server/ucx/properties.h

Mon, 09 Sep 2013 11:55:14 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Mon, 09 Sep 2013 11:55:14 +0200
changeset 92
382bff43c6eb
parent 88
73b3485e96f1
permissions
-rw-r--r--

fixed some includes

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

mercurial