HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
hbbtv_string.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2013 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
26 #ifndef _HBBTV_STRING_H
27 
28 #define _HHBTV_STRING_H
29 
30 
31 #include "hbbtv.h"
32 #include "hbbtv_types.h"
33 #include "hbbtv_sif_conf.h"
34 
35 
36 extern void *JS_HBBTV_STRING_CLASS;
37 
38 /*---Constant and macro definitions for public use-----------------------------*/
39 
40 /*---Enumerations for public use-----------------------------------------------*/
41 
42 typedef enum
43 {
44  STRING_FORMAT_UNKNOWN,
45  STRING_FORMAT_DVB,
46  STRING_FORMAT_UTF8,
47  STRING_FORMAT_UTF16,
48  STRING_FORMAT_UTF8_LATIN1 // used to hold descriptor data
49 } E_STRING_FORMAT;
50 
51 
52 /*---Global type defs for public use-------------------------------------------*/
53 
54 /*---Global Function prototypes for public use---------------------------------*/
61 S_HBBTV_STRING HBBTV_StrCreate(U32BIT strlen, U8BIT *data);
62 
67 void HBBTV_StrFree(S_HBBTV_STRING *string);
68 
69 /*
70  * @brief Creates a copy of the given S_HBBTV_STRING
71  * @param source source S_HBBTV_STRING to copy from
72  * @return S_HBBTV_STRING containing the same caracters contained in source
73  */
74 S_HBBTV_STRING HBBTV_StrCopy(S_HBBTV_STRING source);
75 
81 
88 void* HBBTV_JSStringCreate(S_HBBTV_STRING *value, E_STRING_FORMAT format);
89 
95 void* HBBTV_JSStringCreateFromAscii(U8BIT *ascii_string);
96 
102 void* HBBTV_JSStringCreateFromUtf8(U8BIT *utf_string);
103 
109 void* HBBTV_JSStringCreateFromUtf16(U16BIT *utf_string);
110 
117 void HBBTV_JSStringReplace(void *string, S_HBBTV_STRING *value);
118 
125 BOOLEAN HBBTV_JSStringEqual(void *obj, S_HBBTV_STRING *string, BOOLEAN ignore_case);
126 
135 S8BIT HBBTV_JSStringCompare(void *obj, S_HBBTV_STRING *str2, BOOLEAN ignore_case);
136 
144 BOOLEAN HBBTV_JSStringContains(void *obj, S_HBBTV_STRING *str2, BOOLEAN ignore_case);
145 
150 void HBBTV_JSStringSetFormat(E_HBBTV_STRING_FORMAT string_format);
151 
152 /*
153  * @brief Return a string in ISO Latin1 format. For now only converts from UTF-8
154  * @param obj - string object
155  * @param length - length in bytes of the returned buffer
156  * @return ISO Latin1 string which should be released using HBBTV_JSString_releaseString
157  */
158 U8BIT* HBBTV_JSStringGetStringLatin1(void *obj, U32BIT *length);
159 
160 #endif /* _HBBTV_STRING_H */
161 
162 
163 
164 
165 
166 
167 
void * HBBTV_JSStringCreateFromUtf8(U8BIT *utf_string)
Create a string from a UTF-8 string.
Definition: hbbtv_string.c:1193
void HBBTV_JSStringSetFormat(E_HBBTV_STRING_FORMAT string_format)
Saves the string format supported by the DVB stack.
Definition: hbbtv_string.c:1839
S8BIT HBBTV_JSStringCompare(void *obj, S_HBBTV_STRING *str2, BOOLEAN ignore_case)
Compares the two strings and returns -1 if str2 < string object, 0 if the strings are equal...
Definition: hbbtv_string.c:1370
HBBTV engine function definitions.
Definition of general purpose types.
void * HBBTV_JSStringCreateFromAscii(U8BIT *ascii_string)
Create a string from an ASCII string.
Definition: hbbtv_string.c:1166
BOOLEAN HBBTV_JSStringContains(void *obj, S_HBBTV_STRING *str2, BOOLEAN ignore_case)
Checks whether the string object is a substring of str2.
Definition: hbbtv_string.c:1482
S_HBBTV_STRING HBBTV_StrGetUrlOrigin(S_HBBTV_STRING *url)
Returns a string containing the origin of the given URL as defined by RFC6454 <scheme>://<domain>:<po...
Definition: hbbtv_string.c:1927
S_HBBTV_STRING HBBTV_StrCreate(U32BIT strlen, U8BIT *data)
Creates an S_HBBTV_STRING with the given strlen containing a copy of the given data.
Definition: hbbtv_string.c:1850
System Interface, Configuration.
void * HBBTV_JSStringCreateFromUtf16(U16BIT *utf_string)
Create a string from a UTF-16 string.
Definition: hbbtv_string.c:1219
BOOLEAN HBBTV_JSStringEqual(void *obj, S_HBBTV_STRING *string, BOOLEAN ignore_case)
Check if two strings are the same.
Definition: hbbtv_string.c:1278
void * HBBTV_JSStringCreate(S_HBBTV_STRING *value, E_STRING_FORMAT format)
Create a string from a given S_HBBTV_STRING which is of the specified format.
Definition: hbbtv_string.c:1134
Definition: hbbtv_types.h:167
void HBBTV_StrFree(S_HBBTV_STRING *string)
Frees the memory allocated for the specified S_HBBTV_STRING.
Definition: hbbtv_string.c:1881
void HBBTV_JSStringReplace(void *string, S_HBBTV_STRING *value)
Replace string data with given data.
Definition: hbbtv_string.c:1246