HbbTv  17.9.0
Open source HBBTV engine
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Enumerations | Functions | Variables
hbbtv_string.h File Reference

String utility functions. More...

#include "hbbtv.h"
#include "hbbtv_types.h"
#include "hbbtv_sif_conf.h"

Go to the source code of this file.

Enumerations

enum  E_STRING_FORMAT {
  STRING_FORMAT_UNKNOWN, STRING_FORMAT_DVB, STRING_FORMAT_UTF8, STRING_FORMAT_UTF16,
  STRING_FORMAT_UTF8_LATIN1
}
 

Functions

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. More...
 
void HBBTV_StrFree (S_HBBTV_STRING *string)
 Frees the memory allocated for the specified S_HBBTV_STRING. More...
 
S_HBBTV_STRING HBBTV_StrCopy (S_HBBTV_STRING source)
 
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>:<port>
 
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. More...
 
void * HBBTV_JSStringCreateFromAscii (U8BIT *ascii_string)
 Create a string from an ASCII string. More...
 
void * HBBTV_JSStringCreateFromUtf8 (U8BIT *utf_string)
 Create a string from a UTF-8 string. More...
 
void * HBBTV_JSStringCreateFromUtf16 (U16BIT *utf_string)
 Create a string from a UTF-16 string. More...
 
void HBBTV_JSStringReplace (void *string, S_HBBTV_STRING *value)
 Replace string data with given data. More...
 
BOOLEAN HBBTV_JSStringEqual (void *obj, S_HBBTV_STRING *string, BOOLEAN ignore_case)
 Check if two strings are the same. More...
 
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, including their lengths, +1 if str2 > string object. More...
 
BOOLEAN HBBTV_JSStringContains (void *obj, S_HBBTV_STRING *str2, BOOLEAN ignore_case)
 Checks whether the string object is a substring of str2. More...
 
void HBBTV_JSStringSetFormat (E_HBBTV_STRING_FORMAT string_format)
 Saves the string format supported by the DVB stack. More...
 
U8BIT * HBBTV_JSStringGetStringLatin1 (void *obj, U32BIT *length)
 

Variables

void * JS_HBBTV_STRING_CLASS
 

Detailed Description

String utility functions.

Date
2013
Author

Function Documentation

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, including their lengths, +1 if str2 > string object.

Parameters
obj- string object
str2- string to check against
ignore_case- FALSE if case sensitive search is to be performed
Returns
BOOLEAN HBBTV_JSStringContains ( void *  obj,
S_HBBTV_STRING str2,
BOOLEAN  ignore_case 
)

Checks whether the string object is a substring of str2.

Parameters
obj- string object to be searched for
str2- string to search through
ignore_case- FALSE if case sensitive search is to be performed
Returns
TRUE if string object is found in str2, FALSE otherwise
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.

Parameters
value- S_HBBTV_STRING containing the data for the string to be created
format- format of the string data in S_HBBTV_STRING
Returns
string object
void* HBBTV_JSStringCreateFromAscii ( U8BIT *  ascii_string)

Create a string from an ASCII string.

Parameters
ascii_string- character data for the string to be created
Returns
string object
void* HBBTV_JSStringCreateFromUtf16 ( U16BIT *  utf_string)

Create a string from a UTF-16 string.

Parameters
utf_string- character data for the string to be created
Returns
string object
void* HBBTV_JSStringCreateFromUtf8 ( U8BIT *  utf_string)

Create a string from a UTF-8 string.

Parameters
utf_string- character data for the string to be created
Returns
string object
BOOLEAN HBBTV_JSStringEqual ( void *  obj,
S_HBBTV_STRING str2,
BOOLEAN  ignore_case 
)

Check if two strings are the same.

Parameters
obj- the string object
string- the string to check
Returns
TRUE if the strings are equal, FALSE otherwise
Parameters
obj- the string object
str2- the string to check
ignore_case- FALSE if case sensitive search should be performed
Returns
TRUE if the strings are equal, FALSE otherwise
void HBBTV_JSStringReplace ( void *  obj,
S_HBBTV_STRING value 
)

Replace string data with given data.

Parameters
string- the string object
value- the new string value
Note
If the operation fails, the string is cleared
void HBBTV_JSStringSetFormat ( E_HBBTV_STRING_FORMAT  string_format)

Saves the string format supported by the DVB stack.

Parameters
string_formatFormat supported by the DVB stack
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.

Parameters
strlennumber of characters (excluding the string terminator) contained in data
databuffer containing the source string
Returns
S_HBBTV_STRING containing a copy of the characters in data
void HBBTV_StrFree ( S_HBBTV_STRING string)

Frees the memory allocated for the specified S_HBBTV_STRING.

Parameters
stringpointer to the S_HBBTV_STRING to be freed