Open SCAP Library: oscap_text.h Source File

Open SCAP Library

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

oscap_text.h
Go to the documentation of this file.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * Authors:
20 * "David Niemoller" <David.Niemoller@g2-inc.com>
21 * Lukas Kuklinek <lkuklinek@redhat.com>
22 */
23
37 #pragma once
38 #ifndef OSCAP_TEXT_H_
39 #define OSCAP_TEXT_H_
40
41 #include <stdbool.h>
42
47 extern const char * const OSCAP_LANG_ENGLISH;
50 extern const char * const OSCAP_LANG_ENGLISH_US;
52 extern const char * const OSCAP_LANG_DEFAULT;
59 struct oscap_text;
60
65 struct oscap_stringlist;
66
73 struct oscap_text *oscap_text_new(void);
74
80 struct oscap_text *oscap_text_clone(const struct oscap_text * text);
81
88 struct oscap_text *oscap_text_new_html(void);
89
94 void oscap_text_free(struct oscap_text *);
95
96 /************************************************************/
104 struct oscap_string_iterator *oscap_stringlist_get_strings(const struct oscap_stringlist* list);
107 struct oscap_stringlist *oscap_stringlist_clone(struct oscap_stringlist *list);
108
110 const char *oscap_text_get_text(const struct oscap_text *text);
112 const char *oscap_text_get_lang(const struct oscap_text *text);
118 char *oscap_text_get_plaintext(const struct oscap_text *text);
119
124 bool oscap_text_get_is_html(const struct oscap_text *text);
129 bool oscap_text_get_can_substitute(const struct oscap_text *text);
134 bool oscap_text_get_can_override(const struct oscap_text *text);
139 bool oscap_text_get_overrides(const struct oscap_text *text);
140
141 /************************************************************/
144 /************************************************************/
156 bool oscap_text_set_overrides(struct oscap_text *text, bool overrides);
157
159 bool oscap_text_set_text(struct oscap_text *text, const char * string);
161 bool oscap_text_set_lang(struct oscap_text *text, const char *string);
162
164 bool oscap_stringlist_add_string(struct oscap_stringlist* list, const char *str);
166 struct oscap_stringlist * oscap_stringlist_new(void);
168 void oscap_stringlist_free(struct oscap_stringlist *list);
169
170
171 /************************************************************/
174 /************************************************************/
184 struct oscap_text_iterator;
186 struct oscap_text *oscap_text_iterator_next(struct oscap_text_iterator *it);
188 bool oscap_text_iterator_has_more(struct oscap_text_iterator *it);
190 void oscap_text_iterator_free(struct oscap_text_iterator *it);
192 void oscap_text_iterator_remove(struct oscap_text_iterator *it);
194 void oscap_text_iterator_reset(struct oscap_text_iterator *it);
195
203 struct oscap_string_iterator;
205 const char *oscap_string_iterator_next(struct oscap_string_iterator *it);
207 bool oscap_string_iterator_has_more(struct oscap_string_iterator *it);
209 void oscap_string_iterator_free(struct oscap_string_iterator *it);
211 void oscap_string_iterator_remove(struct oscap_string_iterator *it);
213 void oscap_string_iterator_reset(struct oscap_string_iterator *it);
214
220 struct oscap_stringlist_iterator;
222 struct oscap_stringlist *oscap_stringlist_iterator_next(struct oscap_stringlist_iterator *it);
224 bool oscap_stringlist_iterator_has_more(struct oscap_stringlist_iterator *it);
226 void oscap_stringlist_iterator_free(struct oscap_stringlist_iterator *it);
228 void oscap_stringlist_iterator_remove(struct oscap_stringlist_iterator *it);
230 void oscap_stringlist_iterator_reset(struct oscap_stringlist_iterator *it);
231
232 /************************************************************/
247 char* oscap_textlist_get_preferred_plaintext(struct oscap_text_iterator* texts, const char* preferred_lang);
248
255 struct oscap_text *oscap_textlist_get_preferred_text(struct oscap_text_iterator *texts, const char *preferred_lang);
256
257
260 #endif
261
oscap_text::oscap_text_set_overrides
bool oscap_text_set_overrides(struct oscap_text *text, bool overrides)
Set whether this text overrides parent content.
Definition: text.c:61
oscap_text_iterator::oscap_text_iterator_reset
void oscap_text_iterator_reset(struct oscap_text_iterator *it)
oscap_stringlist_iterator
Iterator over collections of strings.
oscap_text_iterator::oscap_text_iterator_has_more
bool oscap_text_iterator_has_more(struct oscap_text_iterator *it)
oscap_stringlist_iterator::oscap_stringlist_iterator_free
void oscap_stringlist_iterator_free(struct oscap_stringlist_iterator *it)
oscap_string_iterator::oscap_string_iterator_next
const char * oscap_string_iterator_next(struct oscap_string_iterator *it)
oscap_stringlist
A collection of strings.
Definition: oscap_text.h:59
OSCAP_LANG_ENGLISH_US
const char *const OSCAP_LANG_ENGLISH_US
American English.
Definition: text.c:43
oscap_string_iterator::oscap_string_iterator_remove
void oscap_string_iterator_remove(struct oscap_string_iterator *it)
oscap_text::oscap_text_get_can_override
bool oscap_text_get_can_override(const struct oscap_text *text)
Can this text override parent content?
oscap_stringlist_iterator::oscap_stringlist_iterator_next
struct oscap_stringlist * oscap_stringlist_iterator_next(struct oscap_stringlist_iterator *it)
oscap_stringlist::oscap_stringlist_clone
struct oscap_stringlist * oscap_stringlist_clone(struct oscap_stringlist *list)
Definition: list.c:340
oscap_text::oscap_text_get_text
const char * oscap_text_get_text(const struct oscap_text *text)
oscap_text::oscap_text_clone
struct oscap_text * oscap_text_clone(const struct oscap_text *text)
Clone an internationalized text field.
Definition: text.c:91
oscap_text::oscap_text_get_is_html
bool oscap_text_get_is_html(const struct oscap_text *text)
Does this text posses a HTML content?
oscap_stringlist::oscap_stringlist_new
struct oscap_stringlist * oscap_stringlist_new(void)
Definition: list.c:358
oscap_text_iterator
Internationalized string iterator.
OSCAP_LANG_DEFAULT
const char *const OSCAP_LANG_DEFAULT
Default language (i.e. American English)
Definition: text.c:44
oscap_text::oscap_text_new_html
struct oscap_text * oscap_text_new_html(void)
Create an internationalized text field with HTML content.
Definition: text.c:96
oscap_textlist_get_preferred_plaintext
char * oscap_textlist_get_preferred_plaintext(struct oscap_text_iterator *texts, const char *preferred_lang)
gets a plaintext string representing given textlist
Definition: text.c:252
oscap_text::oscap_text_set_lang
bool oscap_text_set_lang(struct oscap_text *text, const char *string)
oscap_text_iterator::oscap_text_iterator_free
void oscap_text_iterator_free(struct oscap_text_iterator *it)
oscap_stringlist::oscap_stringlist_get_strings
struct oscap_string_iterator * oscap_stringlist_get_strings(const struct oscap_stringlist *list)
Definition: list.c:348
oscap_textlist_get_preferred_text
struct oscap_text * oscap_textlist_get_preferred_text(struct oscap_text_iterator *texts, const char *preferred_lang)
gets oscap_text representing given textlist
Definition: text.c:218
oscap_stringlist_iterator::oscap_stringlist_iterator_remove
void oscap_stringlist_iterator_remove(struct oscap_stringlist_iterator *it)
oscap_text::oscap_text_set_text
bool oscap_text_set_text(struct oscap_text *text, const char *string)
oscap_string_iterator::oscap_string_iterator_has_more
bool oscap_string_iterator_has_more(struct oscap_string_iterator *it)
oscap_stringlist::oscap_stringlist_add_string
bool oscap_stringlist_add_string(struct oscap_stringlist *list, const char *str)
Definition: list.c:353
oscap_text::oscap_text_get_plaintext
char * oscap_text_get_plaintext(const struct oscap_text *text)
Get plaintext representation of the text.
Definition: text.c:199
oscap_stringlist::oscap_stringlist_free
void oscap_stringlist_free(struct oscap_stringlist *list)
Definition: list.c:363
oscap_text
Representation of internationalizable character strings.
Definition: text_priv.h:47
oscap_string_iterator
String iterator.
oscap_string_iterator::oscap_string_iterator_reset
void oscap_string_iterator_reset(struct oscap_string_iterator *it)
oscap_text::oscap_text_get_overrides
bool oscap_text_get_overrides(const struct oscap_text *text)
Does this text override parent content?
oscap_stringlist_iterator::oscap_stringlist_iterator_reset
void oscap_stringlist_iterator_reset(struct oscap_stringlist_iterator *it)
oscap_text::oscap_text_get_can_substitute
bool oscap_text_get_can_substitute(const struct oscap_text *text)
Can this text contain substitutions?
oscap_text_iterator::oscap_text_iterator_remove
void oscap_text_iterator_remove(struct oscap_text_iterator *it)
OSCAP_LANG_ENGLISH
const char *const OSCAP_LANG_ENGLISH
English.
Definition: text.c:42
oscap_string_iterator::oscap_string_iterator_free
void oscap_string_iterator_free(struct oscap_string_iterator *it)
oscap_text::oscap_text_new
struct oscap_text * oscap_text_new(void)
Create an internationalized text field.
Definition: text.c:86
oscap_text::oscap_text_get_lang
const char * oscap_text_get_lang(const struct oscap_text *text)
oscap_text::oscap_text_free
void oscap_text_free(struct oscap_text *)
Release an internationalized text field.
Definition: text.c:67
oscap_text_iterator::oscap_text_iterator_next
struct oscap_text * oscap_text_iterator_next(struct oscap_text_iterator *it)
oscap_stringlist_iterator::oscap_stringlist_iterator_has_more
bool oscap_stringlist_iterator_has_more(struct oscap_stringlist_iterator *it)