mirror of
https://github.com/obsproject/obs-studio
synced 2024-10-23 16:12:01 +00:00
libobs: Add obs_data_get_last_json()
Helper function to return the last generated json string for this object.
This commit is contained in:
parent
00fdec2493
commit
74c2379eba
|
@ -67,6 +67,19 @@ General Functions
|
|||
|
||||
.. function:: const char *obs_data_get_json(obs_data_t *data)
|
||||
|
||||
Generates a new json string. The string allocation is stored within
|
||||
the data object itself, and does not need to be manually freed.
|
||||
|
||||
:return: Json string for this object
|
||||
|
||||
---------------------
|
||||
|
||||
.. function:: const char *obs_data_get_last_json(obs_data_t *data)
|
||||
|
||||
Returns the last json string generated for this data object. Does not
|
||||
generate a new string. Use :c:func:`obs_data_get_json()` to generate
|
||||
a json string first.
|
||||
|
||||
:return: Json string for this object
|
||||
|
||||
---------------------
|
||||
|
|
|
@ -742,6 +742,11 @@ const char *obs_data_get_json(obs_data_t *data)
|
|||
return data->json;
|
||||
}
|
||||
|
||||
const char *obs_data_get_last_json(obs_data_t *data)
|
||||
{
|
||||
return data ? data->json : NULL;
|
||||
}
|
||||
|
||||
bool obs_data_save_json(obs_data_t *data, const char *file)
|
||||
{
|
||||
const char *json = obs_data_get_json(data);
|
||||
|
|
|
@ -70,6 +70,7 @@ EXPORT void obs_data_addref(obs_data_t *data);
|
|||
EXPORT void obs_data_release(obs_data_t *data);
|
||||
|
||||
EXPORT const char *obs_data_get_json(obs_data_t *data);
|
||||
EXPORT const char *obs_data_get_last_json(obs_data_t *data);
|
||||
EXPORT bool obs_data_save_json(obs_data_t *data, const char *file);
|
||||
EXPORT bool obs_data_save_json_safe(obs_data_t *data, const char *file,
|
||||
const char *temp_ext,
|
||||
|
|
Loading…
Reference in a new issue