summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--FoundationEx/Reader.cpp56
-rw-r--r--FoundationEx/Reader.h23
-rw-r--r--StarsEx/CMakeLists.txt1
3 files changed, 46 insertions, 34 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();
}
-
-
diff --git a/FoundationEx/Reader.h b/FoundationEx/Reader.h
index e1154d1..ed6aebc 100644
--- a/FoundationEx/Reader.h
+++ b/FoundationEx/Reader.h
@@ -3,20 +3,19 @@
Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
Copyright (c) 1997-2006, Destroyer Studios LLC.
- AUTHOR: John DiCamillo
+ AUTHOR: John DiCamillo
- OVERVIEW
- ========
- Declaration of the Reader class
+ OVERVIEW
+ ========
+ Declaration of the Reader class
*/
-#ifndef READER_H
-#define READER_H
+#ifndef Reader_h
+#define Reader_h
#include "Text.h"
-// +-------------------------------------------------------------------+
class Reader
{
@@ -27,10 +26,11 @@ public:
virtual Text more() = 0;
};
+
class ConsoleReader : public Reader
{
public:
- virtual Text more();
+ virtual Text more() override;
void printPrimaryPrompt();
void fillInputBuffer();
@@ -40,17 +40,19 @@ private:
char* p;
};
+
class FileReader : public Reader
{
public:
FileReader(const char* fname);
- virtual Text more();
+ virtual Text more() override;
private:
Text filename;
int done;
};
+
class BlockReader : public Reader
{
public:
@@ -64,4 +66,5 @@ private:
int length;
};
-#endif
+
+#endif // Reader_h
diff --git a/StarsEx/CMakeLists.txt b/StarsEx/CMakeLists.txt
index b66eb85..d734420 100644
--- a/StarsEx/CMakeLists.txt
+++ b/StarsEx/CMakeLists.txt
@@ -208,7 +208,6 @@ add_library(
RadioView.cpp
RadioVox.cpp
Random.cpp
- Reader.cpp
Res.cpp
RichTextBox.cpp
Scene.cpp