From 4793b871b96c1b64383695be117467b59bfbfaa1 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 25 Sep 2008 00:19:16 +0000 Subject: Public stylesheet API & stubbed out implementations. Make public headers use libcss_ as their guard macro prefix. svn path=/trunk/libcss/; revision=5433 --- include/libcss/errors.h | 4 ++-- include/libcss/functypes.h | 4 ++-- include/libcss/libcss.h | 4 ++-- include/libcss/stylesheet.h | 36 ++++++++++++++++++++++++++++++++++++ include/libcss/types.h | 13 +++++++++++-- 5 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 include/libcss/stylesheet.h (limited to 'include') diff --git a/include/libcss/errors.h b/include/libcss/errors.h index f7eeba2..55bd379 100644 --- a/include/libcss/errors.h +++ b/include/libcss/errors.h @@ -5,8 +5,8 @@ * Copyright 2007 John-Mark Bell */ -#ifndef css_errors_h_ -#define css_errors_h_ +#ifndef libcss_errors_h_ +#define libcss_errors_h_ #include diff --git a/include/libcss/functypes.h b/include/libcss/functypes.h index 22a48bf..52cb33f 100644 --- a/include/libcss/functypes.h +++ b/include/libcss/functypes.h @@ -5,8 +5,8 @@ * Copyright 2007-8 John-Mark Bell */ -#ifndef css_functypes_h_ -#define css_functypes_h_ +#ifndef libcss_functypes_h_ +#define libcss_functypes_h_ #include #include diff --git a/include/libcss/libcss.h b/include/libcss/libcss.h index 364a3eb..6154828 100644 --- a/include/libcss/libcss.h +++ b/include/libcss/libcss.h @@ -5,8 +5,8 @@ * Copyright 2007 John-Mark Bell */ -#ifndef css_h_ -#define css_h_ +#ifndef libcss_h_ +#define libcss_h_ #include #include diff --git a/include/libcss/stylesheet.h b/include/libcss/stylesheet.h new file mode 100644 index 0000000..a3ff0a6 --- /dev/null +++ b/include/libcss/stylesheet.h @@ -0,0 +1,36 @@ +/* + * This file is part of LibCSS. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2008 John-Mark Bell + */ + +#ifndef libcss_stylesheet_h_ +#define libcss_stylesheet_h_ + +#include +#include + +/** + * Type of stylesheet import handler + */ +typedef css_error (*css_import_handler)(void *pw, const char *url, + css_stylesheet *sheet); + +css_stylesheet *css_stylesheet_create(const char *url, const char *title, + css_origin origin, uint32_t media, + css_import_handler import_callback, void *import_pw, + css_alloc alloc, void *alloc_pw); +void css_stylesheet_destroy(css_stylesheet *sheet); + +css_error css_stylesheet_append_data(css_stylesheet *sheet, + const uint8_t *data, size_t len); +css_error css_stylesheet_data_done(css_stylesheet *sheet); + +css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url); +css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title); +css_error css_stylesheet_get_origin(css_stylesheet *sheet, css_origin *origin); +css_error css_stylesheet_get_media(css_stylesheet *sheet, uint32_t *media); + +#endif + diff --git a/include/libcss/types.h b/include/libcss/types.h index 104e339..ad5b5bf 100644 --- a/include/libcss/types.h +++ b/include/libcss/types.h @@ -5,8 +5,8 @@ * Copyright 2007 John-Mark Bell */ -#ifndef css_types_h_ -#define css_types_h_ +#ifndef libcss_types_h_ +#define libcss_types_h_ #include #include @@ -32,4 +32,13 @@ typedef struct css_string { typedef struct css_stylesheet css_stylesheet; +/** + * Stylesheet origin + */ +typedef enum css_origin { + CSS_ORIGIN_UA = 0, /**< User agent stylesheet */ + CSS_ORIGIN_USER = 1, /**< User stylesheet */ + CSS_ORIGIN_AUTHOR = 2 /**< Author stylesheet */ +} css_origin; + #endif -- cgit v1.2.3