#include <sys/types.h>
Go to the source code of this file.
Functions | |
char * | ipod_string_new (void) |
Allocates a new zero-terminated string on the heap. | |
char * | ipod_string_new_from (const char *s) |
Allocates a new zero-terminated string on the heap copied from the given string. | |
char * | ipod_string_new_from_array (const char *s, size_t length) |
Allocates a new string on the heap created from an array of characters. | |
char * | ipod_string_set (char *s, const char *ss) |
Copy a string into an exising allocated string, resizing as necessary. | |
void | ipod_string_free (char *s) |
Free the string back to the heap. | |
char * | ipod_string_zero (char *s) |
Resize an existing string to an empty string. | |
char * | ipod_string_realloc (char *src, size_t length) |
Reallocate an existing string to hold the given length, plus the terminating null. | |
char * | ipod_string_append (char *src, const char *a) |
Append a string to an existing string. | |
void | ipod_string_replace_char (char *src, const char a, const char b) |
Destructively replace all instances of a with b in an existing string. | |
size_t | ipod_string_utf16_to_utf8_length (const char *src, size_t numChars) |
Calculate the number of bytes necessary for a UTF-8 encoding of an array of UTF-16LE characters. | |
size_t | ipod_string_utf16_to_utf8 (const char *src, size_t numChars, char *dst, size_t maxLen) |
Convert an array of UTF-16LE characters to UTF-8. | |
size_t | ipod_string_utf8_to_utf16_length (const char *s) |
Calculate the number of UTF-16LE characters in a null terminated UTF-8 string. | |
size_t | ipod_string_utf8_to_utf16 (const char *src, char *dst, size_t maxLen) |
Convert a string of UTF-8 characters into an array of UTF-16LE characters. | |
char * | ipod_string_utf8_from_utf16 (const char *src, size_t numChars) |
Convert an array of UTF-16LE characters to a UTF-8 string allocated on the heap. | |
char * | ipod_string_utf16_from_utf8 (const char *src, size_t *numChars) |
Convert a UTF-8 encoded string to an array of UTF-16LE characters allocated on the heap. | |
char * | ipod_string_utf16_from_iso8859 (const char *src, size_t *numChars) |
Convert an ISO-8859-1 encoded string to an array of UTF-16LE characters allocated on the heap. | |
char * | ipod_string_iso8859_from_utf16 (const char *src, size_t numChars) |
Convert an array of UTF-16LE characters to an ISO-8859-1 string allocated on the heap. | |
char * | ipod_string_utf8_from_iso8859 (const char *src) |
Convert a string of ISO-8859-1 characters to UTF-8. | |
char * | ipod_string_iso8859_from_utf8 (const char *src) |
Convert a string of UTF-8 characters to ISO-8859-1. | |
int | ipod_string_compare_utf16 (const char *a, size_t numCharsA, const char *b, size_t numCharsB) |
Compare two arrays of UTF-16LE characters. | |
void | ipod_string_report (void) |
Print out some internal statistics. |
The iPod data structures store text in a variety of formats. The bulk of the text items are stored in UTF-16LE, but some are in either ASCII or UTF-8. The libipod API normalizes all of them to UTF-8, although the C++ binding will also support ISO-8859-1.
char* ipod_string_append | ( | char * | src, | |
const char * | a | |||
) |
Append a string to an existing string.
src | the string to wich to append | |
a | the string to append |
int ipod_string_compare_utf16 | ( | const char * | a, | |
size_t | numCharsA, | |||
const char * | b, | |||
size_t | numCharsB | |||
) |
Compare two arrays of UTF-16LE characters.
a | a pointer to an array of UTF-16LE characters | |
numCharsA | the number of characters in 'a' | |
b | a pointer to an array of UTF-16LE characters | |
numCharsB | the number of characters in 'b' |
void ipod_string_free | ( | char * | s | ) |
Free the string back to the heap.
s | the string to free |
char* ipod_string_iso8859_from_utf16 | ( | const char * | src, | |
size_t | numChars | |||
) |
Convert an array of UTF-16LE characters to an ISO-8859-1 string allocated on the heap.
src | pointer to an array of UTF-16LE characters | |
numChars | the number of characters in the UTF-16LE array |
char* ipod_string_iso8859_from_utf8 | ( | const char * | src | ) |
Convert a string of UTF-8 characters to ISO-8859-1.
src | a string of UTF-8 characters |
char* ipod_string_new | ( | void | ) |
Allocates a new zero-terminated string on the heap.
char* ipod_string_new_from | ( | const char * | s | ) |
Allocates a new zero-terminated string on the heap copied from the given string.
s | the string to copy |
char* ipod_string_new_from_array | ( | const char * | s, | |
size_t | length | |||
) |
Allocates a new string on the heap created from an array of characters.
s | a pointer to an array of characters | |
length | the number of characters in the array |
char* ipod_string_realloc | ( | char * | src, | |
size_t | length | |||
) |
Reallocate an existing string to hold the given length, plus the terminating null.
src | the string to resize | |
length | the new lenght for the string |
void ipod_string_replace_char | ( | char * | src, | |
const char | a, | |||
const char | b | |||
) |
Destructively replace all instances of a with b in an existing string.
src | the strin to modify | |
a | the character to replace | |
b | the character with which to replace |
char* ipod_string_set | ( | char * | s, | |
const char * | ss | |||
) |
Copy a string into an exising allocated string, resizing as necessary.
s | the string to copy into | |
ss | the string to copy from |
char* ipod_string_utf16_from_iso8859 | ( | const char * | src, | |
size_t * | numChars | |||
) |
Convert an ISO-8859-1 encoded string to an array of UTF-16LE characters allocated on the heap.
src | the null terminated string of ISO-8859-1 characters | |
numChars | a pointer to location to store the number of characters in the array of UTF-16LE characters |
char* ipod_string_utf16_from_utf8 | ( | const char * | src, | |
size_t * | numChars | |||
) |
Convert a UTF-8 encoded string to an array of UTF-16LE characters allocated on the heap.
src | the null terminated string of UTF-8 characters | |
numChars | a pointer to location to store the number of characters in the array of UTF-16LE characters |
size_t ipod_string_utf16_to_utf8 | ( | const char * | src, | |
size_t | numChars, | |||
char * | dst, | |||
size_t | maxLen | |||
) |
Convert an array of UTF-16LE characters to UTF-8.
src | pointer to the array of UTF-16LE characters | |
numChars | the number of characters in the UTF-16BE array | |
dst | pointer to the buffer to stored the converted characters | |
maxLen | the maximum number of bytes to store in the destination buffer |
size_t ipod_string_utf16_to_utf8_length | ( | const char * | src, | |
size_t | numChars | |||
) |
Calculate the number of bytes necessary for a UTF-8 encoding of an array of UTF-16LE characters.
src | pointer to the array of UTF-16LE characters | |
numChars | the number of characters in the UTF-16BE array |
char* ipod_string_utf8_from_iso8859 | ( | const char * | src | ) |
Convert a string of ISO-8859-1 characters to UTF-8.
src | a string of UTF-8 characters |
char* ipod_string_utf8_from_utf16 | ( | const char * | src, | |
size_t | numChars | |||
) |
Convert an array of UTF-16LE characters to a UTF-8 string allocated on the heap.
src | pointer to an array of UTF-16LE characters | |
numChars | the number of characters in the UTF-16LE array |
size_t ipod_string_utf8_to_utf16 | ( | const char * | src, | |
char * | dst, | |||
size_t | maxLen | |||
) |
Convert a string of UTF-8 characters into an array of UTF-16LE characters.
src | pointer to string or UTF-8 characters | |
dst | pointer to buffer in which to store the UTF-16LE characters | |
maxLen | the maximum number of UTF-16LE characters to store |
size_t ipod_string_utf8_to_utf16_length | ( | const char * | s | ) |
Calculate the number of UTF-16LE characters in a null terminated UTF-8 string.
s | a pointer to a null-terminated UTF-8 string |
char* ipod_string_zero | ( | char * | s | ) |
Resize an existing string to an empty string.
s | the string to empty |