xml.h 2.96 KB
Newer Older
1
2
/* tarot implements the rules of the tarot game
 * Copyright (C) 2018, 2019  Vivien Kraus
Vivien Kraus's avatar
Vivien Kraus committed
3
 *
4
5
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation, version 3 of the License.
Vivien Kraus's avatar
Vivien Kraus committed
7
8
9
10
11
12
13
 *
 * This program 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Vivien Kraus's avatar
Vivien Kraus committed
15
16
17
18
19
 */

#ifndef H_TAROT_XML_INCLUDED
#define H_TAROT_XML_INCLUDED

20
#include <stddef.h>
Vivien Kraus's avatar
Vivien Kraus committed
21
22
23
24
25
26
27

#ifdef __cplusplus
extern "C"
{
#endif                          /* __cplusplus */

  struct TarotXmlParser;
28

Vivien Kraus's avatar
Vivien Kraus committed
29
30
  typedef struct TarotXmlParser TarotXmlParser;

31
32
  struct TarotGameEvent;

Vivien Kraus's avatar
Vivien Kraus committed
33
  struct TarotGame;
34
35

  struct TarotMcts;
Vivien Kraus's avatar
Vivien Kraus committed
36
37
38

  /**
   * tarot_xml_parser_construct:
39
   * @mem_out: (array length=max_mem):
Vivien Kraus's avatar
Vivien Kraus committed
40
41
   * @alignment: (out):
   */
42
  size_t tarot_xml_parser_construct (size_t max_mem, char *mem_out,
Vivien Kraus's avatar
Vivien Kraus committed
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
                                     size_t *alignment, const char *input);
  void tarot_xml_parser_destruct (TarotXmlParser * parser);

  /**
   * tarot_xml_parser_alloc: (constructor)
   */
  TarotXmlParser *tarot_xml_parser_alloc (const char *input);
  TarotXmlParser *tarot_xml_parser_dup (const TarotXmlParser * source);
  void tarot_xml_parser_free (TarotXmlParser * xml_parser);

  struct TarotXmlParserIterator;
  typedef struct TarotXmlParserIterator TarotXmlParserIterator;

  /**
   * tarot_xml_parser_iterator_construct:
58
   * @mem_out: (array length=max_mem):
Vivien Kraus's avatar
Vivien Kraus committed
59
60
   * @alignment: (out):
   */
61
  size_t tarot_xml_parser_iterator_construct (size_t max_mem, char *mem_out,
Vivien Kraus's avatar
Vivien Kraus committed
62
63
64
65
                                              size_t *alignment,
                                              const TarotXmlParser * parser);
  void tarot_xml_parser_iterator_destruct (TarotXmlParserIterator * parser);

66
  const struct TarotGameEvent *tarot_xml_parser_iterator_next_value
Vivien Kraus's avatar
Vivien Kraus committed
67
    (TarotXmlParserIterator * iterator);
Vivien Kraus's avatar
Vivien Kraus committed
68
69
70
71
72

  /**
   * tarot_xml_save:
   * @game: (type TarotGame):
   */
Vivien Kraus's avatar
Vivien Kraus committed
73
74
  size_t tarot_xml_save (const struct TarotGame *game, size_t start,
                         size_t max, char *dest);
Vivien Kraus's avatar
Vivien Kraus committed
75
76

  TarotXmlParserIterator *tarot_xml_parser_iterator
Vivien Kraus's avatar
Vivien Kraus committed
77
    (const TarotXmlParser * parser);
Vivien Kraus's avatar
Vivien Kraus committed
78
  TarotXmlParserIterator *tarot_xml_parser_iterator_dup
Vivien Kraus's avatar
Vivien Kraus committed
79
    (const TarotXmlParserIterator * source);
Vivien Kraus's avatar
Vivien Kraus committed
80
81
82
83
  void tarot_xml_parser_iterator_free (TarotXmlParserIterator * xml_parser);

  /**
   * tarot_xml_save_mcts_tree:
Vivien Kraus's avatar
Vivien Kraus committed
84
   * @mcts: (type TarotMcts):
85
   * @dest_out: (array length=max):
Vivien Kraus's avatar
Vivien Kraus committed
86
   */
Vivien Kraus's avatar
Vivien Kraus committed
87
  size_t tarot_xml_save_mcts_tree (const struct TarotMcts *mcts, size_t start,
88
                                   size_t max, char *dest_out);
Vivien Kraus's avatar
Vivien Kraus committed
89
90
91
92
93
94

#ifdef __cplusplus
}
#endif                          /* __cplusplus */

#endif                          /* not H_TAROT_XML_INCLUDED */