2014-10-26 15:47:27 -07:00
|
|
|
#ifndef ELM_CODE_FILE_H_
|
|
|
|
# define ELM_CODE_FILE_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief These routines are used for interacting with files using Elm Code.
|
|
|
|
*/
|
|
|
|
|
2015-03-15 16:07:31 -07:00
|
|
|
typedef enum {
|
|
|
|
ELM_CODE_FILE_LINE_ENDING_UNIX = 0,
|
|
|
|
ELM_CODE_FILE_LINE_ENDING_WINDOWS
|
|
|
|
} Elm_Code_File_Line_Ending;
|
|
|
|
|
2014-12-24 10:06:51 -08:00
|
|
|
struct _Elm_Code_File
|
2014-10-26 15:47:27 -07:00
|
|
|
{
|
2014-11-06 15:43:56 -08:00
|
|
|
void *parent;
|
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
Eina_List *lines;
|
|
|
|
Eina_File *file;
|
2014-11-19 14:39:00 -08:00
|
|
|
void *map;
|
2014-10-26 15:47:27 -07:00
|
|
|
|
2015-03-15 16:07:31 -07:00
|
|
|
Elm_Code_File_Line_Ending line_ending;
|
2014-12-24 10:06:51 -08:00
|
|
|
};
|
2014-10-26 15:47:27 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief File handling functions.
|
|
|
|
* @defgroup File I/O at a file level
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* Functions for file handling within elm code.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-11-16 15:52:41 -08:00
|
|
|
EAPI Elm_Code_File *elm_code_file_new(Elm_Code *code);
|
2014-11-04 13:05:29 -08:00
|
|
|
|
2014-11-16 15:52:41 -08:00
|
|
|
EAPI Elm_Code_File *elm_code_file_open(Elm_Code *code, const char *path);
|
2014-10-26 15:47:27 -07:00
|
|
|
|
2015-03-21 12:25:25 -07:00
|
|
|
EAPI void elm_code_file_save(Elm_Code_File *file);
|
|
|
|
|
2014-11-04 13:05:29 -08:00
|
|
|
EAPI void elm_code_file_free(Elm_Code_File *file);
|
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
EAPI void elm_code_file_close(Elm_Code_File *file);
|
|
|
|
|
|
|
|
EAPI const char *elm_code_file_filename_get(Elm_Code_File *file);
|
|
|
|
|
|
|
|
EAPI const char *elm_code_file_path_get(Elm_Code_File *file);
|
|
|
|
|
2015-03-15 16:07:31 -07:00
|
|
|
EAPI Elm_Code_File_Line_Ending elm_code_file_line_ending_get(Elm_Code_File *file);
|
|
|
|
|
2015-03-21 06:58:30 -07:00
|
|
|
EAPI const char *elm_code_file_line_ending_chars_get(Elm_Code_File *file, short *length);
|
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*
|
|
|
|
* @brief Content functions.
|
|
|
|
* @defgroup Content Functions for accessing file content
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* File content handling functions.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-11-18 13:11:10 -08:00
|
|
|
EAPI void elm_code_file_clear(Elm_Code_File *file);
|
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
EAPI unsigned int elm_code_file_lines_get(Elm_Code_File *file);
|
|
|
|
|
2015-02-14 15:14:06 -08:00
|
|
|
EAPI void elm_code_file_line_append(Elm_Code_File *file, const char *line, int length, void *data);
|
2014-11-04 13:05:29 -08:00
|
|
|
|
2015-02-28 06:20:32 -08:00
|
|
|
EAPI void elm_code_file_line_insert(Elm_Code_File *file, unsigned int row, const char *line, int length, void *data);
|
|
|
|
|
2015-03-08 03:33:07 -07:00
|
|
|
EAPI void elm_code_file_line_remove(Elm_Code_File *file, unsigned int row);
|
|
|
|
|
2014-11-04 16:01:28 -08:00
|
|
|
EAPI Elm_Code_Line *elm_code_file_line_get(Elm_Code_File *file, unsigned int line);
|
|
|
|
|
2014-10-26 15:47:27 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ELM_CODE_FILE_H_ */
|