/usr/include/openscap/oscap_text.h is in libopenscap-dev 1.2.15-1build1.
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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | /*
* Copyright 2009 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* 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.1 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors:
* "David Niemoller" <David.Niemoller@g2-inc.com>
* Lukas Kuklinek <lkuklinek@redhat.com>
*/
/**
* @file
* Multilingual text processing interface.
* @author Lukas Kuklinek <lkuklinek@redhat.com>
* @author David Niemoller <David.Niemoller@g2-inc.com>
*
* @addtogroup COMMON
* @{
* @addtogroup STRINGS
* @{
* Functions to access and manipulate textual data.
*/
#pragma once
#ifndef OSCAP_TEXT_H_
#define OSCAP_TEXT_H_
#include <stdbool.h>
/**
* @name Common language codes
* @{
*/
/// English
extern const char * const OSCAP_LANG_ENGLISH;
/// American English
extern const char * const OSCAP_LANG_ENGLISH_US;
/// Default language (i.e. American English)
extern const char * const OSCAP_LANG_DEFAULT;
/** @} */
/**
* @struct oscap_text
* Representation of internationalizable character strings
*/
struct oscap_text;
/**
* @struct oscap_stringlist
* A collection of strings.
*/
struct oscap_stringlist;
/**
* Create an internationalized text field.
* @param lang - language identifier (@see oscap_text_lang)
* @param encoding - language encoding (@see oscap_text_encoding)
* @memberof oscap_text
*/
struct oscap_text *oscap_text_new(void);
/**
* Clone an internationalized text field.
* @param text oscap_text structure to clone
* @memberof oscap_text
*/
struct oscap_text *oscap_text_clone(const struct oscap_text * text);
/**
* Create an internationalized text field with HTML content.
* @param lang - language identifier (@see oscap_text_lang)
* @param encoding - language encoding (@see oscap_text_encoding)
* @memberof oscap_text
*/
struct oscap_text *oscap_text_new_html(void);
/**
* Release an internationalized text field.
* @memberof oscap_text
*/
void oscap_text_free(struct oscap_text *);
/************************************************************/
/**
* @name Getters
* Return value is pointer to structure's member. Do not free unless you null the pointer in the structure.
* Use remove function otherwise.
* @{
* */
/// @memberof oscap_stringlist
struct oscap_string_iterator *oscap_stringlist_get_strings(const struct oscap_stringlist* list);
/// @memberof oscap_stringlist
struct oscap_stringlist *oscap_stringlist_clone(struct oscap_stringlist *list);
/// @memberof oscap_text
const char *oscap_text_get_text(const struct oscap_text *text);
/// @memberof oscap_text
const char *oscap_text_get_lang(const struct oscap_text *text);
/**
* Get plaintext representation of the text.
* Caller is responsible for freeing returned string.
* @memberof oscap_text
*/
char *oscap_text_get_plaintext(const struct oscap_text *text);
/**
* Does this text posses a HTML content?
* @memberof oscap_text
*/
bool oscap_text_get_is_html(const struct oscap_text *text);
/**
* Can this text contain substitutions?
* @memberof oscap_text
*/
bool oscap_text_get_can_substitute(const struct oscap_text *text);
/**
* Can this text override parent content?
* @memberof oscap_text
*/
bool oscap_text_get_can_override(const struct oscap_text *text);
/**
* Does this text override parent content?
* @memberof oscap_text
*/
bool oscap_text_get_overrides(const struct oscap_text *text);
/************************************************************/
/** @} End of Getters group */
/************************************************************/
/**
* @name Setters
* For lists use add functions. Parameters of set functions are duplicated in memory and need to
* be freed by caller.
* @{
*/
/**
* Set whether this text overrides parent content.
* @memberof oscap_text
*/
bool oscap_text_set_overrides(struct oscap_text *text, bool overrides);
/// @memberof oscap_text
bool oscap_text_set_text(struct oscap_text *text, const char * string);
/// @memberof oscap_text
bool oscap_text_set_lang(struct oscap_text *text, const char *string);
/// @memberof oscap_stringlist
bool oscap_stringlist_add_string(struct oscap_stringlist* list, const char *str);
/// @memberof oscap_stringlist
struct oscap_stringlist * oscap_stringlist_new(void);
/// @memberof oscap_stringlist
void oscap_stringlist_free(struct oscap_stringlist *list);
/************************************************************/
/** @} End of Setters group */
/************************************************************/
/**
* @name Iterators
* @{
* */
/** @struct oscap_text_iterator
* Internationalized string iterator.
* @see oscap_iterator
*/
struct oscap_text_iterator;
/// @memberof oscap_text_iterator
struct oscap_text *oscap_text_iterator_next(struct oscap_text_iterator *it);
/// @memberof oscap_text_iterator
bool oscap_text_iterator_has_more(struct oscap_text_iterator *it);
/// @memberof oscap_text_iterator
void oscap_text_iterator_free(struct oscap_text_iterator *it);
/// @memberof oscap_text_iterator
void oscap_text_iterator_remove(struct oscap_text_iterator *it);
/// @memberof oscap_text_iterator
void oscap_text_iterator_reset(struct oscap_text_iterator *it);
/**
* @struct oscap_string_iterator
* String iterator.
*
* An iterator iterating over a collection of char*-s.
* @see oscap_iterator
*/
struct oscap_string_iterator;
/// @memberof oscap_string_iterator
const char *oscap_string_iterator_next(struct oscap_string_iterator *it);
/// @memberof oscap_string_iterator
bool oscap_string_iterator_has_more(struct oscap_string_iterator *it);
/// @memberof oscap_string_iterator
void oscap_string_iterator_free(struct oscap_string_iterator *it);
/// @memberof oscap_string_iterator
void oscap_string_iterator_remove(struct oscap_string_iterator *it);
/// @memberof oscap_string_iterator
void oscap_string_iterator_reset(struct oscap_string_iterator *it);
/**
* @struct oscap_stringlist_iterator
* Iterator over collections of strings.
* @see oscap_iterator
*/
struct oscap_stringlist_iterator;
/// @memberof oscap_stringlist_iterator
struct oscap_stringlist *oscap_stringlist_iterator_next(struct oscap_stringlist_iterator *it);
/// @memberof oscap_stringlist_iterator
bool oscap_stringlist_iterator_has_more(struct oscap_stringlist_iterator *it);
/// @memberof oscap_stringlist_iterator
void oscap_stringlist_iterator_free(struct oscap_stringlist_iterator *it);
/// @memberof oscap_stringlist_iterator
void oscap_stringlist_iterator_remove(struct oscap_stringlist_iterator *it);
/// @memberof oscap_stringlist_iterator
void oscap_stringlist_iterator_reset(struct oscap_stringlist_iterator *it);
/************************************************************/
/** @} End of Iterators group */
/** @} */
/**
* @brief gets a plaintext string representing given textlist
*
* Iterates through given texts and looks at each to see if the language matches
* given preferred_lang. If preferred_lang is NULL, OSCAP_DEFAULT_LANG is matched.
*
* If a match is found it, a copy of plaintext representation of that text is
* returned. If nothing is found, plaintext representation of the first text in
* the list is returned. If the textlist is empty, NULL is returned.
*/
char* oscap_textlist_get_preferred_plaintext(struct oscap_text_iterator* texts, const char* preferred_lang);
/**
* @brief gets oscap_text representing given textlist
*
* Similar to @ref oscap_textlist_get_preferred_plaintext but returns oscap_text
* instead of just the plaintext.
*/
struct oscap_text *oscap_textlist_get_preferred_text(struct oscap_text_iterator *texts, const char *preferred_lang);
/** @} */
#endif
|