![]() |
![]() |
![]() |
libinftext-0.6 Reference Manual | |
---|---|---|---|---|
Top | Description |
Storage of text sessions on the file systemStorage of text sessions on the file system — Utility functions to deal with storing InfTextSessions in filesystem storage |
#include <libinftext/inf-text-filesystem-storage.h> enum InfTextFilesystemFormatError; gboolean inf_text_filesystem_format_read (InfdFilesystemStorage *storage
,const gchar *path
,InfUserTable *user_table
,InfTextBuffer *buffer
,GError **error
); gboolean inf_text_filesystem_format_write (InfdFilesystemStorage *storage
,const gchar *path
,InfUserTable *user_table
,InfTextBuffer *buffer
,GError **error
);
The functions in this section are utility functions that can be used when implementing a InfdNotePlugin to handle InfTextSessions. These functions implement reading and writing the content of an InfTextSession to an XML file in the storage.
typedef enum { INF_TEXT_FILESYSTEM_FORMAT_ERROR_NOT_A_TEXT_SESSION, INF_TEXT_FILESYSTEM_FORMAT_ERROR_USER_EXISTS, INF_TEXT_FILESYSTEM_FORMAT_ERROR_NO_SUCH_USER } InfTextFilesystemFormatError;
Errors that can occur when reading a InfTextSession from a InfdFilesystemStorage.
The file to be read is not a serialized text session. | |
The user table of the session contains users with duplicate ID or duplicate name. | |
A segment of the text document is written by a user which does not exist. |
gboolean inf_text_filesystem_format_read (InfdFilesystemStorage *storage
,const gchar *path
,InfUserTable *user_table
,InfTextBuffer *buffer
,GError **error
);
Reads a text session from path
in storage
. The file is expected to have
been saved with inf_text_filesystem_format_write()
before. The user_table
parameter should be an empty user table that will be used for the session,
and the buffer
parameter should be an empty InfTextBuffer, and the
document will be written into this buffer. If the function succeeds, the
user table and buffer can be used to create an InfTextSession with
inf_text_session_new_with_user_table()
. If the function fails, FALSE
is
returned and error
is set.
|
A InfdFilesystemStorage. |
|
Storage path to retrieve the session from. |
|
An empty InfUserTable to use as the new session's user table. |
|
An empty InfTextBuffer to use as the new session's buffer. |
|
Location to store error information, if any, or NULL . |
Returns : |
TRUE on success or FALSE on error. |
gboolean inf_text_filesystem_format_write (InfdFilesystemStorage *storage
,const gchar *path
,InfUserTable *user_table
,InfTextBuffer *buffer
,GError **error
);
Writes the given user table and buffer into the filesystem storage at
path
. If successful, the session can then be read back with
inf_text_filesystem_format_read()
. If the function fails, FALSE
is
returned and error
is set.
|
A InfdFilesystemStorage. |
|
Storage path where to write the session to. |
|
The InfUserTable to write. |
|
The InfTextBuffer to write. |
|
Location to store error information, if any, or NULL . |
Returns : |
TRUE on success or FALSE on error. |