2015-02-14 15:14:06 -08:00
|
|
|
#ifndef ELM_CODE_LINE_H_
|
|
|
|
# define ELM_CODE_LINE_H_
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief These routines are used for interacting with lines of content using Elm Code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _Elm_Code_Token
|
|
|
|
{
|
|
|
|
int start, end;
|
2015-09-20 02:39:33 -07:00
|
|
|
Eina_Bool continues;
|
2015-02-14 15:14:06 -08:00
|
|
|
|
|
|
|
Elm_Code_Token_Type type;
|
|
|
|
|
|
|
|
} Elm_Code_Token;
|
|
|
|
|
|
|
|
typedef struct _Elm_Code_Line
|
|
|
|
{
|
2015-02-21 10:24:17 -08:00
|
|
|
Elm_Code_File *file;
|
|
|
|
|
2015-02-14 15:14:06 -08:00
|
|
|
const char *content;
|
2015-03-29 12:12:28 -07:00
|
|
|
unsigned int length;
|
2015-02-14 15:14:06 -08:00
|
|
|
unsigned int number;
|
|
|
|
char *modified;
|
|
|
|
|
|
|
|
Elm_Code_Status_Type status;
|
|
|
|
Eina_List *tokens;
|
2017-11-14 11:12:56 -08:00
|
|
|
unsigned int scope;
|
2015-02-14 15:14:06 -08:00
|
|
|
|
|
|
|
void *data;
|
2015-04-12 15:04:46 -07:00
|
|
|
char *status_text;
|
2015-02-14 15:14:06 -08:00
|
|
|
} Elm_Code_Line;
|
|
|
|
|
2015-03-08 03:15:31 -07:00
|
|
|
EAPI void elm_code_line_free(Elm_Code_Line *line);
|
|
|
|
|
2015-02-14 15:14:06 -08:00
|
|
|
/**
|
2015-04-19 07:00:10 -07:00
|
|
|
* @brief Line manipulation functions.
|
|
|
|
* @defgroup Content
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* Functions for changing the content of lines in an Elm_Code_File
|
|
|
|
*/
|
|
|
|
|
2015-09-20 02:59:52 -07:00
|
|
|
/**
|
|
|
|
* Split the given line into two at the specified character position.
|
|
|
|
* The additional line will be inserted into the file immediately below the specified line.
|
|
|
|
*
|
|
|
|
* @param line The line to split
|
|
|
|
* @param position The character position to split at
|
|
|
|
*
|
|
|
|
* @ingroup Content
|
|
|
|
*/
|
2015-04-19 07:00:10 -07:00
|
|
|
EAPI void elm_code_line_split_at(Elm_Code_Line *line, unsigned int position);
|
|
|
|
|
2015-09-20 02:59:52 -07:00
|
|
|
/**
|
|
|
|
* Merge the specified line with the line above.
|
|
|
|
* The content of the specified line will be added to the end of the previous line.
|
|
|
|
* The specified line will then be removed from the file.
|
|
|
|
*
|
|
|
|
* If there is no previous line this method does nothing.
|
|
|
|
*
|
|
|
|
* @param line The line to merge with the previous line.
|
|
|
|
*
|
|
|
|
* @ingroup Content
|
|
|
|
*/
|
|
|
|
EAPI void elm_code_line_merge_up(Elm_Code_Line *line);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Merge the specified line with the line below.
|
|
|
|
* The content of the specified line will have the contents of the next line added to the end.
|
|
|
|
* The next line will then be removed from the file.
|
|
|
|
*
|
|
|
|
* If there is no next line this method does nothing.
|
|
|
|
*
|
|
|
|
* @param line The line to merge with the next line.
|
|
|
|
*
|
|
|
|
* @ingroup Content
|
|
|
|
*/
|
|
|
|
EAPI void elm_code_line_merge_down(Elm_Code_Line *line);
|
|
|
|
|
2015-04-19 07:00:10 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*
|
2015-02-22 12:07:08 -08:00
|
|
|
* @brief Line markup functions.
|
2015-04-19 07:00:10 -07:00
|
|
|
* @defgroup Highlighting
|
2015-02-14 15:14:06 -08:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*
|
2015-02-22 12:07:08 -08:00
|
|
|
* Functions for handling styling and marking up lines within elm code.
|
2015-02-14 15:14:06 -08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
EAPI void elm_code_line_status_set(Elm_Code_Line *line, Elm_Code_Status_Type status);
|
|
|
|
|
2015-04-12 15:04:46 -07:00
|
|
|
EAPI void elm_code_line_status_text_set(Elm_Code_Line *line, const char *text);
|
|
|
|
|
|
|
|
EAPI void elm_code_line_status_clear(Elm_Code_Line *line);
|
|
|
|
|
2015-02-21 10:24:17 -08:00
|
|
|
EAPI void elm_code_line_token_add(Elm_Code_Line *line, int start, int end, int lines, Elm_Code_Token_Type type);
|
2015-02-14 15:14:06 -08:00
|
|
|
|
2015-04-12 09:25:20 -07:00
|
|
|
EAPI void elm_code_line_tokens_clear(Elm_Code_Line *line);
|
|
|
|
|
2017-11-14 11:12:56 -08:00
|
|
|
EAPI unsigned int elm_code_line_scope_get(Elm_Code_Line *line);
|
|
|
|
|
2015-08-29 06:11:40 -07:00
|
|
|
EAPI Eina_Bool elm_code_line_contains_widget_cursor(Elm_Code_Line *line);
|
|
|
|
|
2015-02-14 15:14:06 -08:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ELM_CODE_LINE_H_ */
|