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