![]() |
HBBTV
22.11.0
|
String utility functions. More...
#include <stdio.h>
#include <string.h>
#include "techtype.h"
#include "hbbtv_sif_os.h"
#include "hbbtv_js.h"
#include "object.h"
#include "hbbtv_string.h"
#include "asciimap.h"
#include "debug.h"
Classes | |
struct | S_STRING_DATA |
struct | S_JS_HBBTV_STRING |
Macros | |
#define | INVALID_UNICODE_CHAR 0xffff |
#define | INC_UTF8_BYTES(unicode, bytes) |
Functions | |
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 *obj, S_HBBTV_STRING *value) |
Replace string data with given data. More... | |
S_HBBTV_STRING | HBBTV_JSString_getValue (void *obj) |
Return string's value. More... | |
BOOLEAN | HBBTV_JSStringEqual (void *obj, S_HBBTV_STRING *str2, 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... | |
U16BIT * | HBBTV_JSString_getString16 (void *obj) |
Return a string in HbbTV UTF-16 format, with conversion taking place if necessary. More... | |
U8BIT * | HBBTV_JSString_getString8 (void *obj) |
Return a string in HbbTV format but as UTF-8, with conversion taking place if necessary. More... | |
U8BIT * | HBBTV_JSStringGetStringLatin1 (void *obj, U32BIT *length) |
void | HBBTV_JSString_releaseString (U8BIT *utf_string) |
Release a Latin1, UTF-8 or UTF-16 string obtained using HBBTV_JSString_getStringX. More... | |
U32BIT | HBBTV_JSString_utf8ByteLen (void *obj) |
Return byte length of UTF-8 string, (conversion may be needed) This would be used prior to calling HBBTV_JSString_utf8CopyData() More... | |
void | HBBTV_JSString_utf8CopyData (void *obj, U8BIT *output) |
Fill output of UTF-8 string, (conversion may be needed) This would be used after calling HBBTV_JSString_utf8ByteLen() More... | |
U32BIT | HBBTV_JSString_strlen (void *obj) |
Returns the number of characters in the string. More... | |
void | HBBTV_JSStringSetFormat (E_HBBTV_STRING_FORMAT string_format) |
Saves the string format supported by the DVB stack. More... | |
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> | |
Variables | |
void * | JS_HBBTV_STRING_CLASS = &s_vtab |
String utility functions.
#define INC_UTF8_BYTES | ( | unicode, | |
bytes | |||
) |
U16BIT* HBBTV_JSString_getString16 | ( | void * | obj | ) |
Return a string in HbbTV UTF-16 format, with conversion taking place if necessary.
Returns a string in HbbTV UTF-16 format, with conversion taking place if necessary.
obj | - string object |
U8BIT* HBBTV_JSString_getString8 | ( | void * | obj | ) |
Return a string in HbbTV format but as UTF-8, with conversion taking place if necessary.
Returns a string in HbbTV UTF-8 format, with conversion taking place if necessary.
obj | - string object |
S_HBBTV_STRING HBBTV_JSString_getValue | ( | void * | obj | ) |
Return string's value.
Return string's value. The value is only valid while the string object is valid.
string | - the string object |
void HBBTV_JSString_releaseString | ( | U8BIT * | utf_string | ) |
Release a Latin1, UTF-8 or UTF-16 string obtained using HBBTV_JSString_getStringX.
Releases a UTF-8 or UTF-16 string obtained using HBBTV_JSString_getStringX.
string | - string |
U32BIT HBBTV_JSString_strlen | ( | void * | obj | ) |
Returns the number of characters in the string.
obj | String object |
U32BIT HBBTV_JSString_utf8ByteLen | ( | void * | obj | ) |
Return byte length of UTF-8 string, (conversion may be needed) This would be used prior to calling HBBTV_JSString_utf8CopyData()
Returns byte length of UTF-8 string (conversion may be needed). This would be used prior to calling HBBTV_JSString_utf8CopyData().
obj | - string object |
void HBBTV_JSString_utf8CopyData | ( | void * | obj, |
U8BIT * | output | ||
) |
Fill output of UTF-8 string, (conversion may be needed) This would be used after calling HBBTV_JSString_utf8ByteLen()
Fills output of UTF-8 string, (conversion may be needed). This would be used after calling HBBTV_JSString_utf8ByteLen().
obj | - string object |
output | - output buffer to copy UTF-8 data |
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.
obj | - string object |
str2 | - string to check against |
ignore_case | - FALSE if case sensitive search is to be performed |
BOOLEAN HBBTV_JSStringContains | ( | void * | obj, |
S_HBBTV_STRING * | str2, | ||
BOOLEAN | ignore_case | ||
) |
Checks whether the string object is a substring of str2.
obj | - string object to be searched for |
str2 | - string to search through |
ignore_case | - FALSE if case sensitive search is to be performed |
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.
value | - S_HBBTV_STRING containing the data for the string to be created |
format | - format of the string data in S_HBBTV_STRING |
void* HBBTV_JSStringCreateFromAscii | ( | U8BIT * | ascii_string | ) |
Create a string from an ASCII string.
ascii_string | - character data for the string to be created |
void* HBBTV_JSStringCreateFromUtf16 | ( | U16BIT * | utf_string | ) |
Create a string from a UTF-16 string.
utf_string | - character data for the string to be created |
void* HBBTV_JSStringCreateFromUtf8 | ( | U8BIT * | utf_string | ) |
Create a string from a UTF-8 string.
utf_string | - character data for the string to be created |
BOOLEAN HBBTV_JSStringEqual | ( | void * | obj, |
S_HBBTV_STRING * | str2, | ||
BOOLEAN | ignore_case | ||
) |
Check if two strings are the same.
obj | - the string object |
str2 | - the string to check |
ignore_case | - FALSE if case sensitive search should be performed |
void HBBTV_JSStringReplace | ( | void * | obj, |
S_HBBTV_STRING * | value | ||
) |
Replace string data with given data.
string | - the string object |
value | - the new string value |
void HBBTV_JSStringSetFormat | ( | E_HBBTV_STRING_FORMAT | string_format | ) |
Saves the string format supported by the DVB stack.
string_format | Format 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.
strlen | number of characters (excluding the string terminator) contained in data |
data | buffer containing the source string |
void HBBTV_StrFree | ( | S_HBBTV_STRING * | string | ) |
Frees the memory allocated for the specified S_HBBTV_STRING.
string | pointer to the S_HBBTV_STRING to be freed |