ICU 50.1.2
50.1.2
|
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. More... | |
typedef struct BMS | BMS |
Functions | |
UCD * | ucd_open (UCollator *coll, UErrorCode *status) |
Open a UCD object. More... | |
void | ucd_close (UCD *ucd) |
Release a UCD object. More... | |
UCollator * | ucd_getCollator (UCD *ucd) |
Get the UCollator object used to create a UCD object. More... | |
void | ucd_freeCache () |
UCD objects are expensive to compute, and so may be cached. More... | |
void | ucd_flushCache () |
UCD objects are expensive to compute, and so may be cached. More... | |
BMS * | bms_open (UCD *ucd, const UChar *pattern, int32_t patternLength, const UChar *target, int32_t targetLength, UErrorCode *status) |
Construct a MBS object. More... | |
void | bms_close (BMS *bms) |
Close a BMS object and release all the storage associated with it. More... | |
UBool | bms_empty (BMS *bms) |
Test the pattern to see if it generates any CEs. More... | |
UCD * | bms_getData (BMS *bms) |
Get the UCD object used to create a given BMS object. More... | |
UBool | bms_search (BMS *bms, int32_t offset, int32_t *start, int32_t *end) |
Search for the pattern string in the target string. More... | |
void | bms_setTargetString (BMS *bms, const UChar *target, int32_t targetLength, UErrorCode *status) |
Set the target string for the match. More... | |
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
void bms_close | ( | BMS * | bms | ) |
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 CEsGet the UCD
object used to create a given BMS
object.
bms | - the BMS object |
UCD
object used to create the given BMS
object.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.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. |
void ucd_close | ( | UCD * | ucd | ) |
Release a UCD
object.
ucd | - the object |
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.
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.
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.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
.