Loading...
Searching...
No Matches
oscap_text.h
Go to the documentation of this file.
/*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* "David Niemoller" <David.Niemoller@g2-inc.com>
* Lukas Kuklinek <lkuklinek@redhat.com>
*/
#pragma once
#ifndef OSCAP_TEXT_H_
#define OSCAP_TEXT_H_
#include <stdbool.h>
#include "oscap_export.h"
OSCAP_API extern const char *const OSCAP_LANG_ENGLISH;
OSCAP_API extern const char *const OSCAP_LANG_ENGLISH_US;
OSCAP_API extern const char *const OSCAP_LANG_DEFAULT;
struct oscap_text;
struct oscap_stringlist;
OSCAP_API struct oscap_text *oscap_text_new(void);
OSCAP_API struct oscap_text *oscap_text_clone(const struct oscap_text * text);
OSCAP_API struct oscap_text *oscap_text_new_html(void);
OSCAP_API void oscap_text_free(struct oscap_text *);
/************************************************************/
OSCAP_API struct oscap_string_iterator *oscap_stringlist_get_strings(const struct oscap_stringlist* list);
OSCAP_API struct oscap_stringlist *oscap_stringlist_clone(struct oscap_stringlist *list);
OSCAP_API const char *oscap_text_get_text(const struct oscap_text *text);
OSCAP_API const char *oscap_text_get_lang(const struct oscap_text *text);
OSCAP_API char *oscap_text_get_plaintext(const struct oscap_text *text);
OSCAP_API bool oscap_text_get_is_html(const struct oscap_text *text);
OSCAP_API bool oscap_text_get_can_substitute(const struct oscap_text *text);
OSCAP_API bool oscap_text_get_can_override(const struct oscap_text *text);
OSCAP_API bool oscap_text_get_overrides(const struct oscap_text *text);
/************************************************************/
/************************************************************/
OSCAP_API bool oscap_text_set_overrides(struct oscap_text *text, bool overrides);
OSCAP_API bool oscap_text_set_text(struct oscap_text *text, const char * string);
OSCAP_API bool oscap_text_set_lang(struct oscap_text *text, const char *string);
OSCAP_API bool oscap_stringlist_add_string(struct oscap_stringlist* list, const char *str);
OSCAP_API struct oscap_stringlist * oscap_stringlist_new(void);
OSCAP_API void oscap_stringlist_free(struct oscap_stringlist *list);
/************************************************************/
/************************************************************/
struct oscap_text_iterator;
OSCAP_API struct oscap_text *oscap_text_iterator_next(struct oscap_text_iterator *it);
OSCAP_API bool oscap_text_iterator_has_more(struct oscap_text_iterator *it);
OSCAP_API void oscap_text_iterator_free(struct oscap_text_iterator *it);
OSCAP_API void oscap_text_iterator_remove(struct oscap_text_iterator *it);
OSCAP_API void oscap_text_iterator_reset(struct oscap_text_iterator *it);
struct oscap_string_iterator;
OSCAP_API const char *oscap_string_iterator_next(struct oscap_string_iterator *it);
OSCAP_API bool oscap_string_iterator_has_more(struct oscap_string_iterator *it);
OSCAP_API void oscap_string_iterator_free(struct oscap_string_iterator *it);
OSCAP_API void oscap_string_iterator_remove(struct oscap_string_iterator *it);
OSCAP_API void oscap_string_iterator_reset(struct oscap_string_iterator *it);
struct oscap_stringlist_iterator;
OSCAP_API struct oscap_stringlist *oscap_stringlist_iterator_next(struct oscap_stringlist_iterator *it);
OSCAP_API bool oscap_stringlist_iterator_has_more(struct oscap_stringlist_iterator *it);
OSCAP_API void oscap_stringlist_iterator_free(struct oscap_stringlist_iterator *it);
OSCAP_API void oscap_stringlist_iterator_remove(struct oscap_stringlist_iterator *it);
OSCAP_API void oscap_stringlist_iterator_reset(struct oscap_stringlist_iterator *it);
/************************************************************/
OSCAP_API char* oscap_textlist_get_preferred_plaintext(struct oscap_text_iterator* texts, const char* preferred_lang);
OSCAP_API struct oscap_text *oscap_textlist_get_preferred_text(struct oscap_text_iterator *texts, const char *preferred_lang);
#endif
oscap_textlist_get_preferred_text
OSCAP_API 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:219
oscap_textlist_get_preferred_plaintext
OSCAP_API 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:253
oscap_text::oscap_text_get_is_html
OSCAP_API bool oscap_text_get_is_html(const struct oscap_text *text)
Does this text posses a HTML content?
oscap_text::oscap_text_free
OSCAP_API void oscap_text_free(struct oscap_text *)
Release an internationalized text field.
Definition text.c:68
oscap_text::oscap_text_get_overrides
OSCAP_API bool oscap_text_get_overrides(const struct oscap_text *text)
Does this text override parent content?
OSCAP_LANG_ENGLISH_US
OSCAP_API const char *const OSCAP_LANG_ENGLISH_US
American English.
Definition text.c:44
oscap_text::oscap_text_set_overrides
OSCAP_API bool oscap_text_set_overrides(struct oscap_text *text, bool overrides)
Set whether this text overrides parent content.
Definition text.c:62
oscap_text::oscap_text_get_can_override
OSCAP_API bool oscap_text_get_can_override(const struct oscap_text *text)
Can this text override parent content?
OSCAP_LANG_DEFAULT
OSCAP_API const char *const OSCAP_LANG_DEFAULT
Default language (i.e. American English).
Definition text.c:45
oscap_text::oscap_text_clone
OSCAP_API struct oscap_text * oscap_text_clone(const struct oscap_text *text)
Clone an internationalized text field.
Definition text.c:92
oscap_text::oscap_text_new_html
OSCAP_API struct oscap_text * oscap_text_new_html(void)
Create an internationalized text field with HTML content.
Definition text.c:97
OSCAP_LANG_ENGLISH
OSCAP_API const char *const OSCAP_LANG_ENGLISH
English.
Definition text.c:43
oscap_text::oscap_text_new
OSCAP_API struct oscap_text * oscap_text_new(void)
Create an internationalized text field.
Definition text.c:87
oscap_text::oscap_text_get_can_substitute
OSCAP_API bool oscap_text_get_can_substitute(const struct oscap_text *text)
Can this text contain substitutions?
oscap_string_iterator
String iterator.
oscap_stringlist_iterator
Iterator over collections of strings.
oscap_stringlist
A collection of strings.
oscap_text_iterator
Internationalized string iterator.
oscap_text
Representation of internationalizable character strings.
Definition text_priv.h:46