HTML-MyHTML
view release on metacpan or search on metacpan
source/myhtml/api.h view on Meta::CPAN
/**
* Convert Unicode Codepoint to UTF-16LE
*
* I advise not to use UTF-16! Use UTF-8 and be happy!
*
* @param[in] Codepoint
* @param[in] Data to set characters. Data length is 2 or 4 bytes
* data length must be always available 4 bytes
*
* @return size character set
*/
size_t
myhtml_encoding_codepoint_to_ascii_utf_16(size_t codepoint, char *data);
/**
* Detect character encoding
*
* Now available for detect UTF-8, UTF-16LE, UTF-16BE
* and Russians: windows-1251, koi8-r, iso-8859-5, x-mac-cyrillic, ibm866
* Other in progress
*
* @param[in] text
* @param[in] text length
* @param[out] detected encoding
*
* @return true if encoding found, otherwise false
*/
bool
myhtml_encoding_detect(const char *text, size_t length, myhtml_encoding_t *encoding);
/**
* Detect Russian character encoding
*
* Now available for detect windows-1251, koi8-r, iso-8859-5, x-mac-cyrillic, ibm866
*
* @param[in] text
* @param[in] text length
* @param[out] detected encoding
*
* @return true if encoding found, otherwise false
*/
bool
myhtml_encoding_detect_russian(const char *text, size_t length, myhtml_encoding_t *encoding);
/**
* Detect Unicode character encoding
*
* Now available for detect UTF-8, UTF-16LE, UTF-16BE
*
* @param[in] text
* @param[in] text length
* @param[out] detected encoding
*
* @return true if encoding found, otherwise false
*/
bool
myhtml_encoding_detect_unicode(const char *text, size_t length, myhtml_encoding_t *encoding);
/**
* Detect Unicode character encoding by BOM
*
* Now available for detect UTF-8, UTF-16LE, UTF-16BE
*
* @param[in] text
* @param[in] text length
* @param[out] detected encoding
*
* @return true if encoding found, otherwise false
*/
bool
myhtml_encoding_detect_bom(const char *text, size_t length, myhtml_encoding_t *encoding);
/**
* Detect Unicode character encoding by BOM. Cut BOM if will be found
*
* Now available for detect UTF-8, UTF-16LE, UTF-16BE
*
* @param[in] text
* @param[in] text length
* @param[out] detected encoding
* @param[out] new text position
* @param[out] new size position
*
* @return true if encoding found, otherwise false
*/
bool
myhtml_encoding_detect_and_cut_bom(const char *text, size_t length, myhtml_encoding_t *encoding,
const char **new_text, size_t *new_size);
/**
* Detect encoding by name
* Names like: windows-1258 return MyHTML_ENCODING_WINDOWS_1258
* cp1251 or windows-1251 return MyHTML_ENCODING_WINDOWS_1251
*
* See https://encoding.spec.whatwg.org/#names-and-labels
*
* @param[in] name
* @param[in] name length
* @param[out] detected encoding
*
* @return true if encoding found, otherwise false
*/
bool
myhtml_encoding_by_name(const char *name, size_t length, myhtml_encoding_t *encoding);
/***********************************************************************************
*
* MyHTML_STRING
*
***********************************************************************************/
/**
* Init myhtml_string_t structure
*
* @param[in] mchar_async_t*. It can be obtained from myhtml_tree_t object
* (see myhtml_tree_get_mchar function) or create manualy
* For each Tree creates its object, I recommend to use it (myhtml_tree_get_mchar).
*
* @param[in] node_id. For all threads (and Main thread) identifier that is unique.
* if created mchar_async_t object manually you know it, if not then take from the Tree
* (see myhtml_tree_get_mchar_node_id)
*
* @param[in] myhtml_string_t*. It can be obtained from myhtml_tree_node_t object
* (see myhtml_node_string function) or create manualy
*
* @param[in] data size. Set the size you want for char*
*
* @return char* of the size if successful, otherwise a NULL value
*/
char*
myhtml_string_init(mchar_async_t *mchar, size_t node_id,
myhtml_string_t* str, size_t size);
/**
( run in 2.628 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )