1 /* GepubDoc
2  *
3  * Copyright (C) 2011  Daniel Garcia <danigm@wadobo.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  */
19 
20 #ifndef __GEPUB_DOC_H__
21 #define __GEPUB_DOC_H__
22 
23 #include <glib-object.h>
24 #include <glib.h>
25 
26 G_BEGIN_DECLS
27 
28 #define GEPUB_TYPE_DOC           (gepub_doc_get_type ())
29 #define GEPUB_DOC(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GEPUB_TYPE_DOC, GepubDoc))
30 #define GEPUB_DOC_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GEPUB_TYPE_DOC, GepubDocClass))
31 #define GEPUB_IS_DOC(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GEPUB_TYPE_DOC))
32 #define GEPUB_IS_DOC_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GEPUB_TYPE_DOC))
33 #define GEPUB_DOC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEPUB_TYPE_DOC, GepubDocClass))
34 
35 typedef struct _GepubDoc      GepubDoc;
36 typedef struct _GepubDocClass GepubDocClass;
37 
38 struct _GepubResource {
39     gchar *mime;
40     gchar *uri;
41 };
42 
43 typedef struct _GepubResource GepubResource;
44 
45 GType             gepub_doc_get_type                        (void) G_GNUC_CONST;
46 
47 GepubDoc         *gepub_doc_new                             (const gchar *path, GError **error);
48 GBytes           *gepub_doc_get_content                     (GepubDoc *doc);
49 gchar            *gepub_doc_get_metadata                    (GepubDoc *doc, const gchar *mdata);
50 GBytes           *gepub_doc_get_resource                    (GepubDoc *doc, const gchar *path);
51 GBytes           *gepub_doc_get_resource_by_id              (GepubDoc *doc, const gchar *id);
52 GHashTable       *gepub_doc_get_resources                   (GepubDoc *doc);
53 gchar            *gepub_doc_get_resource_mime               (GepubDoc *doc, const gchar *path);
54 gchar            *gepub_doc_get_resource_mime_by_id         (GepubDoc *doc, const gchar *id);
55 gchar            *gepub_doc_get_current_mime                (GepubDoc *doc);
56 GList            *gepub_doc_get_text                        (GepubDoc *doc);
57 GList            *gepub_doc_get_text_by_id                  (GepubDoc *doc, const gchar *id);
58 GBytes           *gepub_doc_get_current                     (GepubDoc *doc);
59 GBytes           *gepub_doc_get_current_with_epub_uris      (GepubDoc *doc);
60 gchar            *gepub_doc_get_cover                       (GepubDoc *doc);
61 gchar            *gepub_doc_get_resource_path               (GepubDoc *doc, const gchar *id);
62 gchar            *gepub_doc_get_current_path                (GepubDoc *doc);
63 const gchar      *gepub_doc_get_current_id                  (GepubDoc *doc);
64 
65 gboolean          gepub_doc_go_next                         (GepubDoc *doc);
66 gboolean          gepub_doc_go_prev                         (GepubDoc *doc);
67 gint              gepub_doc_get_n_chapters                  (GepubDoc *doc);
68 gint              gepub_doc_get_chapter                     (GepubDoc *doc);
69 void              gepub_doc_set_chapter                     (GepubDoc *doc,
70                                                              gint      index);
71 
72 G_END_DECLS
73 
74 /**
75  * GEPUB_META_TITLE:
76  * The book title.
77  */
78 #define GEPUB_META_TITLE "title"
79 
80 /**
81  * GEPUB_META_LANG:
82  * The book lang.
83  */
84 #define GEPUB_META_LANG "language"
85 
86 /**
87  * GEPUB_META_ID:
88  * The book id.
89  */
90 #define GEPUB_META_ID "identifier"
91 
92 /**
93  * GEPUB_META_AUTHOR:
94  * The book author.
95  */
96 #define GEPUB_META_AUTHOR "creator"
97 
98 /**
99  * GEPUB_META_DESC:
100  * The book description.
101  */
102 #define GEPUB_META_DESC "description"
103 
104 #endif /* __GEPUB_DOC_H__ */
105 
106