Mangue Baja Box

Dependencies:   mbed

Committer:
einsteingustavo
Date:
Mon Jul 29 20:38:00 2019 +0000
Revision:
0:0dee8840a1c0
Mangue Baja Box

Who changed what in which revision?

UserRevisionLine numberNew contents of line
einsteingustavo 0:0dee8840a1c0 1 /* mbed Microcontroller Library
einsteingustavo 0:0dee8840a1c0 2 * Copyright (c) 2006-2013 ARM Limited
einsteingustavo 0:0dee8840a1c0 3 *
einsteingustavo 0:0dee8840a1c0 4 * Licensed under the Apache License, Version 2.0 (the "License");
einsteingustavo 0:0dee8840a1c0 5 * you may not use this file except in compliance with the License.
einsteingustavo 0:0dee8840a1c0 6 * You may obtain a copy of the License at
einsteingustavo 0:0dee8840a1c0 7 *
einsteingustavo 0:0dee8840a1c0 8 * http://www.apache.org/licenses/LICENSE-2.0
einsteingustavo 0:0dee8840a1c0 9 *
einsteingustavo 0:0dee8840a1c0 10 * Unless required by applicable law or agreed to in writing, software
einsteingustavo 0:0dee8840a1c0 11 * distributed under the License is distributed on an "AS IS" BASIS,
einsteingustavo 0:0dee8840a1c0 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
einsteingustavo 0:0dee8840a1c0 13 * See the License for the specific language governing permissions and
einsteingustavo 0:0dee8840a1c0 14 * limitations under the License.
einsteingustavo 0:0dee8840a1c0 15 */
einsteingustavo 0:0dee8840a1c0 16 #ifndef MBED_STREAM_H
einsteingustavo 0:0dee8840a1c0 17 #define MBED_STREAM_H
einsteingustavo 0:0dee8840a1c0 18
einsteingustavo 0:0dee8840a1c0 19 #include "platform.h"
einsteingustavo 0:0dee8840a1c0 20 #include "FileLike.h"
einsteingustavo 0:0dee8840a1c0 21
einsteingustavo 0:0dee8840a1c0 22 namespace mbed {
einsteingustavo 0:0dee8840a1c0 23
einsteingustavo 0:0dee8840a1c0 24 extern void mbed_set_unbuffered_stream(FILE *_file);
einsteingustavo 0:0dee8840a1c0 25 extern int mbed_getc(FILE *_file);
einsteingustavo 0:0dee8840a1c0 26 extern char* mbed_gets(char *s, int size, FILE *_file);
einsteingustavo 0:0dee8840a1c0 27
einsteingustavo 0:0dee8840a1c0 28 class Stream : public FileLike {
einsteingustavo 0:0dee8840a1c0 29
einsteingustavo 0:0dee8840a1c0 30 public:
einsteingustavo 0:0dee8840a1c0 31 Stream(const char *name=NULL);
einsteingustavo 0:0dee8840a1c0 32 virtual ~Stream();
einsteingustavo 0:0dee8840a1c0 33
einsteingustavo 0:0dee8840a1c0 34 int putc(int c);
einsteingustavo 0:0dee8840a1c0 35 int puts(const char *s);
einsteingustavo 0:0dee8840a1c0 36 int getc();
einsteingustavo 0:0dee8840a1c0 37 char *gets(char *s, int size);
einsteingustavo 0:0dee8840a1c0 38 int printf(const char* format, ...);
einsteingustavo 0:0dee8840a1c0 39 int scanf(const char* format, ...);
einsteingustavo 0:0dee8840a1c0 40
einsteingustavo 0:0dee8840a1c0 41 operator std::FILE*() {return _file;}
einsteingustavo 0:0dee8840a1c0 42
einsteingustavo 0:0dee8840a1c0 43 protected:
einsteingustavo 0:0dee8840a1c0 44 virtual int close();
einsteingustavo 0:0dee8840a1c0 45 virtual ssize_t write(const void* buffer, size_t length);
einsteingustavo 0:0dee8840a1c0 46 virtual ssize_t read(void* buffer, size_t length);
einsteingustavo 0:0dee8840a1c0 47 virtual off_t lseek(off_t offset, int whence);
einsteingustavo 0:0dee8840a1c0 48 virtual int isatty();
einsteingustavo 0:0dee8840a1c0 49 virtual int fsync();
einsteingustavo 0:0dee8840a1c0 50 virtual off_t flen();
einsteingustavo 0:0dee8840a1c0 51
einsteingustavo 0:0dee8840a1c0 52 virtual int _putc(int c) = 0;
einsteingustavo 0:0dee8840a1c0 53 virtual int _getc() = 0;
einsteingustavo 0:0dee8840a1c0 54
einsteingustavo 0:0dee8840a1c0 55 std::FILE *_file;
einsteingustavo 0:0dee8840a1c0 56
einsteingustavo 0:0dee8840a1c0 57 /* disallow copy constructor and assignment operators */
einsteingustavo 0:0dee8840a1c0 58 private:
einsteingustavo 0:0dee8840a1c0 59 Stream(const Stream&);
einsteingustavo 0:0dee8840a1c0 60 Stream & operator = (const Stream&);
einsteingustavo 0:0dee8840a1c0 61 };
einsteingustavo 0:0dee8840a1c0 62
einsteingustavo 0:0dee8840a1c0 63 } // namespace mbed
einsteingustavo 0:0dee8840a1c0 64
einsteingustavo 0:0dee8840a1c0 65 #endif
einsteingustavo 0:0dee8840a1c0 66