]>
Commit | Line | Data |
---|---|---|
632820d1 | 1 | /** @file\r |
2 | Declares filebuffer interface functions.\r | |
3 | \r | |
4 | Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r | |
5 | This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #ifndef _LIB_FILE_BUFFER_H_\r | |
16 | #define _LIB_FILE_BUFFER_H_\r | |
17 | \r | |
18 | #include "TextEditorTypes.h"\r | |
19 | \r | |
20 | /**\r | |
21 | Initialization function for FileBuffer.\r | |
22 | \r | |
23 | @param EFI_SUCCESS The initialization was successful.\r | |
24 | @param EFI_LOAD_ERROR A default name could not be created.\r | |
25 | @param EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
26 | **/\r | |
27 | EFI_STATUS\r | |
28 | EFIAPI\r | |
29 | FileBufferInit (\r | |
30 | VOID\r | |
31 | );\r | |
32 | \r | |
33 | /**\r | |
34 | Cleanup function for FileBuffer.\r | |
35 | \r | |
36 | @retval EFI_SUCCESS The cleanup was successful.\r | |
37 | **/\r | |
38 | EFI_STATUS\r | |
39 | EFIAPI\r | |
40 | FileBufferCleanup (\r | |
41 | VOID\r | |
42 | );\r | |
43 | \r | |
44 | /**\r | |
45 | Refresh the screen with whats in the buffer.\r | |
46 | \r | |
47 | @retval EFI_SUCCESS The refresh was successful.\r | |
48 | @retval EFI_LOAD_ERROR There was an error finding what to write.\r | |
49 | **/\r | |
50 | EFI_STATUS\r | |
51 | EFIAPI\r | |
52 | FileBufferRefresh (\r | |
53 | VOID\r | |
54 | );\r | |
55 | \r | |
56 | /** \r | |
57 | Dispatch input to different handler\r | |
58 | @param[in] Key The input key. One of:\r | |
59 | ASCII KEY\r | |
60 | Backspace/Delete\r | |
61 | Return\r | |
62 | Direction key: up/down/left/right/pgup/pgdn\r | |
63 | Home/End\r | |
64 | INS\r | |
65 | \r | |
66 | @retval EFI_SUCCESS The dispatch was done successfully.\r | |
67 | @retval EFI_LOAD_ERROR The dispatch was not successful.\r | |
68 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
69 | **/\r | |
70 | EFI_STATUS\r | |
71 | EFIAPI\r | |
72 | FileBufferHandleInput (\r | |
73 | IN CONST EFI_INPUT_KEY * Key\r | |
74 | );\r | |
75 | \r | |
76 | /**\r | |
77 | Backup function for FileBuffer. Only backup the following items:\r | |
78 | Mouse/Cursor position\r | |
79 | File Name, Type, ReadOnly, Modified\r | |
80 | Insert Mode\r | |
81 | \r | |
82 | This is for making the file buffer refresh as few as possible.\r | |
83 | \r | |
84 | @retval EFI_SUCCESS The backup operation was successful.\r | |
85 | **/\r | |
86 | EFI_STATUS\r | |
87 | EFIAPI\r | |
88 | FileBufferBackup (\r | |
89 | VOID\r | |
90 | );\r | |
91 | \r | |
92 | /**\r | |
93 | Set the cursor position according to FileBuffer.DisplayPosition.\r | |
94 | \r | |
95 | @retval EFI_SUCCESS The operation was successful.\r | |
96 | **/\r | |
97 | EFI_STATUS\r | |
98 | EFIAPI\r | |
99 | FileBufferRestorePosition (\r | |
100 | VOID\r | |
101 | );\r | |
102 | \r | |
103 | /**\r | |
104 | Set FileName field in FileBuffer.\r | |
105 | \r | |
106 | @param Str The file name to set.\r | |
107 | \r | |
108 | @retval EFI_SUCCESS The filename was successfully set.\r | |
109 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
110 | @retval EFI_INVALID_PARAMETER Str is not a valid filename.\r | |
111 | **/\r | |
112 | EFI_STATUS\r | |
113 | EFIAPI\r | |
114 | FileBufferSetFileName (\r | |
115 | IN CONST CHAR16 *Str\r | |
116 | );\r | |
117 | \r | |
118 | /**\r | |
119 | Read a file from disk into the FileBuffer.\r | |
120 | \r | |
121 | @param[in] FileName The filename to read.\r | |
122 | @param[in] Recover TRUE if is for recover mode, no information printouts.\r | |
123 | \r | |
124 | @retval EFI_SUCCESS The load was successful.\r | |
125 | @retval EFI_LOAD_ERROR The load failed.\r | |
126 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
127 | @retval EFI_INVALID_PARAMETER FileName is a directory.\r | |
128 | **/\r | |
129 | EFI_STATUS\r | |
130 | EFIAPI\r | |
131 | FileBufferRead (\r | |
132 | IN CONST CHAR16 *FileName,\r | |
133 | IN CONST BOOLEAN Recover\r | |
134 | );\r | |
135 | \r | |
136 | /**\r | |
137 | Save lines in FileBuffer to disk\r | |
138 | \r | |
139 | @param[in] FileName The file name for writing.\r | |
140 | \r | |
141 | @retval EFI_SUCCESS Data was written.\r | |
142 | @retval EFI_LOAD_ERROR \r | |
143 | @retval EFI_OUT_OF_RESOURCES There were not enough resources to write the file.\r | |
144 | **/\r | |
145 | EFI_STATUS\r | |
146 | EFIAPI\r | |
147 | FileBufferSave (\r | |
148 | CONST CHAR16 *FileName\r | |
149 | );\r | |
150 | \r | |
151 | /**\r | |
152 | According to cursor's file position, adjust screen display\r | |
153 | \r | |
154 | @param[in] NewFilePosRow The row of file position ( start from 1 ).\r | |
155 | @param[in] NewFilePosCol The column of file position ( start from 1 ).\r | |
156 | **/\r | |
157 | VOID\r | |
158 | EFIAPI\r | |
159 | FileBufferMovePosition (\r | |
160 | IN CONST UINTN NewFilePosRow,\r | |
161 | IN CONST UINTN NewFilePosCol\r | |
162 | );\r | |
163 | \r | |
164 | /**\r | |
165 | Cut current line out and return a pointer to it.\r | |
166 | \r | |
167 | @param[out] CutLine Upon a successful return pointer to the pointer to \r | |
168 | the allocated cut line.\r | |
169 | \r | |
170 | @retval EFI_SUCCESS The cut was successful.\r | |
171 | @retval EFI_NOT_FOUND There was no selection to cut.\r | |
172 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
173 | **/\r | |
174 | EFI_STATUS\r | |
175 | EFIAPI\r | |
176 | FileBufferCutLine (\r | |
177 | OUT EFI_EDITOR_LINE **CutLine\r | |
178 | );\r | |
179 | \r | |
180 | /**\r | |
181 | Paste a line into line list.\r | |
182 | \r | |
183 | @retval EFI_SUCCESS The paste was successful.\r | |
184 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
185 | **/\r | |
186 | EFI_STATUS\r | |
187 | EFIAPI\r | |
188 | FileBufferPasteLine (\r | |
189 | VOID\r | |
190 | );\r | |
191 | \r | |
192 | /**\r | |
193 | Search string from current position on in file\r | |
194 | \r | |
195 | @param[in] Str The search string.\r | |
196 | @param[in] Offset The offset from current position.\r | |
197 | \r | |
198 | @retval EFI_SUCCESS The operation was successful.\r | |
199 | @retval EFI_NOT_FOUND The string Str was not found.\r | |
200 | **/\r | |
201 | EFI_STATUS\r | |
202 | EFIAPI\r | |
203 | FileBufferSearch (\r | |
204 | IN CONST CHAR16 *Str,\r | |
205 | IN CONST UINTN Offset\r | |
206 | );\r | |
207 | \r | |
208 | /**\r | |
209 | Replace SearchLen characters from current position on with Replace.\r | |
210 | \r | |
211 | This will modify the current buffer at the current position.\r | |
212 | \r | |
213 | @param[in] Replace The string to replace.\r | |
214 | @param[in] SearchLen Search string's length.\r | |
215 | \r | |
216 | @retval EFI_SUCCESS The operation was successful.\r | |
217 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
218 | **/\r | |
219 | EFI_STATUS\r | |
220 | EFIAPI\r | |
221 | FileBufferReplace (\r | |
222 | IN CONST CHAR16 *Replace,\r | |
223 | IN CONST UINTN SearchLen\r | |
224 | );\r | |
225 | \r | |
226 | /**\r | |
227 | Search and replace operation.\r | |
228 | \r | |
229 | @param[in] SearchStr The string to search for.\r | |
230 | @param[in] ReplaceStr The string to replace with.\r | |
231 | @param[in] Offset The column to start at.\r | |
232 | **/\r | |
233 | EFI_STATUS\r | |
234 | EFIAPI\r | |
235 | FileBufferReplaceAll (\r | |
236 | IN CHAR16 *SearchStr,\r | |
237 | IN CHAR16 *ReplaceStr,\r | |
238 | IN UINTN Offset\r | |
239 | );\r | |
240 | \r | |
241 | /**\r | |
242 | Move the mouse cursor position.\r | |
243 | \r | |
244 | @param[in] TextX The new x-coordinate.\r | |
245 | @param[in] TextY The new y-coordinate.\r | |
246 | **/\r | |
247 | VOID\r | |
248 | EFIAPI\r | |
249 | FileBufferAdjustMousePosition (\r | |
250 | IN CONST INT32 TextX,\r | |
251 | IN CONST INT32 TextY\r | |
252 | );\r | |
253 | \r | |
254 | /**\r | |
255 | Set the modified state to TRUE.\r | |
256 | **/\r | |
257 | VOID\r | |
258 | EFIAPI\r | |
259 | FileBufferSetModified (\r | |
260 | VOID\r | |
261 | );\r | |
262 | \r | |
263 | #endif\r |