ICU 69.1  69.1
icuplug.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 *
6 * Copyright (C) 2009-2015, International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 ******************************************************************************
10 *
11 * FILE NAME : icuplug.h
12 *
13 * Date Name Description
14 * 10/29/2009 sl New.
15 ******************************************************************************
16 */
17 
107 #ifndef ICUPLUG_H
108 #define ICUPLUG_H
109 
110 #include "unicode/utypes.h"
111 
112 
113 #if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN)
114 
115 
116 
117 /* === Basic types === */
118 
119 #ifndef U_HIDE_INTERNAL_API
120 struct UPlugData;
127 typedef struct UPlugData UPlugData;
128 
136 #define UPLUG_TOKEN 0x54762486
137 
142 #define UPLUG_NAME_MAX 100
143 
144 
151 typedef uint32_t UPlugTokenReturn;
152 
157 typedef enum {
166 } UPlugReason;
167 
168 
176 typedef enum {
186 } UPlugLevel;
187 
195 typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
196  UPlugData *plug,
197  UPlugReason reason,
198  UErrorCode *status);
199 
200 /* === Needed for Implementing === */
201 
210 U_CAPI void U_EXPORT2
211 uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
212 
219 U_CAPI void U_EXPORT2
221 
228 U_CAPI UPlugLevel U_EXPORT2
230 
238 U_CAPI UPlugLevel U_EXPORT2
240 
241 
247 U_CAPI UErrorCode U_EXPORT2
249 
256 U_CAPI void U_EXPORT2
257 uplug_setPlugName(UPlugData *plug, const char *name);
258 
265 U_CAPI const char * U_EXPORT2
267 
274 U_CAPI const char * U_EXPORT2
276 
284 U_CAPI const char * U_EXPORT2
286 
294 U_CAPI void * U_EXPORT2
296 
303 U_CAPI void * U_EXPORT2
305 
312 U_CAPI void U_EXPORT2
313 uplug_setContext(UPlugData *plug, void *context);
314 
315 
323 U_CAPI const char * U_EXPORT2
325 
341 U_CAPI UPlugData* U_EXPORT2
342 uplug_nextPlug(UPlugData *prior);
343 
356 U_CAPI UPlugData* U_EXPORT2
357 uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status);
358 
359 
370 U_CAPI UPlugData* U_EXPORT2
371 uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
372 
380 U_CAPI void U_EXPORT2
381 uplug_removePlug(UPlugData *plug, UErrorCode *status);
382 #endif /* U_HIDE_INTERNAL_API */
383 
384 #endif /* UCONFIG_ENABLE_PLUGINS */
385 
386 #endif /* _ICUPLUG */
387 
The plugin is waiting to be installed.
Definition: icuplug.h:178
U_CAPI UErrorCode uplug_getPlugLoadStatus(UPlugData *plug)
Get plug load status.
U_CAPI UPlugData * uplug_nextPlug(UPlugData *prior)
Return all currently installed plugins, from newest to oldest Usage Example:
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
U_CAPI UPlugLevel uplug_getCurrentLevel(void)
Get the lowest level of plug which can currently load.
The plugin is invalid, hasn't called uplug_setLevel, or can't load.
Definition: icuplug.h:177
UPlugReason
Reason code for the entrypoint's call.
Definition: icuplug.h:157
U_CAPI void * uplug_getLibrary(UPlugData *plug)
Return the library used for this plugin, if known.
uint32_t UPlugTokenReturn
Return value from a plugin entrypoint.
Definition: icuplug.h:151
U_CAPI void uplug_removePlug(UPlugData *plug, UErrorCode *status)
Remove a plugin.
The plugin can run at any time.
Definition: icuplug.h:180
The plugin must be called before u_init completes.
Definition: icuplug.h:179
U_CAPI void * uplug_getContext(UPlugData *plug)
Return the plugin-specific context data.
U_CAPI const char * uplug_getConfiguration(UPlugData *plug)
Get the configuration string, if available.
U_CAPI const char * uplug_getLibraryName(UPlugData *plug, UErrorCode *status)
Return the library name for this plugin, if known.
UPlugLevel
Level of plugin loading INITIAL: UNKNOWN QUERY: INVALID -> { LOW | HIGH } ERR -> INVALID.
Definition: icuplug.h:176
U_CAPI const char * uplug_getSymbolName(UPlugData *plug)
Return the symbol name for this plugin, if known.
The plugin is being unloaded.
Definition: icuplug.h:160
U_CAPI UPlugLevel uplug_getPlugLevel(UPlugData *plug)
Get the level of this plugin.
U_CAPI void uplug_setPlugLevel(UPlugData *plug, UPlugLevel level)
Set the level of this plugin.
U_CAPI UPlugData * uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status)
Inject a plugin as if it were loaded from a library.
Number of known levels.
Definition: icuplug.h:185
U_CAPI void uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload)
Request that this plugin not be unloaded at cleanup time.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
The plugin is being loaded.
Definition: icuplug.h:159
UPlugTokenReturn( UPlugEntrypoint)(UPlugData *plug, UPlugReason reason, UErrorCode *status)
Entrypoint for an ICU plugin.
Definition: icuplug.h:195
The plugin is being queried for info.
Definition: icuplug.h:158
Basic definitions for ICU, for both C and C++ APIs.
Number of known reasons.
Definition: icuplug.h:165
U_CAPI const char * uplug_getPlugName(UPlugData *plug)
Get the human-readable name of this plugin.
U_CAPI void uplug_setContext(UPlugData *plug, void *context)
Set the plugin-specific context data.
U_CAPI UPlugData * uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status)
Inject a plugin from a library, as if the information came from a config file.
U_CAPI void uplug_setPlugName(UPlugData *plug, const char *name)
Set the human-readable name of this plugin.
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
struct UPlugData UPlugData
Typedef for opaque structure passed to/from a plugin.
Definition: icuplug.h:127