mbed-drivers
DirHandle.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_DIRHANDLE_H
18 #define MBED_DIRHANDLE_H
19 
20 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
21 # define NAME_MAX 255
22 typedef int mode_t;
23 
24 #else
25 # include <sys/syslimits.h>
26 #endif
27 
28 #include "FileHandle.h"
29 
30 struct dirent {
31  char d_name[NAME_MAX+1];
32 };
33 
34 namespace mbed {
35 
49 class DirHandle {
50 
51 public:
58  virtual int closedir()=0;
59 
68  virtual struct dirent *readdir()=0;
69 
72  virtual void rewinddir()=0;
73 
80  virtual off_t telldir() { return -1; }
81 
86  virtual void seekdir(off_t location) { (void) location;}
87 
88  virtual ~DirHandle() {}
89 };
90 
91 } // namespace mbed
92 
93 typedef mbed::DirHandle DIR;
94 
95 extern "C" {
96  DIR *opendir(const char*);
97  struct dirent *readdir(DIR *);
98  int closedir(DIR*);
99  void rewinddir(DIR*);
100  long telldir(DIR*);
101  void seekdir(DIR*, long);
102  int mkdir(const char *name, mode_t n);
103 };
104 
105 #endif /* MBED_DIRHANDLE_H */
Definition: DirHandle.h:49
Definition: DirHandle.h:30
virtual off_t telldir()
Definition: DirHandle.h:80
virtual void seekdir(off_t location)
Definition: DirHandle.h:86
Definition: BusIn.cpp:19