strpattern_analyze()

Schedule pattern matching for the given text.

Synopsis:

#include <strpattern.h>
 
long strpattern_analyze(UText *text, strpattern_analyze_callback_func callback, void *user_data, const strpattern_context *context, int *err)

Since:

BlackBerry 10.0.0

Arguments:

text

Text to be analyzed for pattern matches, wrapped as an ICU UText structure. Ownership is retained by the caller.

callback

The callback called to deliver the result of pattern matching (cannot be NULL).

user_data

User-defined data passed to the callback (can be NULL). Memory is managed by the client of this library.

context

The context used for the pattern matching (can be NULL). Ownership is retained by the caller.

err

STRPATTERN_EOK if there is no error.

Library:

libstrpattern (For the qcc command, use the -l strpattern option to link against this library)

Description:

This function analyzes the given string using data specified by the user and returns the results using the given callback function. The callback is called even if there are errors. The callback is not called if the pattern matching is canceled because of a call to strpattern_cancel() before the actual matching process has finished. Pattern matching may or may not run in the calling function's thread. For strings with short length (native length less than 10), pattern matching is normally run in the calling function's thread.

The text must not be modified in another thread such as during the execution of this function.

Note: The callback may be run in a separate thread. Make sure that any data access and function calls from inside the callback are done in a thread-safe way by using locks when appropriate.

Each method call returns a unique ID. This ID can be used to cancel the corresponding pattern matching using a call to strpattern_cancel().

Returns:

A unique ID assigned to this pattern matching call.

Last modified: 2014-05-14



Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus