test test test
snake-test/mbed/platform/FileBase.h@0:e4c5e6ec922e, 2020-05-25 (annotated)
- Committer:
- mohamedmoawya
- Date:
- Mon May 25 19:06:11 2020 +0000
- Revision:
- 0:e4c5e6ec922e
snake game tteest
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mohamedmoawya | 0:e4c5e6ec922e | 1 | /* mbed Microcontroller Library |
mohamedmoawya | 0:e4c5e6ec922e | 2 | * Copyright (c) 2006-2013 ARM Limited |
mohamedmoawya | 0:e4c5e6ec922e | 3 | * |
mohamedmoawya | 0:e4c5e6ec922e | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
mohamedmoawya | 0:e4c5e6ec922e | 5 | * you may not use this file except in compliance with the License. |
mohamedmoawya | 0:e4c5e6ec922e | 6 | * You may obtain a copy of the License at |
mohamedmoawya | 0:e4c5e6ec922e | 7 | * |
mohamedmoawya | 0:e4c5e6ec922e | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
mohamedmoawya | 0:e4c5e6ec922e | 9 | * |
mohamedmoawya | 0:e4c5e6ec922e | 10 | * Unless required by applicable law or agreed to in writing, software |
mohamedmoawya | 0:e4c5e6ec922e | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
mohamedmoawya | 0:e4c5e6ec922e | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mohamedmoawya | 0:e4c5e6ec922e | 13 | * See the License for the specific language governing permissions and |
mohamedmoawya | 0:e4c5e6ec922e | 14 | * limitations under the License. |
mohamedmoawya | 0:e4c5e6ec922e | 15 | */ |
mohamedmoawya | 0:e4c5e6ec922e | 16 | #ifndef MBED_FILEBASE_H |
mohamedmoawya | 0:e4c5e6ec922e | 17 | #define MBED_FILEBASE_H |
mohamedmoawya | 0:e4c5e6ec922e | 18 | |
mohamedmoawya | 0:e4c5e6ec922e | 19 | typedef int FILEHANDLE; |
mohamedmoawya | 0:e4c5e6ec922e | 20 | |
mohamedmoawya | 0:e4c5e6ec922e | 21 | #include "platform/platform.h" |
mohamedmoawya | 0:e4c5e6ec922e | 22 | #include "platform/SingletonPtr.h" |
mohamedmoawya | 0:e4c5e6ec922e | 23 | #include "platform/PlatformMutex.h" |
mohamedmoawya | 0:e4c5e6ec922e | 24 | #include "platform/NonCopyable.h" |
mohamedmoawya | 0:e4c5e6ec922e | 25 | |
mohamedmoawya | 0:e4c5e6ec922e | 26 | namespace mbed { |
mohamedmoawya | 0:e4c5e6ec922e | 27 | |
mohamedmoawya | 0:e4c5e6ec922e | 28 | typedef enum { |
mohamedmoawya | 0:e4c5e6ec922e | 29 | FilePathType, |
mohamedmoawya | 0:e4c5e6ec922e | 30 | FileSystemPathType |
mohamedmoawya | 0:e4c5e6ec922e | 31 | } PathType; |
mohamedmoawya | 0:e4c5e6ec922e | 32 | |
mohamedmoawya | 0:e4c5e6ec922e | 33 | /** \addtogroup platform */ |
mohamedmoawya | 0:e4c5e6ec922e | 34 | /** @{*/ |
mohamedmoawya | 0:e4c5e6ec922e | 35 | /** |
mohamedmoawya | 0:e4c5e6ec922e | 36 | * \defgroup platform_FileBase FileBase class |
mohamedmoawya | 0:e4c5e6ec922e | 37 | * @{ |
mohamedmoawya | 0:e4c5e6ec922e | 38 | */ |
mohamedmoawya | 0:e4c5e6ec922e | 39 | /** Class FileBase |
mohamedmoawya | 0:e4c5e6ec922e | 40 | * |
mohamedmoawya | 0:e4c5e6ec922e | 41 | */ |
mohamedmoawya | 0:e4c5e6ec922e | 42 | |
mohamedmoawya | 0:e4c5e6ec922e | 43 | class FileBase : private NonCopyable<FileBase> { |
mohamedmoawya | 0:e4c5e6ec922e | 44 | public: |
mohamedmoawya | 0:e4c5e6ec922e | 45 | FileBase(const char *name, PathType t); |
mohamedmoawya | 0:e4c5e6ec922e | 46 | virtual ~FileBase(); |
mohamedmoawya | 0:e4c5e6ec922e | 47 | |
mohamedmoawya | 0:e4c5e6ec922e | 48 | const char *getName(void); |
mohamedmoawya | 0:e4c5e6ec922e | 49 | PathType getPathType(void); |
mohamedmoawya | 0:e4c5e6ec922e | 50 | |
mohamedmoawya | 0:e4c5e6ec922e | 51 | static FileBase *lookup(const char *name, unsigned int len); |
mohamedmoawya | 0:e4c5e6ec922e | 52 | |
mohamedmoawya | 0:e4c5e6ec922e | 53 | static FileBase *get(int n); |
mohamedmoawya | 0:e4c5e6ec922e | 54 | |
mohamedmoawya | 0:e4c5e6ec922e | 55 | void set_as_default(); |
mohamedmoawya | 0:e4c5e6ec922e | 56 | |
mohamedmoawya | 0:e4c5e6ec922e | 57 | private: |
mohamedmoawya | 0:e4c5e6ec922e | 58 | static FileBase *_head; |
mohamedmoawya | 0:e4c5e6ec922e | 59 | static FileBase *_default; |
mohamedmoawya | 0:e4c5e6ec922e | 60 | static SingletonPtr<PlatformMutex> _mutex; |
mohamedmoawya | 0:e4c5e6ec922e | 61 | |
mohamedmoawya | 0:e4c5e6ec922e | 62 | FileBase *_next; |
mohamedmoawya | 0:e4c5e6ec922e | 63 | const char *const _name; |
mohamedmoawya | 0:e4c5e6ec922e | 64 | const PathType _path_type; |
mohamedmoawya | 0:e4c5e6ec922e | 65 | }; |
mohamedmoawya | 0:e4c5e6ec922e | 66 | |
mohamedmoawya | 0:e4c5e6ec922e | 67 | /**@}*/ |
mohamedmoawya | 0:e4c5e6ec922e | 68 | |
mohamedmoawya | 0:e4c5e6ec922e | 69 | /**@}*/ |
mohamedmoawya | 0:e4c5e6ec922e | 70 | |
mohamedmoawya | 0:e4c5e6ec922e | 71 | } // namespace mbed |
mohamedmoawya | 0:e4c5e6ec922e | 72 | |
mohamedmoawya | 0:e4c5e6ec922e | 73 | #endif |
mohamedmoawya | 0:e4c5e6ec922e | 74 |