Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of gr-peach-opencv-project-sd-card by
FileSystemLike.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_FILESYSTEMLIKE_H 00017 #define MBED_FILESYSTEMLIKE_H 00018 00019 #include "platform/platform.h" 00020 00021 #include "platform/FileSystemHandle.h" 00022 #include "platform/FileHandle.h" 00023 #include "platform/DirHandle.h" 00024 00025 namespace mbed { 00026 /** \addtogroup platform */ 00027 00028 00029 /** A filesystem-like object is one that can be used to open file-like 00030 * objects though it by fopen("/name/filename", mode) 00031 * 00032 * Implementations must define at least open (the default definitions 00033 * of the rest of the functions just return error values). 00034 * 00035 * @note Synchronization level: Set by subclass 00036 * @ingroup platform 00037 */ 00038 class FileSystemLike : public FileSystemHandle, public FileBase { 00039 public: 00040 /** FileSystemLike lifetime 00041 */ 00042 FileSystemLike(const char *name = NULL) : FileBase(name, FileSystemPathType) {} 00043 virtual ~FileSystemLike() {} 00044 00045 // Inherited functions with name conflicts 00046 using FileSystemHandle::open; 00047 00048 /** Open a file on the filesystem 00049 * 00050 * @param path The name of the file to open 00051 * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR, 00052 * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND 00053 * @return A file handle on success, NULL on failure 00054 * @deprecated Replaced by `int open(FileHandle **, ...)` for propagating error codes 00055 */ 00056 MBED_DEPRECATED_SINCE("mbed-os-5.5", 00057 "Replaced by `int open(FileHandle **, ...)` for propagating error codes") 00058 FileHandle *open(const char *path, int flags) 00059 { 00060 FileHandle *file; 00061 int err = open(&file, path, flags); 00062 return err ? NULL : file; 00063 } 00064 00065 /** Open a directory on the filesystem 00066 * 00067 * @param path Name of the directory to open 00068 * @return A directory handle on success, NULL on failure 00069 * @deprecated Replaced by `int open(DirHandle **, ...)` for propagating error codes 00070 */ 00071 MBED_DEPRECATED_SINCE("mbed-os-5.5", 00072 "Replaced by `int open(DirHandle **, ...)` for propagating error codes") 00073 DirHandle *opendir(const char *path) 00074 { 00075 DirHandle *dir; 00076 int err = open(&dir, path); 00077 return err ? NULL : dir; 00078 } 00079 }; 00080 00081 00082 } // namespace mbed 00083 00084 #endif 00085
Generated on Tue Jul 12 2022 14:46:39 by
