--- /dev/null
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#include "CollectionReader.h"
+
+CollectionReader::CollectionReader(ReaderInput* readerInput) {
+ this->readerInput = readerInput;
+}
+
+CollectionReader::~CollectionReader() {
+ delete readerInput;
+}
+
--- /dev/null
+/**
+ * © 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
--- /dev/null
+/**
+ * © 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;
+}
--- /dev/null
+/**
+ * © 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
+
-CC=gcc
+CC=g++
ifdef DEBUG
CC_OPTS=-Wall -g
CC_OPTS=-Wall -O2
endif
+.c.o .cpp.o:
+ $(CC) $(CC_OPTS) -c -o $@ $<
+
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
+ rm -f *.o
--- /dev/null
+/**
+ * © 2008 by David Roden <droden@gmail.com>
+ */
+
+#include "ReaderInput.h"
+
+ReaderInput::~ReaderInput() {
+}
+
--- /dev/null
+/**
+ * © 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