| 1 | /* |
| 2 | * Copyright 2009 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 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 Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * "David Niemoller" <[email protected]> |
| 21 | * Lukas Kuklinek <[email protected]> |
| 22 | */ |
| 23 | |
| 24 | /** |
| 25 | * @file |
| 26 | * Multilingual text processing interface. |
| 27 | * @author Lukas Kuklinek <[email protected]> |
| 28 | * @author David Niemoller <[email protected]> |
| 29 | * |
| 30 | * @addtogroup COMMON |
| 31 | * @{ |
| 32 | * @addtogroup STRINGS |
| 33 | * @{ |
| 34 | * Functions to access and manipulate textual data. |
| 35 | */ |
| 36 | |
| 37 | #pragma once |
| 38 | #ifndef OSCAP_TEXT_H_ |
| 39 | #define OSCAP_TEXT_H_cxx . . $ `src/common/public/oscap_text.h:39:9`! |
| 40 | |
| 41 | #include <stdbool.h> |
| 42 | #include "oscap_export.h"cxx . . $ `<file>/src/common/public/oscap_export.h`/ |
| 43 | |
| 44 | /** |
| 45 | * @name Common language codes |
| 46 | * @{ |
| 47 | */ |
| 48 | /// English |
| 49 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! extern const char *const OSCAP_LANG_ENGLISHcxx . . $ OSCAP_LANG_ENGLISH.; |
| 50 | /// American English |
| 51 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! extern const char *const OSCAP_LANG_ENGLISH_UScxx . . $ OSCAP_LANG_ENGLISH_US.; |
| 52 | /// Default language (i.e. American English) |
| 53 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! extern const char *const OSCAP_LANG_DEFAULTcxx . . $ OSCAP_LANG_DEFAULT.; |
| 54 | /** @} */ |
| 55 | |
| 56 | /** |
| 57 | * @struct oscap_text |
| 58 | * Representation of internationalizable character strings |
| 59 | */ |
| 60 | struct oscap_textcxx . . $ oscap_text#; |
| 61 | |
| 62 | /** |
| 63 | * @struct oscap_stringlist |
| 64 | * A collection of strings. |
| 65 | */ |
| 66 | struct oscap_stringlistcxx . . $ oscap_stringlist#; |
| 67 | |
| 68 | /** |
| 69 | * Create an internationalized text field. |
| 70 | * @param lang - language identifier (@see oscap_text_lang) |
| 71 | * @param encoding - language encoding (@see oscap_text_encoding) |
| 72 | * @memberof oscap_text |
| 73 | */ |
| 74 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_textcxx . . $ oscap_text# *oscap_text_newcxx . . $ oscap_text_new(b563511806f9674e).(void); |
| 75 | |
| 76 | /** |
| 77 | * Clone an internationalized text field. |
| 78 | * @param text oscap_text structure to clone |
| 79 | * @memberof oscap_text |
| 80 | */ |
| 81 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_textcxx . . $ oscap_text# *oscap_text_clonecxx . . $ oscap_text_clone(ca1982dd7fd7b6b0).(const struct oscap_textcxx . . $ oscap_text# * text); |
| 82 | |
| 83 | /** |
| 84 | * Create an internationalized text field with HTML content. |
| 85 | * @param lang - language identifier (@see oscap_text_lang) |
| 86 | * @param encoding - language encoding (@see oscap_text_encoding) |
| 87 | * @memberof oscap_text |
| 88 | */ |
| 89 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_textcxx . . $ oscap_text# *oscap_text_new_htmlcxx . . $ oscap_text_new_html(b563511806f9674e).(void); |
| 90 | |
| 91 | /** |
| 92 | * Release an internationalized text field. |
| 93 | * @memberof oscap_text |
| 94 | */ |
| 95 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_text_freecxx . . $ oscap_text_free(c2630df24779e845).(struct oscap_textcxx . . $ oscap_text# *); |
| 96 | |
| 97 | /************************************************************/ |
| 98 | /** |
| 99 | * @name Getters |
| 100 | * Return value is pointer to structure's member. Do not free unless you null the pointer in the structure. |
| 101 | * Use remove function otherwise. |
| 102 | * @{ |
| 103 | * */ |
| 104 | |
| 105 | /// @memberof oscap_stringlist |
| 106 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *oscap_stringlist_get_stringscxx . . $ oscap_stringlist_get_strings(13be827fcd32d2b9).(const struct oscap_stringlistcxx . . $ oscap_stringlist#* list); |
| 107 | /// @memberof oscap_stringlist |
| 108 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_stringlistcxx . . $ oscap_stringlist# *oscap_stringlist_clonecxx . . $ oscap_stringlist_clone(3b3c67b595f43f9d).(struct oscap_stringlistcxx . . $ oscap_stringlist# *list); |
| 109 | |
| 110 | /// @memberof oscap_text |
| 111 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char *oscap_text_get_textcxx . . $ oscap_text_get_text(ba0993cb6b641422).(const struct oscap_textcxx . . $ oscap_text# *text); |
| 112 | /// @memberof oscap_text |
| 113 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char *oscap_text_get_langcxx . . $ oscap_text_get_lang(ba0993cb6b641422).(const struct oscap_textcxx . . $ oscap_text# *text); |
| 114 | /** |
| 115 | * Get plaintext representation of the text. |
| 116 | * Caller is responsible for freeing returned string. |
| 117 | * @memberof oscap_text |
| 118 | */ |
| 119 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! char *oscap_text_get_plaintextcxx . . $ oscap_text_get_plaintext(b919ca79285e5f6a).(const struct oscap_textcxx . . $ oscap_text# *text); |
| 120 | |
| 121 | /** |
| 122 | * Does this text posses a HTML content? |
| 123 | * @memberof oscap_text |
| 124 | */ |
| 125 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_get_is_htmlcxx . . $ oscap_text_get_is_html(b63bfab56583660c).(const struct oscap_textcxx . . $ oscap_text# *text); |
| 126 | /** |
| 127 | * Can this text contain substitutions? |
| 128 | * @memberof oscap_text |
| 129 | */ |
| 130 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_get_can_substitutecxx . . $ oscap_text_get_can_substitute(b63bfab56583660c).(const struct oscap_textcxx . . $ oscap_text# *text); |
| 131 | /** |
| 132 | * Can this text override parent content? |
| 133 | * @memberof oscap_text |
| 134 | */ |
| 135 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_get_can_overridecxx . . $ oscap_text_get_can_override(b63bfab56583660c).(const struct oscap_textcxx . . $ oscap_text# *text); |
| 136 | /** |
| 137 | * Does this text override parent content? |
| 138 | * @memberof oscap_text |
| 139 | */ |
| 140 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_get_overridescxx . . $ oscap_text_get_overrides(b63bfab56583660c).(const struct oscap_textcxx . . $ oscap_text# *text); |
| 141 | |
| 142 | /************************************************************/ |
| 143 | /** @} End of Getters group */ |
| 144 | |
| 145 | /************************************************************/ |
| 146 | /** |
| 147 | * @name Setters |
| 148 | * For lists use add functions. Parameters of set functions are duplicated in memory and need to |
| 149 | * be freed by caller. |
| 150 | * @{ |
| 151 | */ |
| 152 | |
| 153 | /** |
| 154 | * Set whether this text overrides parent content. |
| 155 | * @memberof oscap_text |
| 156 | */ |
| 157 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_set_overridescxx . . $ oscap_text_set_overrides(bd5be5ab3abf8282).(struct oscap_textcxx . . $ oscap_text# *text, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! overrides); |
| 158 | |
| 159 | /// @memberof oscap_text |
| 160 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_set_textcxx . . $ oscap_text_set_text(8aa69a4864e2c57).(struct oscap_textcxx . . $ oscap_text# *text, const char * string); |
| 161 | /// @memberof oscap_text |
| 162 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_set_langcxx . . $ oscap_text_set_lang(8aa69a4864e2c57).(struct oscap_textcxx . . $ oscap_text# *text, const char *string); |
| 163 | |
| 164 | /// @memberof oscap_stringlist |
| 165 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_stringlist_add_stringcxx . . $ oscap_stringlist_add_string(80c12aaea9c014af).(struct oscap_stringlistcxx . . $ oscap_stringlist#* list, const char *str); |
| 166 | /// @memberof oscap_stringlist |
| 167 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_stringlistcxx . . $ oscap_stringlist# * oscap_stringlist_newcxx . . $ oscap_stringlist_new(22a991cfbca9a1c).(void); |
| 168 | /// @memberof oscap_stringlist |
| 169 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_stringlist_freecxx . . $ oscap_stringlist_free(7df8e35292df4dfb).(struct oscap_stringlistcxx . . $ oscap_stringlist# *list); |
| 170 | |
| 171 | |
| 172 | /************************************************************/ |
| 173 | /** @} End of Setters group */ |
| 174 | |
| 175 | /************************************************************/ |
| 176 | /** |
| 177 | * @name Iterators |
| 178 | * @{ |
| 179 | * */ |
| 180 | |
| 181 | /** @struct oscap_text_iterator |
| 182 | * Internationalized string iterator. |
| 183 | * @see oscap_iterator |
| 184 | */ |
| 185 | struct oscap_text_iteratorcxx . . $ oscap_text_iterator#; |
| 186 | /// @memberof oscap_text_iterator |
| 187 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_textcxx . . $ oscap_text# *oscap_text_iterator_nextcxx . . $ oscap_text_iterator_next(fef5008d25b58ff).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *it); |
| 188 | /// @memberof oscap_text_iterator |
| 189 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_text_iterator_has_morecxx . . $ oscap_text_iterator_has_more(7616e6c9867966c1).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *it); |
| 190 | /// @memberof oscap_text_iterator |
| 191 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_text_iterator_freecxx . . $ oscap_text_iterator_free(f60c6cfdbf1f29d7).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *it); |
| 192 | /// @memberof oscap_text_iterator |
| 193 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_text_iterator_removecxx . . $ oscap_text_iterator_remove(f60c6cfdbf1f29d7).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *it); |
| 194 | /// @memberof oscap_text_iterator |
| 195 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_text_iterator_resetcxx . . $ oscap_text_iterator_reset(f60c6cfdbf1f29d7).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *it); |
| 196 | |
| 197 | /** |
| 198 | * @struct oscap_string_iterator |
| 199 | * String iterator. |
| 200 | * |
| 201 | * An iterator iterating over a collection of char*-s. |
| 202 | * @see oscap_iterator |
| 203 | */ |
| 204 | struct oscap_string_iteratorcxx . . $ oscap_string_iterator#; |
| 205 | /// @memberof oscap_string_iterator |
| 206 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! const char *oscap_string_iterator_nextcxx . . $ oscap_string_iterator_next(1f2a9ae2534eef34).(struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *it); |
| 207 | /// @memberof oscap_string_iterator |
| 208 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_string_iterator_has_morecxx . . $ oscap_string_iterator_has_more(3724f2faf2515a82).(struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *it); |
| 209 | /// @memberof oscap_string_iterator |
| 210 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_string_iterator_freecxx . . $ oscap_string_iterator_free(41a77e9ce361f406).(struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *it); |
| 211 | /// @memberof oscap_string_iterator |
| 212 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_string_iterator_removecxx . . $ oscap_string_iterator_remove(41a77e9ce361f406).(struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *it); |
| 213 | /// @memberof oscap_string_iterator |
| 214 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_string_iterator_resetcxx . . $ oscap_string_iterator_reset(41a77e9ce361f406).(struct oscap_string_iteratorcxx . . $ oscap_string_iterator# *it); |
| 215 | |
| 216 | /** |
| 217 | * @struct oscap_stringlist_iterator |
| 218 | * Iterator over collections of strings. |
| 219 | * @see oscap_iterator |
| 220 | */ |
| 221 | struct oscap_stringlist_iteratorcxx . . $ oscap_stringlist_iterator#; |
| 222 | /// @memberof oscap_stringlist_iterator |
| 223 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_stringlistcxx . . $ oscap_stringlist# *oscap_stringlist_iterator_nextcxx . . $ oscap_stringlist_iterator_next(bc2d458b6c9aa3b8).(struct oscap_stringlist_iteratorcxx . . $ oscap_stringlist_iterator# *it); |
| 224 | /// @memberof oscap_stringlist_iterator |
| 225 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! oscap_stringlist_iterator_has_morecxx . . $ oscap_stringlist_iterator_has_more(36a5096ea135105).(struct oscap_stringlist_iteratorcxx . . $ oscap_stringlist_iterator# *it); |
| 226 | /// @memberof oscap_stringlist_iterator |
| 227 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_stringlist_iterator_freecxx . . $ oscap_stringlist_iterator_free(8dac3ebbe1cd8b03).(struct oscap_stringlist_iteratorcxx . . $ oscap_stringlist_iterator# *it); |
| 228 | /// @memberof oscap_stringlist_iterator |
| 229 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_stringlist_iterator_removecxx . . $ oscap_stringlist_iterator_remove(8dac3ebbe1cd8b03).(struct oscap_stringlist_iteratorcxx . . $ oscap_stringlist_iterator# *it); |
| 230 | /// @memberof oscap_stringlist_iterator |
| 231 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! void oscap_stringlist_iterator_resetcxx . . $ oscap_stringlist_iterator_reset(8dac3ebbe1cd8b03).(struct oscap_stringlist_iteratorcxx . . $ oscap_stringlist_iterator# *it); |
| 232 | |
| 233 | /************************************************************/ |
| 234 | /** @} End of Iterators group */ |
| 235 | |
| 236 | /** @} */ |
| 237 | |
| 238 | /** |
| 239 | * @brief gets a plaintext string representing given textlist |
| 240 | * |
| 241 | * Iterates through given texts and looks at each to see if the language matches |
| 242 | * given preferred_lang. If preferred_lang is NULL, OSCAP_DEFAULT_LANG is matched. |
| 243 | * |
| 244 | * If a match is found it, a copy of plaintext representation of that text is |
| 245 | * returned. If nothing is found, plaintext representation of the first text in |
| 246 | * the list is returned. If the textlist is empty, NULL is returned. |
| 247 | */ |
| 248 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! char* oscap_textlist_get_preferred_plaintextcxx . . $ oscap_textlist_get_preferred_plaintext(9be0225be21606c3).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator#* texts, const char* preferred_lang); |
| 249 | |
| 250 | /** |
| 251 | * @brief gets oscap_text representing given textlist |
| 252 | * |
| 253 | * Similar to @ref oscap_textlist_get_preferred_plaintext but returns oscap_text |
| 254 | * instead of just the plaintext. |
| 255 | */ |
| 256 | OSCAP_APIcxx . . $ `src/common/public/oscap_export.h:42:15`! struct oscap_textcxx . . $ oscap_text# *oscap_textlist_get_preferred_textcxx . . $ oscap_textlist_get_preferred_text(92eab71fd95a04a7).(struct oscap_text_iteratorcxx . . $ oscap_text_iterator# *texts, const char *preferred_lang); |
| 257 | |
| 258 | |
| 259 | /** @} */ |
| 260 | |
| 261 | #endif |
| 262 |