![]() |
![]() |
![]() |
WritRecogn Reference Manual | ![]() |
---|---|---|---|---|
RadicalArray* radicalArray_new (); RadicalArray* radicalArray_sized_new (guint reserved_size); RadicalType radicalArray_get_radicalType (RadicalArray *self); void radicalArray_set_radicalType (RadicalArray *self, RadicalType type); gpointer radicalArray_free (RadicalArray *self, gboolean free_segment); RadicalArray* radicalArray_clone (RadicalArray *self); void radicalArray_copy (RadicalArray *self, RadicalArray *src); void radicalArray_reset (RadicalArray *self); guint radicalArray_size (RadicalArray *self); void radicalArray_append (RadicalArray *self, Radical *rad); gboolean radicalArray_has_radicalCode (RadicalArray *self, RadicalCode code); Radical* radicalArray_index (RadicalArray *self, guint index); Radical* radicalArray_find_by_code (RadicalArray *self, RadicalCode rCode); gboolean radicalArray_is_empty (RadicalArray *self); gboolean radicalArray_foreach (RadicalArray *self, ForeachCallbackFunc func, gpointer userdata); void radicalArray_sort (RadicalArray *self, GCompareFunc func);
RadicalArray is an array of radical pointers. Unlike RadicalList, which only stores radicalCode, RadicalArray stores radical pointers. RadicalList is preferred when:
Huge set of radicals is expected.
The radical code is in UniCode.
Manipulate radicals through datafile.
Instead, RadicalArray is more suitable when:
Small set of radicals
Storing RawStrokes (whose radical code are usually negative)
Datafile is not necessary.
RadicalArray* radicalArray_new ();
Allocate a new radical array.
Returns : |
a new radical array |
RadicalArray* radicalArray_sized_new (guint reserved_size);
Allocate a new radical array with given size
|
size of new array |
Returns : |
a new radical array |
RadicalType radicalArray_get_radicalType (RadicalArray *self);
Get the RadicalType of Radical Array.
|
the radical array |
Returns : |
Radical type of self .
|
void radicalArray_set_radicalType (RadicalArray *self, RadicalType type);
Set the RadicalType of Radical Array.
|
the radical array |
|
type of the radical |
gpointer radicalArray_free (RadicalArray *self, gboolean free_segment);
Set the RadicalType of Radical Array.
|
the radical array |
|
|
Returns : |
RadicalArray* radicalArray_clone (RadicalArray *self);
Return deep-copied clone of the radical array.
Use radicalArray_free()
to free the returned clone.
|
the radical array |
Returns : |
A deep-copied clone of self
|
void radicalArray_copy (RadicalArray *self, RadicalArray *src);
Deep copy from source radical array .
|
the radical array |
|
the source radical array to be copied from. |
void radicalArray_reset (RadicalArray *self);
Reset the radical array by removing all elements.
|
the radical array |
guint radicalArray_size (RadicalArray *self);
Returns the number of radicals in the radical array.
|
the radical array |
Returns : |
number of radicals in the radical array |
void radicalArray_append (RadicalArray *self, Radical *rad);
Appends radical to radical array.
|
the radical array |
|
the radical to be appended. |
gboolean radicalArray_has_radicalCode (RadicalArray *self, RadicalCode code);
|
|
|
|
Returns : |
Radical* radicalArray_index (RadicalArray *self, guint index);
Returns the radical at given index.
|
the radical array |
|
|
Returns : |
the radical in self at index aindex .
|
Radical* radicalArray_find_by_code (RadicalArray *self, RadicalCode rCode);
Returns the first radical which has the specified code in radical array.
|
the radical array. |
|
the first radical with the same radical code |
Returns : |
the first radical which has radical code in radical array, NULL if not found. |
gboolean radicalArray_is_empty (RadicalArray *self);
Returns whether the radical array is empty.
|
the radical array. |
Returns : |
TRUE if self is either NULL or has no elements, FALSE otherwise.
|
gboolean radicalArray_foreach (RadicalArray *self, ForeachCallbackFunc func, gpointer userdata);
Perform a function for each element of the radical array.
|
the radical array. |
|
callback function to perform for each radical in self .
|
|
argument for passing to func .
|
Returns : |
TRUE if every radicals are treated; FALSE indicates the iteration is stopped midway. |
void radicalArray_sort (RadicalArray *self, GCompareFunc func);
Sort radicals according to the comparison callback function.
|
the radical array. |
|
comparison callback function for comparing two radicals. |