Struct sGCJsonCallbacks
#[repr(C)]pub struct sGCJsonCallbacks {
pub getBool: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> bool>,
pub getInt: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>,
pub getDouble: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> f64>,
pub getString: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>,
pub getArrayIdx: Option<unsafe extern "C" fn(sGCJsonObject, i64, *mut u32) -> sGCJsonObject>,
pub getArrayLength: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>,
pub getObjectField: Option<unsafe extern "C" fn(sGCJsonObject, *const i8, *mut u32) -> sGCJsonObject>,
pub getObjectSerialized: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>,
pub freeString: Option<unsafe extern "C" fn(*const i8)>,
pub data: sGCJsonObject,
}Expand description
@brief The JSON configuration data and parsing callbacks
This struct holds the JSON configuration data and the parsing callbacks that the plugin can use to parse the configuration.
Fields§
§getBool: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> bool>@brief Parse a boolean from a JSON object
@param obj The JSON object @param result The result of the operation
getInt: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>@brief Parse an integer from a JSON object
@param obj The JSON object @param result The result of the operation
getDouble: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> f64>@brief Parse a double from a JSON object
@param obj The JSON object @param result The result of the operation
getString: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>@brief Parse a string from a JSON object
@param obj The JSON object @param result The result of the operation @return The string parsed from the JSON object or NULL if an error occurred @note The plugin must call @ref freeString on the returned string if it is not null. Not doing so will result in a memory leak.
getArrayIdx: Option<unsafe extern "C" fn(sGCJsonObject, i64, *mut u32) -> sGCJsonObject>@brief Get an element from a JSON array
@param obj The JSON object @param idx The index of the element to get @param result The result of the operation @return The element at the specified index or NULL if an error occurred
getArrayLength: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> i64>@brief Get the length of a JSON array
@param obj The JSON object @param result The result of the operation @return The length of the array or -1 if an error occurred
getObjectField: Option<unsafe extern "C" fn(sGCJsonObject, *const i8, *mut u32) -> sGCJsonObject>@brief Get a field from a JSON object
@param obj The JSON object @param fieldName The name of the field to get @param result The result of the operation @return The field or NULL if an error occurred
getObjectSerialized: Option<unsafe extern "C" fn(sGCJsonObject, *mut u32) -> *mut i8>@brief Serialize a JSON object to a string
@param obj The JSON object @param result The result of the operation @return The serialized JSON object or NULL if an error occurred @note The plugin must call @ref freeString on the returned string if it is not null. Not doing so will result in a memory leak.
freeString: Option<unsafe extern "C" fn(*const i8)>@brief Free a string
Free a string returned by @ref getString or @ref getObjectSerialized.
@param str The string to free
data: sGCJsonObject@brief The plugin specific configuration
Represents the top level JSON object that contains the plugin specific configuration set by the user.
Trait Implementations§
§impl Clone for sGCJsonCallbacks
impl Clone for sGCJsonCallbacks
§fn clone(&self) -> sGCJsonCallbacks
fn clone(&self) -> sGCJsonCallbacks
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more