The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Revision:
44:24d45a770a51
Parent:
43:e2ed12d17f06
Child:
54:71b101360fb9
--- a/FileHandle.h	Fri Oct 26 17:40:46 2012 +0100
+++ b/FileHandle.h	Wed Nov 21 10:49:56 2012 +0000
@@ -1,7 +1,24 @@
-/* mbed Microcontroller Library - FileHandler
- * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
- */ 
- 
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2012 ARM Limited
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
 #ifndef MBED_FILEHANDLE_H
 #define MBED_FILEHANDLE_H
 
@@ -20,30 +37,29 @@
 /** An OO equivalent of the internal FILEHANDLE variable
  *  and associated _sys_* functions.
  *
- *  FileHandle is an abstract class, needing at least sys_write and
+ * FileHandle is an abstract class, needing at least sys_write and
  *  sys_read to be implmented for a simple interactive device.
  *
- *  No one ever directly tals to/instanciates a FileHandle - it gets 
+ * No one ever directly tals to/instanciates a FileHandle - it gets 
  *  created by FileSystem, and wrapped up by stdio.
  */
 class FileHandle {
 
 public:
-
     /** Write the contents of a buffer to the file
      *
      *  @param buffer the buffer to write from
      *  @param length the number of characters to write
      *
      *  @returns
-     *    The number of characters written (possibly 0) on success, -1 on error.
+     *  The number of characters written (possibly 0) on success, -1 on error.
      */
     virtual ssize_t write(const void* buffer, size_t length) = 0;
 
     /** Close the file
      *
      *  @returns
-     *    Zero on success, -1 on error.
+     *  Zero on success, -1 on error.
      */
     virtual int close() = 0;
 
@@ -54,18 +70,18 @@
      *  @param length the number of characters to read
      *
      *  @returns
-     *    The number of characters read (zero at end of file) on success, -1 on error.
+     *  The number of characters read (zero at end of file) on success, -1 on error.
      */
     virtual ssize_t read(void* buffer, size_t length) = 0;
 
     /** Check if the handle is for a interactive terminal device.
-     *  If so, line buffered behaviour is used by default
+     * If so, line buffered behaviour is used by default
      *
      *  @returns
      *    1 if it is a terminal,
      *    0 otherwise
      */
-    virtual int isatty() = 0 ;
+    virtual int isatty() = 0;
 
     /** Move the file position to a given offset from a given location.
      *
@@ -98,10 +114,10 @@
         lseek(pos, SEEK_SET);
         return res;
     }
-
+    
+    virtual ~FileHandle();
 };
 
 } // namespace mbed
 
 #endif
-