|
6 | 6 | #define Os_File_hpp_ |
7 | 7 |
|
8 | 8 | #include <Fw/FPrimeBasicTypes.hpp> |
| 9 | +#include <Fw/Types/ConstStringBase.hpp> |
9 | 10 | #include <Os/Os.hpp> |
10 | 11 |
|
11 | 12 | // Forward declaration for UTs |
@@ -264,6 +265,51 @@ class File final : public FileInterface { |
264 | 265 | //! |
265 | 266 | Os::FileInterface::Status open(const char* path, Mode mode); |
266 | 267 |
|
| 268 | + //! \brief open file with supplied path, bounded length, and mode |
| 269 | + //! |
| 270 | + //! Open the file passed in with the given mode. The path length is bounded by `length`. |
| 271 | + //! Opening files with `OPEN_CREATE` mode will not clobber existing files. Use the overload |
| 272 | + //! accepting `OverwriteType` to set overwrite flag and clobber existing files. |
| 273 | + //! |
| 274 | + //! It is invalid to send `nullptr` as the path. |
| 275 | + //! It is invalid to supply `mode` as a non-enumerated value. |
| 276 | + //! It is invalid for the path to not be null-terminated within `length` characters. |
| 277 | + //! |
| 278 | + //! \param path: c-string of path to open |
| 279 | + //! \param length: bound on the path buffer size |
| 280 | + //! \param mode: file operation mode |
| 281 | + //! \return: status of the open |
| 282 | + //! |
| 283 | + Os::FileInterface::Status open(const char* path, FwSizeType length, Mode mode); |
| 284 | + |
| 285 | + //! \brief open file with supplied string path and mode |
| 286 | + //! |
| 287 | + //! Open the file passed in with the given mode. Opening files with `OPEN_CREATE` mode will not clobber existing |
| 288 | + //! files. Use the overload accepting `OverwriteType` to set overwrite flag and clobber existing files. |
| 289 | + //! |
| 290 | + //! It is invalid to supply `mode` as a non-enumerated value. |
| 291 | + //! |
| 292 | + //! \param path: ConstStringBase reference of path to open |
| 293 | + //! \param mode: file operation mode |
| 294 | + //! \return: status of the open |
| 295 | + //! |
| 296 | + Os::FileInterface::Status open(const Fw::ConstStringBase& path, Mode mode); |
| 297 | + |
| 298 | + //! \brief open file with supplied string path, mode, and overwrite type |
| 299 | + //! |
| 300 | + //! Open the file passed in with the given mode. If overwrite is set to OVERWRITE, then opening files in |
| 301 | + //! OPEN_CREATE mode will clobber existing files. Set overwrite to NO_OVERWRITE to preserve existing files. |
| 302 | + //! |
| 303 | + //! It is invalid to supply `mode` as a non-enumerated value. |
| 304 | + //! It is invalid to supply `overwrite` as a non-enumerated value. |
| 305 | + //! |
| 306 | + //! \param path: ConstStringBase reference of path to open |
| 307 | + //! \param mode: file operation mode |
| 308 | + //! \param overwrite: overwrite existing file on create |
| 309 | + //! \return: status of the open |
| 310 | + //! |
| 311 | + Os::FileInterface::Status open(const Fw::ConstStringBase& path, Mode mode, OverwriteType overwrite); |
| 312 | + |
267 | 313 | //! \brief read data from this file into supplied buffer bounded by size |
268 | 314 | //! |
269 | 315 | //! Read data from this file up to the `size` and store it in `buffer`. This version will |
@@ -321,6 +367,26 @@ class File final : public FileInterface { |
321 | 367 | //! |
322 | 368 | Os::FileInterface::Status open(const char* path, Mode mode, OverwriteType overwrite) override; |
323 | 369 |
|
| 370 | + //! \brief open file with supplied path, bounded length, mode, and overwrite type |
| 371 | + //! |
| 372 | + //! Open the file passed in with the given mode. The path length is bounded by `length`. |
| 373 | + //! If overwrite is set to OVERWRITE, then opening files in OPEN_CREATE mode will clobber |
| 374 | + //! existing files. Set overwrite to NO_OVERWRITE to preserve existing files. This is the |
| 375 | + //! core open implementation to which all other open overloads delegate. |
| 376 | + //! |
| 377 | + //! It is invalid to send `nullptr` as the path. |
| 378 | + //! It is invalid to supply `mode` as a non-enumerated value. |
| 379 | + //! It is invalid to supply `overwrite` as a non-enumerated value. |
| 380 | + //! It is invalid for the path to not be null-terminated within `length` characters. |
| 381 | + //! |
| 382 | + //! \param path: c-string of path to open |
| 383 | + //! \param length: bound on the path buffer size |
| 384 | + //! \param mode: file operation mode |
| 385 | + //! \param overwrite: overwrite existing file on create |
| 386 | + //! \return: status of the open |
| 387 | + //! |
| 388 | + Os::FileInterface::Status open(const char* path, FwSizeType length, Mode mode, OverwriteType overwrite); |
| 389 | + |
324 | 390 | //! \brief close the file, if not opened then do nothing |
325 | 391 | //! |
326 | 392 | //! Closes the file, if open. Otherwise this function does nothing. Delegates to the chosen implementation's |
|
0 commit comments