/usr/include/ccss-1/ccss/ccss-property.h is in libccss-dev 0.5.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | /* vim: set ts=8 sw=8 noexpandtab: */
/* The `C' CSS Library.
* Copyright (C) 2008 Robert Staudinger
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef CCSS_PROPERTY_H
#define CCSS_PROPERTY_H
#include <stdbool.h>
#include <libcroco/libcroco.h>
#include <ccss/ccss-macros.h>
CCSS_BEGIN_DECLS
/* Avoid circular dependencies. */
struct ccss_block_;
struct ccss_grammar_;
struct ccss_style_;
/**
* ccss_property_state_t:
* @CCSS_PROPERTY_STATE_INVALID: error state, invalid property.
* @CCSS_PROPERTY_STATE_NONE: property set to `none', switched off.
* @CCSS_PROPERTY_STATE_INHERIT: inherit property from container.
* @CCSS_PROPERTY_STATE_SET: property is valid and set.
* @CCSS_PROPERTY_STATE_ERROR_OVERFLOW: error state, used for bounds checking.
*
* This enum must be embedded as first field in every property implementation.
*
* <!-- PONDERING: turn into flags and add CCSS_PROPERTY_STATE_UNRESOLVED. -->
**/
typedef enum {
CCSS_PROPERTY_STATE_INVALID = 0,
CCSS_PROPERTY_STATE_NONE,
CCSS_PROPERTY_STATE_INHERIT,
CCSS_PROPERTY_STATE_SET,
CCSS_PROPERTY_STATE_ERROR_OVERFLOW
} ccss_property_state_t;
const char *
ccss_property_state_serialize (ccss_property_state_t self);
/**
* ccss_property_type_t:
* @CCSS_PROPERTY_TYPE_DOUBLE: property represented by a floating point number.
* @CCSS_PROPERTY_TYPE_STRING: property represented by a string.
*
* Type descriptions for generic properties.
**/
typedef enum {
CCSS_PROPERTY_TYPE_DOUBLE,
CCSS_PROPERTY_TYPE_STRING
} ccss_property_type_t;
typedef struct ccss_property_ ccss_property_t;
/**
* ccss_property_create_f:
* @grammar: the grammar associated with this property.
* @values: libcroco CSS values to parse for the property, see #CRTerm.
* @user_data: user data passed to property- or function-handler.
*
* Hook function for instantiating a property.
*
* Returns: pointer to the allocated property instance or %NULL if parsing fails.
**/
typedef ccss_property_t * (*ccss_property_create_f) (struct ccss_grammar_ const *grammar,
CRTerm const *values,
void *user_data);
/**
* ccss_property_destroy_f:
* @self: pointer to property instance.
*
* Hook function for deallocating a property instance.
**/
typedef void (*ccss_property_destroy_f) (ccss_property_t *self);
/**
* ccss_property_convert_f:
* @self: pointer to property instance.
* @target: conversion target type, see #ccss_property_type_t.
* @value: pointer to memory location where to place the converted value.
*
* Hook function for converting a property instance.
*
* Returns: %TRUE if the conversion was successful.
**/
typedef bool (*ccss_property_convert_f) (ccss_property_t const *self,
ccss_property_type_t target,
void *value);
/**
* ccss_property_factory_f:
* @grammar: the grammar associated with this property.
* @block: the #ccss_block_t the properties will be associated to.
* @name: name of the property.
* @values: libcroco CSS values to parse for the property, see #CRTerm.
* @user_data: user data passed to property- or function-handler.
*
* Hook function to handle the creation of multiple properties from a single CSS property, e.g. `border'.
*
* Returns: %TRUE when sucessful.
**/
typedef bool (*ccss_property_factory_f) (struct ccss_grammar_ const *grammar,
struct ccss_block_ *block,
char const *name,
CRTerm const *values,
void *user_data);
/**
* ccss_property_inherit_f:
* @container_style: style to inherit from.
* @style: style to inherit to.
*
* Hook function to inherit multi-value properties like `border'.
*
* Returns: %TRUE if property inheritance could be resolved.
**/
typedef bool (*ccss_property_inherit_f) (struct ccss_style_ const *container_style,
struct ccss_style_ *style);
/**
* ccss_property_serialize_f:
* @self: pointer to property instance.
*
* Hook function to reformat a property to CSS syntax.
*
* Returns: %TRUE if property inheritance could be resolved.
**/
typedef char * (*ccss_property_serialize_f) (ccss_property_t const *self);
/**
* ccss_property_class_t:
* @name: property name.
* @create: allocation hook, see #ccss_property_create_f.
* @destroy: deallocation hook, see #ccss_property_destroy_f.
* @convert: conversion hook, see #ccss_property_convert_f.
* @factory: factory hook, see #ccss_property_factory_f.
* @inherit: inherit hook, see #ccss_property_inherit_f.
* @inherit: inherit hook, see #ccss_property_inherit_f.
* @serialize: serialize hook, see #ccss_property_serialize_f.
*
* Property interpretation vtable entry.
**/
typedef struct {
char const *name;
ccss_property_create_f create;
ccss_property_destroy_f destroy;
ccss_property_convert_f convert;
ccss_property_factory_f factory;
ccss_property_inherit_f inherit;
ccss_property_serialize_f serialize;
/*< private >*/
void (*_padding_0) (void);
void (*_padding_1) (void);
void (*_padding_2) (void);
void (*_padding_3) (void);
void (*_padding_4) (void);
} ccss_property_class_t;
/**
* ccss_property_t:
* @vtable: class descriptor, see #ccss_property_class_t.
* @state: property state, see #ccss_property_state_t.
*
* This structure has to be embedded at the beginning of every custom property.
**/
struct ccss_property_ {
ccss_property_class_t const *vtable;
ccss_property_state_t state;
};
void
ccss_property_init (ccss_property_t *self,
ccss_property_class_t const *property_class);
void
ccss_property_destroy (ccss_property_t *self);
ccss_property_state_t
ccss_property_parse_state (CRTerm const **value);
CCSS_END_DECLS
#endif /* CCSS_PROPERTY_H */
|