Detailed Description
How to use autosave:
The application registers callback function(s) that is/are called by Libosso to save the user data (such as an unsaved document). Whenever the user data changes, the application calls osso_application_userdata_changed to tell Libosso that the callback(s) should be called in the future.
Libosso will call the callback(s) when:
- a "dirty data" timer in Libosso expires
- Libosso gets a message from the system that unsaved user data should be saved (e.g. at shutdown)
The application should call osso_application_autosave_force whenever it is switched to the background (untopped).
After the autosave callbacks have been called, the timer inside Libosso is reset and the application needs to call osso_application_userdata_changed again when it has new "dirty" user data.
Typedef Documentation
This is the type for the autosave callback function.
- Parameters:
-
| data | Arbitrary application specific pointer. |
Function Documentation
This function forces a call to the application's autosave function, and resets the autosave timeout.
- Parameters:
-
- Returns:
- OSSO_OK if all goes well, OSSO_ERROR if an error occurred, or OSSO_INVALID if some parameter is invalid.
This function registers an autosave callback function.
- Parameters:
-
| osso | The library context as returned by osso_initialize. |
| cb | The callback function. |
| data | Arbitrary application specific pointer that will be passed to the callback and ignored by Libosso. |
- Returns:
- OSSO_OK if all goes well, OSSO_ERROR if an error occurred, or OSSO_INVALID if some parameter is invalid.
This function unregisters an autosave callback function.
- Parameters:
-
| osso | The library context as returned by osso_initialize. |
| cb | The callback function. |
| data | Arbitrary application specific pointer that will be passed to the callback and ignored by Libosso. |
- Returns:
- OSSO_OK if all goes well, OSSO_ERROR if an error occurred, or OSSO_INVALID if some parameter is invalid.
This function is called by the application when the user data has been changed, so that Libosso knows that a call to the autosave callback is needed in the future to save the user data. The dirty state will be cleared every time the application's autosave callback function is called.
- Parameters:
-
- Returns:
- OSSO_OK if all goes well, OSSO_ERROR if an error occurred or OSSO_INVALID if some parameter is invalid.