diff options
Diffstat (limited to 'FoundationEx/Reader.cpp')
-rw-r--r-- | FoundationEx/Reader.cpp | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/FoundationEx/Reader.cpp b/FoundationEx/Reader.cpp index 682627d..b39e9bc 100644 --- a/FoundationEx/Reader.cpp +++ b/FoundationEx/Reader.cpp @@ -3,21 +3,22 @@ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors Copyright (c) 1997-2006, Destroyer Studios LLC. - AUTHOR: John DiCamillo + AUTHOR: John DiCamillo - OVERVIEW - ======== - Implementation of the Reader class + OVERVIEW + ======== + Implementation of the Reader class */ #include "Reader.h" -#include <stdio.h> + +#include <cctype> +#include <cstdio> #include <fstream> -#include <ctype.h> + #include "Utils.h" -// +-------------------------------------------------------------------+ Text ConsoleReader::more() @@ -31,25 +32,29 @@ ConsoleReader::more() return Text(p); } + void ConsoleReader::printPrimaryPrompt() { - printf("- "); + std::printf("- "); } + void ConsoleReader::fillInputBuffer() { - fgets(buffer, 980, stdin); + std::fgets(buffer, 980, stdin); p = buffer; - while (isspace(*p)) p++; + while (std::isspace(*p)) p++; } -// +-------------------------------------------------------------------+ -FileReader::FileReader(const char* fname) - : filename(fname), done(0) -{ } +FileReader::FileReader(const char* fname) : + filename(fname), + done(0) +{ +} + Text FileReader::more() @@ -76,15 +81,22 @@ FileReader::more() return result; } -// +-------------------------------------------------------------------+ -BlockReader::BlockReader(const char* block) - : data((char*) block), done(0), length(0) -{ } +BlockReader::BlockReader(const char* block) : + data((char*) block), + done(0), + length(0) +{ +} + + +BlockReader::BlockReader(const char* block, int len) : + data((char*) block), + done(0), + length(len) +{ +} -BlockReader::BlockReader(const char* block, int len) - : data((char*) block), done(0), length(len) -{ } Text BlockReader::more() @@ -105,5 +117,3 @@ BlockReader::more() done = 1; return Text(); } - - |