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