1 #ifndef ELM_CODE_LINE_H_
2 # define ELM_CODE_LINE_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 /**
9  * @file
10  * @brief These routines are used for interacting with lines of content using Elm Code.
11  */
12 
13 typedef struct _Elm_Code_Token
14 {
15    int start, end;
16    Eina_Bool continues;
17 
18    Elm_Code_Token_Type type;
19 
20 } Elm_Code_Token;
21 
22 typedef struct _Elm_Code_Line
23 {
24    Elm_Code_File *file;
25 
26    const char *content;
27    unsigned int length;
28    unsigned int number;
29    char *modified;
30 
31    Elm_Code_Status_Type status;
32    Eina_List *tokens;
33    unsigned int scope;
34 
35    void *data;
36    char *status_text;
37 } Elm_Code_Line;
38 
39 EAPI void elm_code_line_free(Elm_Code_Line *line);
40 
41 /**
42  * @brief Line manipulation functions.
43  * @defgroup Elm_Code_Line_Content Elementary Code Line
44  * @{
45  *
46  * Functions for changing the content of lines in an Elm_Code_File
47  */
48 
49 /**
50  * Split the given line into two at the specified character position.
51  * The additional line will be inserted into the file immediately below the specified line.
52  *
53  * @param line The line to split
54  * @param position The character position to split at
55  *
56  * @ingroup Content
57  */
58 EAPI void elm_code_line_split_at(Elm_Code_Line *line, unsigned int position);
59 
60 /**
61  * Merge the specified line with the line above.
62  * The content of the specified line will be added to the end of the previous line.
63  * The specified line will then be removed from the file.
64  *
65  * If there is no previous line this method does nothing.
66  *
67  * @param line The line to merge with the previous line.
68  *
69  * @ingroup Content
70  */
71 EAPI void elm_code_line_merge_up(Elm_Code_Line *line);
72 
73 /**
74  * Merge the specified line with the line below.
75  * The content of the specified line will have the contents of the next line added to the end.
76  * The next line will then be removed from the file.
77  *
78  * If there is no next line this method does nothing.
79  *
80  * @param line The line to merge with the next line.
81  *
82  * @ingroup Content
83  */
84 EAPI void elm_code_line_merge_down(Elm_Code_Line *line);
85 
86 /**
87  * @}
88  *
89  * @brief Line markup functions.
90  * @defgroup Highlighting Elementary Code Highlighting
91  *
92  * @{
93  *
94  * Functions for handling styling and marking up lines within elm code.
95  *
96  */
97 
98 EAPI void elm_code_line_status_set(Elm_Code_Line *line, Elm_Code_Status_Type status);
99 
100 EAPI void elm_code_line_status_text_set(Elm_Code_Line *line, const char *text);
101 
102 EAPI void elm_code_line_status_clear(Elm_Code_Line *line);
103 
104 EAPI void elm_code_line_token_add(Elm_Code_Line *line, int start, int end, int lines, Elm_Code_Token_Type type);
105 
106 EAPI void elm_code_line_tokens_clear(Elm_Code_Line *line);
107 
108 EAPI unsigned int elm_code_line_scope_get(Elm_Code_Line *line);
109 
110 EAPI Eina_Bool elm_code_line_contains_widget_cursor(Elm_Code_Line *line);
111 
112 /**
113  * @}
114  */
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
120 #endif /* ELM_CODE_LINE_H_ */
121