DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
stbuni.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 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  *******************************************************************************/
25 #ifndef _STBUNI_H
26 
27 #define _STBUNI_H
28 
29 #include "techtype.h"
30 
31 
32 //---constant definitions---------------------------------------------------------------------------
33 
34 /*
35  * Convert the number of Unicode characters to the number of bytes for the Unicode string.
36  * I.e. (2*<NumberUnicodeChars>) + 1 byte header + 2 byte null terminator.
37  */
38 #define STB_UTF16_LEN_TO_BYTES_IN_STRING(x) (((x) *2) + 3)
39 #define INVALID_UNICODE_CHAR 0xFFFF // 0xFFFF is an invalid unicode char value
40 
41 //---typedefs-structs-enumerations------------------------------------------------------------------
42 
43 
44 //---function prototypes----------------------------------------------------------------------------
45 U8BIT* STB_SetUnicodeStringChar(U8BIT *string_ptr, U16BIT char_id, U16BIT code);
46 
47 U8BIT* STB_DeleteUnicodeStringChar(U8BIT *string_ptr, U16BIT char_id);
48 
49 U32BIT STB_GetUnicodeStringChar(U8BIT *string_ptr, U16BIT char_id);
50 
51 U8BIT* STB_ConcatUnicodeStrings(U8BIT *string1_ptr, U8BIT *string2_ptr);
52 
53 U8BIT* STB_UnicodeStringTokenise(U8BIT *str, U8BIT **save_ptr);
54 
55 U8BIT* STB_UnicodeStrStr(U8BIT *str1, U8BIT *str2, BOOLEAN ignore_case);
56 
57 S8BIT STB_CompareUnicodeStrings(U8BIT *string1_ptr, U8BIT *string2_ptr, BOOLEAN exact_match, BOOLEAN ignore_case);
58 
59 U8BIT* STB_ConvertStringToUnicode(U8BIT *string, BOOLEAN *reverse_dir, U16BIT *nchar,
60  BOOLEAN strip_DVB_cntrl_char, U32BIT lang_code);
61 U8BIT* STB_ConvertStringToUTF8(U8BIT *string, U16BIT *nchar, BOOLEAN strip_DVB_cntrl_char,
62  U32BIT lang_code);
63 
64 void STB_ReleaseUnicodeString(U8BIT *string);
65 
66 U8BIT* STB_ConvertUTF16toUTF8( U8BIT *src, U32BIT *outlen );
67 
68 BOOLEAN STB_IsUnicodeString(U8BIT *string_ptr);
69 
70 BOOLEAN STB_IsNormalString(U8BIT *string_ptr);
71 
72 U32BIT STB_GetNumBytesInString(U8BIT *string_ptr);
73 
74 BOOLEAN STB_IsUnicodeStringReversed(U8BIT *string_ptr);
75 
76 BOOLEAN STB_IsStringEmpty(U8BIT *string_ptr);
77 
84 void STB_SetDefaultAsciiTable(U8BIT table);
85 
86 S8BIT STB_CompareStringsIgnoreCase(U8BIT *string1_ptr, U8BIT *string2_ptr);
87 
88 U8BIT* STB_FormatUnicodeString( BOOLEAN strip_DVB_cntrl_char, BOOLEAN *reverse_dir, const U8BIT *const format_ptr, ... );
89 
90 U32BIT STB_UnicodeStringLen(U8BIT *string_ptr);
91 
92 U8BIT* STB_UnicodeInsertString(U8BIT *src_str, U16BIT insert_pos, U8BIT *insert_str, BOOLEAN replace_char);
93 
102 U8BIT* STB_UnicodeStripControlChars(U8BIT *string_ptr);
103 
104 #endif // _STBUNI_H
105 
106 //**************************************************************************************************
107 // End of File
108 //**************************************************************************************************
U8BIT * STB_ConvertStringToUnicode(U8BIT *string, BOOLEAN *reverse_dir, U16BIT *nchar, BOOLEAN strip_DVB_cntrl_char, U32BIT lang_code)
Converts the specified DVB coded string into a unicode string, counting the number of characters and ...
Definition: stbuni.c:1068
U8BIT * STB_SetUnicodeStringChar(U8BIT *string_ptr, U16BIT char_id, U16BIT code)
Takes a string and changes the requested location to a new value. This request may involve appending ...
Definition: stbuni.c:411
U8BIT * STB_UnicodeStrStr(U8BIT *str1, U8BIT *str2, BOOLEAN ignore_case)
Finds the first occurence of str2 in str1 and returns a pointer to the substring (as per strstr) ...
Definition: stbuni.c:787
BOOLEAN STB_IsUnicodeString(U8BIT *string_ptr)
Tests for unicode string.
Definition: stbuni.c:247
U8BIT * STB_UnicodeStringTokenise(U8BIT *str, U8BIT **save_ptr)
Divides the (space separated) string up into individual words and returns them one per call...
Definition: stbuni.c:722
U8BIT * STB_ConvertUTF16toUTF8(U8BIT *src, U32BIT *outlen)
Creates the given string from UTF-16 to UTF-8 and returns a new string. The returned string should be...
Definition: stbuni.c:1973
U32BIT STB_UnicodeStringLen(U8BIT *string_ptr)
Determines the length, in characters, of the given unicode string by searching for NULL...
Definition: stbuni.c:140
BOOLEAN STB_IsNormalString(U8BIT *string_ptr)
Tests for normal ascii string.
Definition: stbuni.c:280
U8BIT * STB_ConvertStringToUTF8(U8BIT *string, U16BIT *nchar, BOOLEAN strip_DVB_cntrl_char, U32BIT lang_code)
Converts the given DVB coded string into a UTF-8 unicode string. The returned string will be preceded...
Definition: stbuni.c:1507
BOOLEAN STB_IsStringEmpty(U8BIT *string_ptr)
Checks for a string of only spaces.
Definition: stbuni.c:2112
U8BIT * STB_UnicodeStripControlChars(U8BIT *string_ptr)
Strips the DVB control characters from a string that's already in UTF-8 or UTF-16 format...
Definition: stbuni.c:2791
S8BIT STB_CompareUnicodeStrings(U8BIT *string1_ptr, U8BIT *string2_ptr, BOOLEAN exact_match, BOOLEAN ignore_case)
Compares the contents of the two given unicode strings and returns the status (as per strcmp) ...
Definition: stbuni.c:909
void STB_ReleaseUnicodeString(U8BIT *string)
Releases the specified unicode string, freeing associated heap resources.
Definition: stbuni.c:1954
U8BIT * STB_DeleteUnicodeStringChar(U8BIT *string_ptr, U16BIT char_id)
Takes a string and removes the requested location, shuffling any following data down (thus removing g...
Definition: stbuni.c:476
U8BIT * STB_ConcatUnicodeStrings(U8BIT *string1_ptr, U8BIT *string2_ptr)
Appends the contents of string2_ptr to string1_ptr and returns a pointer to the newly created string...
Definition: stbuni.c:617
U32BIT STB_GetNumBytesInString(U8BIT *string_ptr)
Determines the no of bytes of the given string.
Definition: stbuni.c:310
BOOLEAN STB_IsUnicodeStringReversed(U8BIT *string_ptr)
Checks to see if the supplied string is unicode and if it is reversed (arabic)
Definition: stbuni.c:203
System Wide Global Technical Data Type Definitions.
S8BIT STB_CompareStringsIgnoreCase(U8BIT *string1_ptr, U8BIT *string2_ptr)
Compares the contents of the two given ASCII strings and returns the status (as per strcmp) but ignor...
Definition: stbuni.c:2182
U8BIT * STB_UnicodeInsertString(U8BIT *src_str, U16BIT insert_pos, U8BIT *insert_str, BOOLEAN replace_char)
Creates a new string by inserting one string into another at a given position, with the option of rep...
Definition: stbuni.c:2695
U32BIT STB_GetUnicodeStringChar(U8BIT *string_ptr, U16BIT char_id)
Retrieves the unicode value pointed to by char_id within the given string. If an invalid request occu...
Definition: stbuni.c:525
void STB_SetDefaultAsciiTable(U8BIT table)
Sets default ascii table to be used, if not overridden by the table index at the start of a string...
Definition: stbuni.c:2156
U8BIT * STB_FormatUnicodeString(BOOLEAN strip_DVB_cntrl_char, BOOLEAN *reverse_dir, const U8BIT *const format_ptr,...)
Unicode version of sprintf.
Definition: stbuni.c:2291