ICU 65.1 65.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
127 struct UPlugData;
128 typedef struct UPlugData UPlugData;
129
137 #define UPLUG_TOKEN 0x54762486
138
143 #define UPLUG_NAME_MAX 100
144
145
152 typedef uint32_t UPlugTokenReturn;
153
158 typedef enum {
159 UPLUG_REASON_QUERY = 0,
160 UPLUG_REASON_LOAD = 1,
161 UPLUG_REASON_UNLOAD = 2,
166 UPLUG_REASON_COUNT
167 } UPlugReason;
168
169
177 typedef enum {
178 UPLUG_LEVEL_INVALID = 0,
179 UPLUG_LEVEL_UNKNOWN = 1,
180 UPLUG_LEVEL_LOW = 2,
181 UPLUG_LEVEL_HIGH = 3,
186 UPLUG_LEVEL_COUNT
187 } UPlugLevel;
188
196 typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
197 UPlugData *plug,
198 UPlugReason reason,
199 UErrorCode *status);
200
201 /* === Needed for Implementing === */
202
211 U_INTERNAL void U_EXPORT2
212 uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
213
220 U_INTERNAL void U_EXPORT2
221 uplug_setPlugLevel(UPlugData *plug, UPlugLevel level);
222
229 U_INTERNAL UPlugLevel U_EXPORT2
230 uplug_getPlugLevel(UPlugData *plug);
231
239 U_INTERNAL UPlugLevel U_EXPORT2
240 uplug_getCurrentLevel(void);
241
242
248 U_INTERNAL UErrorCode U_EXPORT2
249 uplug_getPlugLoadStatus(UPlugData *plug);
250
257 U_INTERNAL void U_EXPORT2
258 uplug_setPlugName(UPlugData *plug, const char *name);
259
266 U_INTERNAL const char * U_EXPORT2
267 uplug_getPlugName(UPlugData *plug);
268
275 U_INTERNAL const char * U_EXPORT2
276 uplug_getSymbolName(UPlugData *plug);
277
285 U_INTERNAL const char * U_EXPORT2
286 uplug_getLibraryName(UPlugData *plug, UErrorCode *status);
287
295 U_INTERNAL void * U_EXPORT2
296 uplug_getLibrary(UPlugData *plug);
297
304 U_INTERNAL void * U_EXPORT2
305 uplug_getContext(UPlugData *plug);
306
313 U_INTERNAL void U_EXPORT2
314 uplug_setContext(UPlugData *plug, void *context);
315
316
324 U_INTERNAL const char * U_EXPORT2
325 uplug_getConfiguration(UPlugData *plug);
326
342 U_INTERNAL UPlugData* U_EXPORT2
343 uplug_nextPlug(UPlugData *prior);
344
357 U_INTERNAL UPlugData* U_EXPORT2
358 uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status);
359
360
371 U_INTERNAL UPlugData* U_EXPORT2
372 uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
373
381 U_INTERNAL void U_EXPORT2
382 uplug_removePlug(UPlugData *plug, UErrorCode *status);
383 #endif /* U_HIDE_INTERNAL_API */
384
385 #endif /* UCONFIG_ENABLE_PLUGINS */
386
387 #endif /* _ICUPLUG */
388
UPLUG_LEVEL_UNKNOWN
The plugin is waiting to be installed.
Definition: icuplug.h:179
uplug_getLibrary
void * uplug_getLibrary(UPlugData *plug)
Return the library used for this plugin, if known.
uplug_getSymbolName
const char * uplug_getSymbolName(UPlugData *plug)
Return the symbol name for this plugin, if known.
UPLUG_LEVEL_INVALID
The plugin is invalid, hasn&#39;t called uplug_setLevel, or can&#39;t load.
Definition: icuplug.h:178
uplug_nextPlug
UPlugData * uplug_nextPlug(UPlugData *prior)
Return all currently installed plugins, from newest to oldest Usage Example:
UPlugReason
UPlugReason
Reason code for the entrypoint&#39;s call.
Definition: icuplug.h:158
U_INTERNAL
#define U_INTERNAL
This is used to declare a function as an internal ICU C API.
Definition: umachine.h:119
uplug_setPlugName
void uplug_setPlugName(UPlugData *plug, const char *name)
Set the human-readable name of this plugin.
UPlugTokenReturn
uint32_t UPlugTokenReturn
Return value from a plugin entrypoint.
Definition: icuplug.h:152
uplug_getPlugLoadStatus
UErrorCode uplug_getPlugLoadStatus(UPlugData *plug)
Get plug load status.
UPLUG_LEVEL_HIGH
The plugin can run at any time.
Definition: icuplug.h:181
UPLUG_LEVEL_LOW
The plugin must be called before u_init completes.
Definition: icuplug.h:180
uplug_loadPlugFromLibrary
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.
uplug_getConfiguration
const char * uplug_getConfiguration(UPlugData *plug)
Get the configuration string, if available.
uplug_loadPlugFromEntrypoint
UPlugData * uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status)
Inject a plugin as if it were loaded from a library.
uplug_setPlugLevel
void uplug_setPlugLevel(UPlugData *plug, UPlugLevel level)
Set the level of this plugin.
UPlugLevel
UPlugLevel
Level of plugin loading INITIAL: UNKNOWN QUERY: INVALID -> { LOW | HIGH } ERR -> INVALID.
Definition: icuplug.h:177
uplug_getContext
void * uplug_getContext(UPlugData *plug)
Return the plugin-specific context data.
uplug_getCurrentLevel
UPlugLevel uplug_getCurrentLevel(void)
Get the lowest level of plug which can currently load.
UPLUG_REASON_UNLOAD
The plugin is being unloaded.
Definition: icuplug.h:161
uplug_getPlugLevel
UPlugLevel uplug_getPlugLevel(UPlugData *plug)
Get the level of this plugin.
UPlugEntrypoint
UPlugTokenReturn() UPlugEntrypoint(UPlugData *plug, UPlugReason reason, UErrorCode *status)
Entrypoint for an ICU plugin.
Definition: icuplug.h:196
uplug_setPlugNoUnload
void uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload)
Request that this plugin not be unloaded at cleanup time.
UPLUG_LEVEL_COUNT
Number of known levels.
Definition: icuplug.h:186
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
uplug_getPlugName
const char * uplug_getPlugName(UPlugData *plug)
Get the human-readable name of this plugin.
uplug_removePlug
void uplug_removePlug(UPlugData *plug, UErrorCode *status)
Remove a plugin.
UPLUG_REASON_LOAD
The plugin is being loaded.
Definition: icuplug.h:160
uplug_setContext
void uplug_setContext(UPlugData *plug, void *context)
Set the plugin-specific context data.
UPLUG_REASON_QUERY
The plugin is being queried for info.
Definition: icuplug.h:159
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
uplug_getLibraryName
const char * uplug_getLibraryName(UPlugData *plug, UErrorCode *status)
Return the library name for this plugin, if known.
UPLUG_REASON_COUNT
Number of known reasons.
Definition: icuplug.h:166
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261