icuplug.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
******************************************************************************
*
* Copyright (C) 2009-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*
******************************************************************************
*
* FILE NAME : icuplug.h
*
* Date Name Description
* 10/29/2009 sl New.
******************************************************************************
*/
#ifndef ICUPLUG_H
#define ICUPLUG_H
#include "unicode/utypes.h"
#if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN)
/* === Basic types === */
#ifndef U_HIDE_INTERNAL_API
struct UPlugData;
typedef struct UPlugData UPlugData;
#define UPLUG_TOKEN 0x54762486
#define UPLUG_NAME_MAX 100
typedef uint32_t UPlugTokenReturn;
typedef enum {
UPLUG_REASON_QUERY = 0,
UPLUG_REASON_LOAD = 1,
UPLUG_REASON_UNLOAD = 2,
UPLUG_REASON_COUNT
} UPlugReason;
typedef enum {
UPLUG_LEVEL_INVALID = 0,
UPLUG_LEVEL_UNKNOWN = 1,
UPLUG_LEVEL_LOW = 2,
UPLUG_LEVEL_HIGH = 3,
UPLUG_LEVEL_COUNT
} UPlugLevel;
typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
UPlugData *plug,
UPlugReason reason,
UErrorCode *status);
/* === Needed for Implementing === */
U_CAPI void U_EXPORT2
uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
U_CAPI void U_EXPORT2
uplug_setPlugLevel(UPlugData *plug, UPlugLevel level);
U_CAPI UPlugLevel U_EXPORT2
uplug_getPlugLevel(UPlugData *plug);
U_CAPI UPlugLevel U_EXPORT2
uplug_getCurrentLevel(void);
U_CAPI UErrorCode U_EXPORT2
uplug_getPlugLoadStatus(UPlugData *plug);
U_CAPI void U_EXPORT2
uplug_setPlugName(UPlugData *plug, const char *name);
U_CAPI const char * U_EXPORT2
uplug_getPlugName(UPlugData *plug);
U_CAPI const char * U_EXPORT2
uplug_getSymbolName(UPlugData *plug);
U_CAPI const char * U_EXPORT2
uplug_getLibraryName(UPlugData *plug, UErrorCode *status);
U_CAPI void * U_EXPORT2
uplug_getLibrary(UPlugData *plug);
U_CAPI void * U_EXPORT2
uplug_getContext(UPlugData *plug);
U_CAPI void U_EXPORT2
uplug_setContext(UPlugData *plug, void *context);
U_CAPI const char * U_EXPORT2
uplug_getConfiguration(UPlugData *plug);
U_CAPI UPlugData* U_EXPORT2
uplug_nextPlug(UPlugData *prior);
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status);
U_CAPI UPlugData* U_EXPORT2
uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
U_CAPI void U_EXPORT2
uplug_removePlug(UPlugData *plug, UErrorCode *status);
#endif /* U_HIDE_INTERNAL_API */
#endif /* UCONFIG_ENABLE_PLUGINS */
#endif /* _ICUPLUG */
UPlugTokenReturn
uint32_t UPlugTokenReturn
Return value from a plugin entrypoint.
Definition: icuplug.h:151
uplug_getLibrary
U_CAPI void * uplug_getLibrary(UPlugData *plug)
Return the library used for this plugin, if known.
UPlugReason
UPlugReason
Reason code for the entrypoint's call.
Definition: icuplug.h:157
UPLUG_REASON_COUNT
@ UPLUG_REASON_COUNT
Number of known reasons.
Definition: icuplug.h:165
UPLUG_REASON_LOAD
@ UPLUG_REASON_LOAD
The plugin is being loaded.
Definition: icuplug.h:159
UPLUG_REASON_UNLOAD
@ UPLUG_REASON_UNLOAD
The plugin is being unloaded.
Definition: icuplug.h:160
UPLUG_REASON_QUERY
@ UPLUG_REASON_QUERY
The plugin is being queried for info.
Definition: icuplug.h:158
uplug_removePlug
U_CAPI void uplug_removePlug(UPlugData *plug, UErrorCode *status)
Remove a plugin.
uplug_setContext
U_CAPI void uplug_setContext(UPlugData *plug, void *context)
Set the plugin-specific context data.
UPlugEntrypoint
UPlugTokenReturn() UPlugEntrypoint(UPlugData *plug, UPlugReason reason, UErrorCode *status)
Entrypoint for an ICU plugin.
Definition: icuplug.h:199
uplug_getConfiguration
U_CAPI const char * uplug_getConfiguration(UPlugData *plug)
Get the configuration string, if available.
UPlugData
struct UPlugData UPlugData
Typedef for opaque structure passed to/from a plugin.
Definition: icuplug.h:127
uplug_setPlugName
U_CAPI void uplug_setPlugName(UPlugData *plug, const char *name)
Set the human-readable name of this plugin.
uplug_getLibraryName
U_CAPI const char * uplug_getLibraryName(UPlugData *plug, UErrorCode *status)
Return the library name for this plugin, if known.
uplug_setPlugLevel
U_CAPI void uplug_setPlugLevel(UPlugData *plug, UPlugLevel level)
Set the level of this plugin.
uplug_loadPlugFromEntrypoint
U_CAPI UPlugData * uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status)
Inject a plugin as if it were loaded from a library.
uplug_nextPlug
U_CAPI UPlugData * uplug_nextPlug(UPlugData *prior)
Return all currently installed plugins, from newest to oldest Usage Example:
uplug_getPlugName
U_CAPI const char * uplug_getPlugName(UPlugData *plug)
Get the human-readable name of this plugin.
uplug_getPlugLevel
U_CAPI UPlugLevel uplug_getPlugLevel(UPlugData *plug)
Get the level of this plugin.
uplug_setPlugNoUnload
U_CAPI void uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload)
Request that this plugin not be unloaded at cleanup time.
uplug_getContext
U_CAPI void * uplug_getContext(UPlugData *plug)
Return the plugin-specific context data.
uplug_getPlugLoadStatus
U_CAPI UErrorCode uplug_getPlugLoadStatus(UPlugData *plug)
Get plug load status.
uplug_getCurrentLevel
U_CAPI UPlugLevel uplug_getCurrentLevel(void)
Get the lowest level of plug which can currently load.
uplug_getSymbolName
U_CAPI const char * uplug_getSymbolName(UPlugData *plug)
Return the symbol name for this plugin, if known.
UPlugLevel
UPlugLevel
Level of plugin loading INITIAL: UNKNOWN QUERY: INVALID -> { LOW | HIGH } ERR -> INVALID.
Definition: icuplug.h:176
UPLUG_LEVEL_INVALID
@ UPLUG_LEVEL_INVALID
The plugin is invalid, hasn't called uplug_setLevel, or can't load.
Definition: icuplug.h:177
UPLUG_LEVEL_COUNT
@ UPLUG_LEVEL_COUNT
Number of known levels.
Definition: icuplug.h:185
UPLUG_LEVEL_UNKNOWN
@ UPLUG_LEVEL_UNKNOWN
The plugin is waiting to be installed.
Definition: icuplug.h:178
UPLUG_LEVEL_HIGH
@ UPLUG_LEVEL_HIGH
The plugin can run at any time.
Definition: icuplug.h:180
UPLUG_LEVEL_LOW
@ UPLUG_LEVEL_LOW
The plugin must be called before u_init completes.
Definition: icuplug.h:179
uplug_loadPlugFromLibrary
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.
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:247
U_CAPI
#define U_CAPI
This is used to declare a function as a public ICU C API.
Definition: umachine.h:110
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415