first stubs
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 4 Jul 2008 19:27:40 +0000 (21:27 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 4 Jul 2008 19:27:40 +0000 (21:27 +0200)
CollectionReader.cpp [new file with mode: 0644]
CollectionReader.h [new file with mode: 0644]
FileReaderInput.cpp [new file with mode: 0644]
FileReaderInput.h [new file with mode: 0644]
Makefile
ReaderInput.cpp [new file with mode: 0644]
ReaderInput.h [new file with mode: 0644]

diff --git a/CollectionReader.cpp b/CollectionReader.cpp
new file mode 100644 (file)
index 0000000..27f9ca6
--- /dev/null
@@ -0,0 +1,14 @@
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#include "CollectionReader.h"
+
+CollectionReader::CollectionReader(ReaderInput* readerInput) {
+       this->readerInput = readerInput;
+}
+
+CollectionReader::~CollectionReader() {
+       delete readerInput;
+}
+
diff --git a/CollectionReader.h b/CollectionReader.h
new file mode 100644 (file)
index 0000000..2936e25
--- /dev/null
@@ -0,0 +1,21 @@
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#ifndef __ECPARSE_COLLECTIONREADER_H__
+#define __ECPARSE_COLLECTIONREADER_H__
+
+#include "ReaderInput.h"
+
+class CollectionReader {
+
+public:
+       CollectionReader(ReaderInput* readerInput);
+       ~CollectionReader();
+
+private:
+       ReaderInput* readerInput;
+
+};
+
+#endif
diff --git a/FileReaderInput.cpp b/FileReaderInput.cpp
new file mode 100644 (file)
index 0000000..14fc0c6
--- /dev/null
@@ -0,0 +1,20 @@
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#include "FileReaderInput.h"
+
+FileReaderInput::FileReaderInput(FILE *file) {
+       this->file = file;
+}
+
+FileReaderInput::~FileReaderInput() {
+       fclose(file);
+}
+
+int FileReaderInput::read(void* buffer, size_t length) {
+       size_t readBytes;
+
+       readBytes = fread(buffer, 1, length, file);
+       return 0;
+}
diff --git a/FileReaderInput.h b/FileReaderInput.h
new file mode 100644 (file)
index 0000000..4398bbf
--- /dev/null
@@ -0,0 +1,25 @@
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#ifndef __ECPARSE_FILEREADERINPUT_H__
+#define __ECPARSE_FILEREADERINPUT_H__
+
+#include <stdio.h>
+#include "ReaderInput.h"
+
+class FileReaderInput : public ReaderInput {
+
+public:
+       FileReaderInput(FILE *file);
+       ~FileReaderInput();
+
+       int read(void* buffer, size_t length);
+
+private:
+       FILE* file;
+
+};
+
+#endif
+
index b8cb93e..03442d8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
 
 
-CC=gcc
+CC=g++
 
 ifdef DEBUG
        CC_OPTS=-Wall -g
 
 ifdef DEBUG
        CC_OPTS=-Wall -g
@@ -7,9 +7,20 @@ else
        CC_OPTS=-Wall -O2
 endif
 
        CC_OPTS=-Wall -O2
 endif
 
+.c.o .cpp.o:
+       $(CC) $(CC_OPTS) -c -o $@ $<
+
 all: ecparse
 
 all: ecparse
 
-ecparse:
+ecparse: ReaderInput.o FileReaderInput.o CollectionReader.o Main.o
+       $(CC) -o $@ $^ 
+
+ReaderInput.o: ReaderInput.cpp ReaderInput.h
+
+FileReaderInput.o: FileReaderInput.cpp FileReaderInput.h ReaderInput.h
+
+CollectionReader.o: CollectionReader.cpp ReaderInput.h
 
 clean:
        rm -f ecparse
 
 clean:
        rm -f ecparse
+       rm -f *.o
diff --git a/ReaderInput.cpp b/ReaderInput.cpp
new file mode 100644 (file)
index 0000000..7969683
--- /dev/null
@@ -0,0 +1,9 @@
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#include "ReaderInput.h"
+
+ReaderInput::~ReaderInput() {
+}
+
diff --git a/ReaderInput.h b/ReaderInput.h
new file mode 100644 (file)
index 0000000..8c6f7e2
--- /dev/null
@@ -0,0 +1,19 @@
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#ifndef __ECPARSE_READERINPUT_H__
+#define __ECPARSE_READERINPUT_H__
+
+#include <stdio.h>
+
+class ReaderInput {
+
+public:
+       virtual ~ReaderInput();
+
+       virtual int read(void* buffer, size_t length) = 0;
+
+};
+
+#endif