diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2007-10-25 11:46:12 +0200 |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@gnome.org> | 2007-10-25 11:46:12 +0200 |
commit | d5be0148810ab70d58bc678b7aa65730bf4d5e54 (patch) | |
tree | c0b575bae314a9b7761334843a3ff8907e13fc19 /libspectre/spectre-document.c |
Initial importinitial
Diffstat (limited to 'libspectre/spectre-document.c')
-rw-r--r-- | libspectre/spectre-document.c | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/libspectre/spectre-document.c b/libspectre/spectre-document.c new file mode 100644 index 0000000..b9f7fbe --- /dev/null +++ b/libspectre/spectre-document.c @@ -0,0 +1,74 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "spectre-document.h" +#include "spectre-private.h" + +struct SpectreDocument +{ + SpectreStatus status; + + unsigned int n_pages; +}; + +SpectreDocument * +spectre_document_new (const char *file) +{ + SpectreDocument *doc = NULL; + + doc = calloc (1, sizeof (SpectreDocument)); + + printf ("spectre_document_new\n"); + + return doc; +} + +void +spectre_document_free (SpectreDocument *document) +{ + if (!document) + return; + + printf ("spectre_document_free\n"); + + free (document); +} + +SpectreStatus +spectre_document_status (SpectreDocument *document) +{ + return document->status; +} + +unsigned int +spectre_document_get_n_pages (SpectreDocument *document) +{ + if (document->n_pages == 0) { + /* TODO */ + } + + return document->n_pages; +} + +SpectrePage * +spectre_document_get_page (SpectreDocument *document, + unsigned int page_index) +{ + SpectrePage *page; + + if (page_index >= document->n_pages) { + document->status = SPECTRE_STATUS_INVALID_PAGE; + return NULL; + } + + page = _spectre_page_new (page_index); + if (!page) { + document->status = SPECTRE_STATUS_NO_MEMORY; + return NULL; + } + + if (document->status != SPECTRE_STATUS_SUCCESS) + document->status = SPECTRE_STATUS_SUCCESS; + + return page; +} |