# bms.h File Reference

C API: Boyer-Moore StringSearch prototype. More...

`#include "unicode/utypes.h"`
`#include "unicode/ucol.h"`

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.

## Detailed Description

C API: Boyer-Moore StringSearch prototype.

Internal:
  Do not use. This API is for internal use only.

Definition in file bms.h.

## Typedef Documentation

typedef struct BMS BMS

See also:
  BMS

Definition at line 183 of 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`

Definition at line 35 of file bms.h.

## Function Documentation

U_CAPI void bms_close | ( | BMS * | bms | ) |

Close a `BMS` object and release all the storage associated with it.

Parameters:

  | bms | - the `BMS` object to close.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

U_CAPI UBool bms_empty | ( | BMS * | bms | ) |

Test the pattern to see if it generates any CEs.

Parameters:

  | bms | - the `BMS` object

Returns:
  `TRUE` if the pattern string did not generate any CEs

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

U_CAPI UCD* bms_getData | ( | BMS * | bms | ) |

Get the `UCD` object used to create a given `BMS` object.

Parameters:

  | bms | - the `BMS` object

Returns:
  - the `UCD` object used to create the given `BMS` object.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

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.

Parameters:

  | 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.

Returns:
  the `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`.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

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.

Parameters:

  | 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

Returns:
  `TRUE` if the match succeeds, `FALSE` otherwise.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

U_CAPI void bms_setTargetString | ( | BMS * | bms,
|  | const UChar * | target,
|  | int32_t | targetLength,
|  | UErrorCode * | status |
| ) |  |  |

Set the target string for the match.

Parameters:

  | 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.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

U_CAPI void ucd_close | ( | UCD * | ucd | ) |

Release a `UCD` object.

Parameters:

  | ucd | - the object

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

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.

Internal:
  Do not use. This API is for internal use only. 4.0.1 technology preview

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.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

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.

Parameters:

  | ucd | - the `UCD` object

Returns:
  the `UCollator` used to create the given `UCD` object.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

U_CAPI UCD* ucd_open | ( | UCollator * | coll,
|  | UErrorCode * | status |
| ) |  |  |

Open a `UCD` object.

Parameters:

  | coll | - the collator
  | status | - will be set if any errors occur.

Returns:
  the `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`.

Internal:
  Do not use. This API is for internal use only. ICU 4.0.1 technology preview

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines