00001 /* 00002 * Copyright 2009 Red Hat Inc., Durham, North Carolina. 00003 * All Rights Reserved. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 * 00019 * Authors: 00020 * "David Niemoller" <David.Niemoller@g2-inc.com> 00021 * Lukas Kuklinek <lkuklinek@redhat.com> 00022 */ 00023 00037 #pragma once 00038 #ifndef OSCAP_TEXT_H_ 00039 #define OSCAP_TEXT_H_ 00040 00041 #include <stdbool.h> 00042 00047 00048 extern const char * const OSCAP_LANG_ENGLISH; 00050 extern const char * const OSCAP_LANG_ENGLISH_US; 00052 extern const char * const OSCAP_LANG_DEFAULT; 00059 struct oscap_text; 00060 00065 struct oscap_stringlist; 00066 00073 struct oscap_text *oscap_text_new(void); 00074 00080 struct oscap_text *oscap_text_clone(const struct oscap_text * text); 00081 00088 struct oscap_text *oscap_text_new_html(void); 00089 00094 void oscap_text_free(struct oscap_text *); 00095 00096 /************************************************************/ 00104 00105 struct oscap_string_iterator *oscap_stringlist_get_strings(const struct oscap_stringlist* list); 00107 struct oscap_stringlist *oscap_stringlist_clone(struct oscap_stringlist *list); 00108 00110 const char *oscap_text_get_text(const struct oscap_text *text); 00112 const char *oscap_text_get_lang(const struct oscap_text *text); 00118 char *oscap_text_get_plaintext(const struct oscap_text *text); 00119 00124 bool oscap_text_get_is_html(const struct oscap_text *text); 00129 bool oscap_text_get_can_substitute(const struct oscap_text *text); 00134 bool oscap_text_get_can_override(const struct oscap_text *text); 00139 bool oscap_text_get_overrides(const struct oscap_text *text); 00140 00141 /************************************************************/ 00144 /************************************************************/ 00156 bool oscap_text_set_overrides(struct oscap_text *text, bool overrides); 00157 00159 bool oscap_text_set_text(struct oscap_text *text, const char * string); 00161 bool oscap_text_set_lang(struct oscap_text *text, const char *string); 00162 00164 bool oscap_stringlist_add_string(struct oscap_stringlist* list, const char *str); 00166 struct oscap_stringlist * oscap_stringlist_new(void); 00168 void oscap_stringlist_free(struct oscap_stringlist *list); 00169 00170 00171 /************************************************************/ 00174 /************************************************************/ 00184 struct oscap_text_iterator; 00186 struct oscap_text *oscap_text_iterator_next(struct oscap_text_iterator *it); 00188 bool oscap_text_iterator_has_more(struct oscap_text_iterator *it); 00190 void oscap_text_iterator_free(struct oscap_text_iterator *it); 00192 void oscap_text_iterator_remove(struct oscap_text_iterator *it); 00194 void oscap_text_iterator_reset(struct oscap_text_iterator *it); 00195 00203 struct oscap_string_iterator; 00205 const char *oscap_string_iterator_next(struct oscap_string_iterator *it); 00207 bool oscap_string_iterator_has_more(struct oscap_string_iterator *it); 00209 void oscap_string_iterator_free(struct oscap_string_iterator *it); 00211 void oscap_string_iterator_remove(struct oscap_string_iterator *it); 00213 void oscap_string_iterator_reset(struct oscap_string_iterator *it); 00214 00220 struct oscap_stringlist_iterator; 00222 struct oscap_stringlist *oscap_stringlist_iterator_next(struct oscap_stringlist_iterator *it); 00224 bool oscap_stringlist_iterator_has_more(struct oscap_stringlist_iterator *it); 00226 void oscap_stringlist_iterator_free(struct oscap_stringlist_iterator *it); 00228 void oscap_stringlist_iterator_remove(struct oscap_stringlist_iterator *it); 00230 void oscap_stringlist_iterator_reset(struct oscap_stringlist_iterator *it); 00231 00232 /************************************************************/ 00238 #endif 00239