Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TUKS-COURSE-TIMER by
FileBase.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_FILEBASE_H 00017 #define MBED_FILEBASE_H 00018 00019 typedef int FILEHANDLE; 00020 00021 #include <cstdio> 00022 #include <cstring> 00023 00024 #if defined(__ARMCC_VERSION) || defined(__ICCARM__) 00025 # define O_RDONLY 0 00026 # define O_WRONLY 1 00027 # define O_RDWR 2 00028 # define O_CREAT 0x0200 00029 # define O_TRUNC 0x0400 00030 # define O_APPEND 0x0008 00031 00032 # define NAME_MAX 255 00033 00034 typedef int mode_t; 00035 typedef int ssize_t; 00036 typedef long off_t; 00037 00038 #else 00039 # include <sys/fcntl.h> 00040 # include <sys/types.h> 00041 # include <sys/syslimits.h> 00042 #endif 00043 00044 #include "platform/platform.h" 00045 #include "platform/SingletonPtr.h" 00046 #include "platform/PlatformMutex.h" 00047 00048 namespace mbed { 00049 /** \addtogroup drivers */ 00050 /** @{*/ 00051 00052 typedef enum { 00053 FilePathType, 00054 FileSystemPathType 00055 } PathType; 00056 00057 class FileBase { 00058 public: 00059 FileBase(const char *name, PathType t); 00060 00061 virtual ~FileBase(); 00062 00063 const char* getName(void); 00064 PathType getPathType(void); 00065 00066 static FileBase *lookup(const char *name, unsigned int len); 00067 00068 static FileBase *get(int n); 00069 00070 /* disallow copy constructor and assignment operators */ 00071 private: 00072 static FileBase *_head; 00073 static SingletonPtr<PlatformMutex> _mutex; 00074 00075 FileBase *_next; 00076 const char * const _name; 00077 const PathType _path_type; 00078 FileBase(const FileBase&); 00079 FileBase & operator = (const FileBase&); 00080 }; 00081 00082 } // namespace mbed 00083 00084 #endif 00085 00086 /** @}*/
Generated on Tue Jul 12 2022 17:38:48 by
