ICU 4.8.1.1
4.8.1.1
|
C API: Boyer-Moore StringSearch prototype. More...
Go to the source code of this file.
Typedefs | |
typedef void | UCD |
A UCD object holds the Collator-specific data needed to compute the length of the shortest string that can generate a partcular list of CEs. | |
typedef struct BMS | BMS |
Functions | |
U_CAPI UCD * | ucd_open (UCollator *coll, UErrorCode *status) |
Open a UCD object. | |
U_CAPI void | ucd_close (UCD *ucd) |
Release a UCD object. | |
U_CAPI UCollator * | ucd_getCollator (UCD *ucd) |
Get the UCollator object used to create a UCD object. | |
U_CAPI void | ucd_freeCache () |
UCD objects are expensive to compute, and so may be cached. | |
U_CAPI void | ucd_flushCache () |
UCD objects are expensive to compute, and so may be cached. | |
U_CAPI BMS * | bms_open (UCD *ucd, const UChar *pattern, int32_t patternLength, const UChar *target, int32_t targetLength, UErrorCode *status) |
Construct a MBS object. | |
U_CAPI void | bms_close (BMS *bms) |
Close a BMS object and release all the storage associated with it. | |
U_CAPI UBool | bms_empty (BMS *bms) |
Test the pattern to see if it generates any CEs. | |
U_CAPI UCD * | bms_getData (BMS *bms) |
Get the UCD object used to create a given BMS object. | |
U_CAPI UBool | bms_search (BMS *bms, int32_t offset, int32_t *start, int32_t *end) |
Search for the pattern string in the target string. | |
U_CAPI void | bms_setTargetString (BMS *bms, const UChar *target, int32_t targetLength, UErrorCode *status) |
Set the target string for the match. |
C API: Boyer-Moore StringSearch prototype.
Definition in file bms.h.
typedef void UCD |
A UCD
object holds the Collator-specific data needed to compute the length of the shortest string that can generate a partcular list of CEs.
UCD
objects are quite expensive to compute. Because of this, they are cached. When you call ucd_open
it returns a reference counted cached object. When you call ucd_close
the reference count on the object is decremented but the object is not deleted.
If you do not need to reuse any unreferenced objects in the cache, you can call ucd_flushCCache
. If you no longer need any UCD
objects, you can call ucd_freeCache
Close a BMS
object and release all the storage associated with it.
bms | - the BMS object to close. |
Test the pattern to see if it generates any CEs.
bms | - the BMS object |
TRUE
if the pattern string did not generate any CEsU_CAPI UCD* bms_getData | ( | BMS * | bms | ) |
Get the UCD
object used to create a given BMS
object.
bms | - the BMS object |
UCD
object used to create the given BMS
object.U_CAPI BMS* bms_open | ( | UCD * | ucd, |
const UChar * | pattern, | ||
int32_t | patternLength, | ||
const UChar * | target, | ||
int32_t | targetLength, | ||
UErrorCode * | status | ||
) |
Construct a MBS
object.
ucd | - A UCD object holding the Collator-sensitive data |
pattern | - the string for which to search |
patternLength | - the length of the string for which to search |
target | - the string in which to search |
targetLength | - the length of the string in which to search |
status | - will be set if any errors occur. |
BMS
object.Note: if on return status is set to an error, the only safe thing to do with the returned object is to call bms_close
.
Search for the pattern string in the target string.
bms | - the BMS object |
offset | - the offset in the target string at which to begin the search |
start | - will be set to the starting offset of the match, or -1 if there's no match |
end | - will be set to the ending offset of the match, or -1 if there's no match |
TRUE
if the match succeeds, FALSE
otherwise.U_CAPI void bms_setTargetString | ( | BMS * | bms, |
const UChar * | target, | ||
int32_t | targetLength, | ||
UErrorCode * | status | ||
) |
Set the target string for the match.
bms | - the BMS object |
target | - the new target string |
targetLength | - the length of the new target string |
status | - will be set if any errors occur. |
Release a UCD
object.
ucd | - the object |
U_CAPI void ucd_flushCache | ( | ) |
UCD
objects are expensive to compute, and so may be cached.
This routine will remove any unused UCD
objects from the cache.
U_CAPI void ucd_freeCache | ( | ) |
UCD
objects are expensive to compute, and so may be cached.
This routine will free the cached objects and delete the cache.
WARNING: Don't call this until you are have called close
for each UCD
object that you have used. also, DO NOT call this if another thread may be calling ucd_flushCache
at the same time.
U_CAPI UCollator* ucd_getCollator | ( | UCD * | ucd | ) |
Get the UCollator
object used to create a UCD
object.
The UCollator
object returned may not be the exact object that was used to create this object, but it will have the same behavior.
ucd | - the UCD object |
UCollator
used to create the given UCD
object.U_CAPI UCD* ucd_open | ( | UCollator * | coll, |
UErrorCode * | status | ||
) |
Open a UCD
object.
coll | - the collator |
status | - will be set if any errors occur. |
UCD
object. You must call ucd_close
when you are done using the object.Note: if on return status is set to an error, the only safe thing to do with the returned object is to call ucd_close
.