source: projects/punch-card/punch-card-editor/src/qpunchcard/format.h @ 49

Last change on this file since 49 was 49, checked in by sven, 10 years ago
  • Text editing part:

Improved Column counting
80 column line bar

  • Saving with Jones Format works
File size: 1.3 KB
Line 
1#ifndef FORMAT_H
2#define FORMAT_H
3
4namespace QPunchCard {
5class FileFormat; class FileFormatFactory; };
6
7#include "card.h"
8#include <QFile>
9#include <QList>
10#include <QString>
11
12namespace QPunchCard {
13
14class FileFormat {
15public:
16        virtual ~FileFormat() {}
17        virtual bool write(QFile& /* target */, const Deck& /* source */) const = 0;
18        virtual bool read(QFile& /* source */, Deck& /* target */) const = 0;
19};
20
21class FileFormatFactory {
22public:
23        static QList<QString> availableFormats();
24        static const FileFormat* createFormat(const QString& name);
25        static QString autoDetectFormat(const QFile& file);
26};
27
28/****************************************************************************
29  FileFormat (I/O) implementations
30 ***************************************************************************/
31
32class JonesFileFormat : public FileFormat {
33public:
34        static int jones_column_to_integer(const Column& col);
35        static Column jones_integer_to_column(int integer);
36
37        bool write(QFile& target, const Deck& source) const;
38        bool read(QFile& source, Deck& target) const;
39};
40
41class PunchCardMarkupLanguageFormat : public FileFormat {
42public:
43        bool write(QFile& target, const Deck& source) const { return false; }
44        bool read(QFile& source, Deck& target) const { return false; }
45};
46
47}; // namespace
48
49
50#endif // FORMAT_H
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License