Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 6:40e873bbc5f7 1 /* mbed Microcontroller Library
MACRUM 6:40e873bbc5f7 2 * Copyright (c) 2006-2013 ARM Limited
MACRUM 6:40e873bbc5f7 3 *
MACRUM 6:40e873bbc5f7 4 * Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 6:40e873bbc5f7 5 * you may not use this file except in compliance with the License.
MACRUM 6:40e873bbc5f7 6 * You may obtain a copy of the License at
MACRUM 6:40e873bbc5f7 7 *
MACRUM 6:40e873bbc5f7 8 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 6:40e873bbc5f7 9 *
MACRUM 6:40e873bbc5f7 10 * Unless required by applicable law or agreed to in writing, software
MACRUM 6:40e873bbc5f7 11 * distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 6:40e873bbc5f7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 6:40e873bbc5f7 13 * See the License for the specific language governing permissions and
MACRUM 6:40e873bbc5f7 14 * limitations under the License.
MACRUM 6:40e873bbc5f7 15 */
MACRUM 6:40e873bbc5f7 16 #ifndef MBED_DIRHANDLE_H
MACRUM 6:40e873bbc5f7 17 #define MBED_DIRHANDLE_H
MACRUM 6:40e873bbc5f7 18
MACRUM 6:40e873bbc5f7 19 #include <stdint.h>
MACRUM 6:40e873bbc5f7 20 #include "platform/platform.h"
MACRUM 6:40e873bbc5f7 21
MACRUM 6:40e873bbc5f7 22 #include "FileHandle.h"
MACRUM 6:40e873bbc5f7 23
MACRUM 6:40e873bbc5f7 24 namespace mbed {
MACRUM 6:40e873bbc5f7 25 /** \addtogroup drivers */
MACRUM 6:40e873bbc5f7 26 /** @{*/
MACRUM 6:40e873bbc5f7 27
MACRUM 6:40e873bbc5f7 28 /** Represents a directory stream. Objects of this type are returned
MACRUM 6:40e873bbc5f7 29 * by a FileSystemLike's opendir method. Implementations must define
MACRUM 6:40e873bbc5f7 30 * at least closedir, readdir and rewinddir.
MACRUM 6:40e873bbc5f7 31 *
MACRUM 6:40e873bbc5f7 32 * If a FileSystemLike class defines the opendir method, then the
MACRUM 6:40e873bbc5f7 33 * directories of an object of that type can be accessed by
MACRUM 6:40e873bbc5f7 34 * DIR *d = opendir("/example/directory") (or opendir("/example")
MACRUM 6:40e873bbc5f7 35 * to open the root of the filesystem), and then using readdir(d) etc.
MACRUM 6:40e873bbc5f7 36 *
MACRUM 6:40e873bbc5f7 37 * The root directory is considered to contain all FileLike and
MACRUM 6:40e873bbc5f7 38 * FileSystemLike objects, so the DIR* returned by opendir("/") will
MACRUM 6:40e873bbc5f7 39 * reflect this.
MACRUM 6:40e873bbc5f7 40 *
MACRUM 6:40e873bbc5f7 41 * @Note Synchronization level: Set by subclass
MACRUM 6:40e873bbc5f7 42 */
MACRUM 6:40e873bbc5f7 43 class DirHandle {
MACRUM 6:40e873bbc5f7 44 public:
MACRUM 6:40e873bbc5f7 45 MBED_DEPRECATED_SINCE("mbed-os-5.4",
MACRUM 6:40e873bbc5f7 46 "The mbed 2 filesystem classes have been superseeded by the FileSystem api, "
MACRUM 6:40e873bbc5f7 47 "Replaced by File")
MACRUM 6:40e873bbc5f7 48 DirHandle() {}
MACRUM 6:40e873bbc5f7 49
MACRUM 6:40e873bbc5f7 50 /** Closes the directory.
MACRUM 6:40e873bbc5f7 51 *
MACRUM 6:40e873bbc5f7 52 * @returns
MACRUM 6:40e873bbc5f7 53 * 0 on success,
MACRUM 6:40e873bbc5f7 54 * -1 on error.
MACRUM 6:40e873bbc5f7 55 */
MACRUM 6:40e873bbc5f7 56 virtual int closedir()=0;
MACRUM 6:40e873bbc5f7 57
MACRUM 6:40e873bbc5f7 58 /** Return the directory entry at the current position, and
MACRUM 6:40e873bbc5f7 59 * advances the position to the next entry.
MACRUM 6:40e873bbc5f7 60 *
MACRUM 6:40e873bbc5f7 61 * @returns
MACRUM 6:40e873bbc5f7 62 * A pointer to a dirent structure representing the
MACRUM 6:40e873bbc5f7 63 * directory entry at the current position, or NULL on reaching
MACRUM 6:40e873bbc5f7 64 * end of directory or error.
MACRUM 6:40e873bbc5f7 65 */
MACRUM 6:40e873bbc5f7 66 virtual struct dirent *readdir()=0;
MACRUM 6:40e873bbc5f7 67
MACRUM 6:40e873bbc5f7 68 /** Resets the position to the beginning of the directory.
MACRUM 6:40e873bbc5f7 69 */
MACRUM 6:40e873bbc5f7 70 virtual void rewinddir()=0;
MACRUM 6:40e873bbc5f7 71
MACRUM 6:40e873bbc5f7 72 /** Returns the current position of the DirHandle.
MACRUM 6:40e873bbc5f7 73 *
MACRUM 6:40e873bbc5f7 74 * @returns
MACRUM 6:40e873bbc5f7 75 * the current position,
MACRUM 6:40e873bbc5f7 76 * -1 on error.
MACRUM 6:40e873bbc5f7 77 */
MACRUM 6:40e873bbc5f7 78 virtual off_t telldir() { return -1; }
MACRUM 6:40e873bbc5f7 79
MACRUM 6:40e873bbc5f7 80 /** Sets the position of the DirHandle.
MACRUM 6:40e873bbc5f7 81 *
MACRUM 6:40e873bbc5f7 82 * @param location The location to seek to. Must be a value returned by telldir.
MACRUM 6:40e873bbc5f7 83 */
MACRUM 6:40e873bbc5f7 84 virtual void seekdir(off_t location) { (void)location;}
MACRUM 6:40e873bbc5f7 85
MACRUM 6:40e873bbc5f7 86 virtual ~DirHandle() {}
MACRUM 6:40e873bbc5f7 87
MACRUM 6:40e873bbc5f7 88 protected:
MACRUM 6:40e873bbc5f7 89
MACRUM 6:40e873bbc5f7 90 /** Acquire exclusive access to this object.
MACRUM 6:40e873bbc5f7 91 */
MACRUM 6:40e873bbc5f7 92 virtual void lock() {
MACRUM 6:40e873bbc5f7 93 // Stub
MACRUM 6:40e873bbc5f7 94 }
MACRUM 6:40e873bbc5f7 95
MACRUM 6:40e873bbc5f7 96 /** Release exclusive access to this object.
MACRUM 6:40e873bbc5f7 97 */
MACRUM 6:40e873bbc5f7 98 virtual void unlock() {
MACRUM 6:40e873bbc5f7 99 // Stub
MACRUM 6:40e873bbc5f7 100 }
MACRUM 6:40e873bbc5f7 101
MACRUM 6:40e873bbc5f7 102 protected:
MACRUM 6:40e873bbc5f7 103 /** Internal-only constructor to work around deprecated notices when not used
MACRUM 6:40e873bbc5f7 104 *. due to nested deprecations and difficulty of compilers finding their way around
MACRUM 6:40e873bbc5f7 105 * the class hierarchy
MACRUM 6:40e873bbc5f7 106 */
MACRUM 6:40e873bbc5f7 107 friend class FileSystemLike;
MACRUM 6:40e873bbc5f7 108 DirHandle(int) {}
MACRUM 6:40e873bbc5f7 109 };
MACRUM 6:40e873bbc5f7 110
MACRUM 6:40e873bbc5f7 111 } // namespace mbed
MACRUM 6:40e873bbc5f7 112
MACRUM 6:40e873bbc5f7 113 #endif /* MBED_DIRHANDLE_H */
MACRUM 6:40e873bbc5f7 114
MACRUM 6:40e873bbc5f7 115 /** @}*/