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
Dir.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2015 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 00017 #ifndef DIR_H 00018 #define DIR_H 00019 00020 #include "filesystem/FileSystem.h" 00021 #include "platform/DirHandle.h" 00022 00023 namespace mbed { 00024 /** \addtogroup filesystem */ 00025 /** @{*/ 00026 00027 00028 /** Dir class 00029 */ 00030 class Dir : public DirHandle { 00031 public: 00032 /** Create an uninitialized directory 00033 * 00034 * Must call open to initialize the directory on a file system 00035 */ 00036 Dir(); 00037 00038 /** Open a directory on a filesystem 00039 * 00040 * @param fs Filesystem as target for a directory 00041 * @param path Name of the directory to open 00042 */ 00043 Dir(FileSystem *fs, const char *path); 00044 00045 /** Destroy a file 00046 * 00047 * Closes file if the file is still open 00048 */ 00049 virtual ~Dir(); 00050 00051 /** Open a directory on the filesystem 00052 * 00053 * @param fs Filesystem as target for a directory 00054 * @param path Name of the directory to open 00055 * @return 0 on success, negative error code on failure 00056 */ 00057 virtual int open(FileSystem *fs, const char *path); 00058 00059 /** Close a directory 00060 * 00061 * return 0 on success, negative error code on failure 00062 */ 00063 virtual int close(); 00064 00065 /** Read the next directory entry 00066 * 00067 * @param path The buffer to read the null terminated path name in to 00068 * @param ent The directory entry to fill out 00069 * @return 1 on reading a filename, 0 at end of directory, negative error on failure 00070 */ 00071 virtual ssize_t read(struct dirent *ent); 00072 00073 /** Set the current position of the directory 00074 * 00075 * @param offset Offset of the location to seek to, 00076 * must be a value returned from tell 00077 */ 00078 virtual void seek(off_t offset); 00079 00080 /** Get the current position of the directory 00081 * 00082 * @return Position of the directory that can be passed to rewind 00083 */ 00084 virtual off_t tell(); 00085 00086 /** Rewind the current position to the beginning of the directory 00087 */ 00088 virtual void rewind(); 00089 00090 /** Get the sizeof the directory 00091 * 00092 * @return Number of files in the directory 00093 */ 00094 virtual size_t size(); 00095 00096 private: 00097 FileSystem *_fs; 00098 fs_dir_t _dir; 00099 }; 00100 00101 00102 /** @}*/ 00103 } // namespace mbed 00104 00105 #endif 00106
Generated on Tue Jul 12 2022 14:46:32 by
