mbed-drivers
FileSystemLike.h
1 /*
2  * Copyright (c) 2006-2016, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may
6  * not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef MBED_FILESYSTEMLIKE_H
18 #define MBED_FILESYSTEMLIKE_H
19 
20 #include "platform.h"
21 
22 #include "FileBase.h"
23 #include "FileHandle.h"
24 #include "DirHandle.h"
25 
26 namespace mbed {
27 
34 class FileSystemLike : public FileBase {
35 
36 public:
41  FileSystemLike(const char *name);
42 
43  virtual ~FileSystemLike();
44 
45  static DirHandle *opendir();
46  friend class BaseDirHandle;
47 
58  virtual FileHandle *open(const char *filename, int flags) = 0;
59 
65  virtual int remove(const char *filename) { (void) filename; return -1; };
66 
76  virtual int rename(const char *oldname, const char *newname) { (void) oldname, (void) newname; return -1; };
77 
87  virtual DirHandle *opendir(const char *name) { (void) name; return NULL; };
88 
98  virtual int mkdir(const char *name, mode_t mode) { (void) name, (void) mode; return -1; }
99 
100  // TODO other filesystem functions (mkdir, rm, rn, ls etc)
101 };
102 
103 } // namespace mbed
104 
105 #endif
Definition: DirHandle.h:49
virtual FileHandle * open(const char *filename, int flags)=0
Definition: FileHandle.h:43
Definition: FileSystemLike.h:34
virtual DirHandle * opendir(const char *name)
Definition: FileSystemLike.h:87
FileSystemLike(const char *name)
Definition: FileSystemLike.cpp:66
virtual int mkdir(const char *name, mode_t mode)
Definition: FileSystemLike.h:98
Definition: FileSystemLike.cpp:21
virtual int rename(const char *oldname, const char *newname)
Definition: FileSystemLike.h:76
Definition: FileBase.h:53
Definition: BusIn.cpp:19