File: parser.h

package info (click to toggle)
libmirage 3.2.10-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,540 kB
  • sloc: ansic: 25,454; xml: 108; makefile: 11
file content (111 lines) | stat: -rw-r--r-- 3,881 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 *  libMirage: parser
 *  Copyright (C) 2008-2014 Rok Mandeljc
 *
 *  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
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  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 along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifndef __MIRAGE_PARSER_H__
#define __MIRAGE_PARSER_H__

#include <mirage/types.h>


G_BEGIN_DECLS


/**
 * MirageParserInfo:
 * @id: parser ID
 * @name: parser name
 * @description: (array zero-terminated=1): zero-terminated array of file type description strings
 * @mime_type: (array zero-terminated=1): zero-terminated array of file type MIME strings
 *
 * A structure containing parser information. It can be obtained with call to
 * mirage_parser_get_info().
 */
typedef struct _MirageParserInfo MirageParserInfo;
struct _MirageParserInfo
{
    gchar *id;
    gchar *name;
    gchar **description;
    gchar **mime_type;
};

void mirage_parser_info_copy (const MirageParserInfo *info, MirageParserInfo *dest);
void mirage_parser_info_free (MirageParserInfo *info);


/**********************************************************************\
 *                         MirageParser object                        *
\**********************************************************************/
#define MIRAGE_TYPE_PARSER            (mirage_parser_get_type())
#define MIRAGE_PARSER(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), MIRAGE_TYPE_PARSER, MirageParser))
#define MIRAGE_PARSER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), MIRAGE_TYPE_PARSER, MirageParserClass))
#define MIRAGE_IS_PARSER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), MIRAGE_TYPE_PARSER))
#define MIRAGE_IS_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), MIRAGE_TYPE_PARSER))
#define MIRAGE_PARSER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), MIRAGE_TYPE_PARSER, MirageParserClass))

typedef struct _MirageParser           MirageParser;
typedef struct _MirageParserClass      MirageParserClass;
typedef struct _MirageParserPrivate    MirageParserPrivate;

/**
 * MirageParser:
 *
 * All the fields in the <structname>MirageParser</structname>
 * structure are private to the #MirageParser implementation and
 * should never be accessed directly.
 */
struct _MirageParser
{
    MirageObject parent_instance;

    /*< private >*/
    MirageParserPrivate *priv;
} ;

/**
 * MirageParserClass:
 * @parent_class: the parent class
 * @load_image: loads image
 *
 * The class structure for the <structname>MirageParser</structname> type.
 */
struct _MirageParserClass
{
    MirageObjectClass parent_class;

    /* Class members */
    MirageDisc *(*load_image) (MirageParser *self, MirageStream **streams, GError **error);
};

/* Used by MIRAGE_TYPE_PARSER */
GType mirage_parser_get_type (void);

void mirage_parser_generate_info (MirageParser *self, const gchar *id, const gchar *name, gint num_types, ...);
const MirageParserInfo *mirage_parser_get_info (MirageParser *self);

MirageDisc *mirage_parser_load_image (MirageParser *self, MirageStream **streams, GError **error);

gint mirage_parser_guess_medium_type (MirageParser *self, MirageDisc *disc);
void mirage_parser_add_redbook_pregap (MirageParser *self, MirageDisc *disc);

GDataInputStream *mirage_parser_create_text_stream (MirageParser *self, MirageStream *stream, GError **error);

G_END_DECLS

#endif /* __MIRAGE_PARSER_H__ */