source: projects/punch-card/punch-card-editor/src/qpunchcard/card.cc @ 52

Last change on this file since 52 was 52, checked in by sven, 14 years ago

Punch Card Editor: Code reordering and class renaming, rewriting.
Now using the namespace QPunchCard everywhere.

Parted the whole application into 5 parts/directories:

  • app: The application core with MainWindow and main() function
  • qpunchcard: Everything directly binary card related (no interpretation): modeling, input/output, view. Most important classes are Card, Deck, FileFormat, Widget
  • text: Everything related to text interpretation of Cards/Card Decks. Having the abstract Codec classes and the Text::Editor, Text::EditorDock
  • deckviewer: Application components like binary card editing central widget (CardEditor) and Navigator (Model View Controller classes)
  • driver: Basis for the driver framework, must be written soon.

Deck now hides the complete Storage to implement frontend methods that
implement versioning (Undo framework). All code was cleaned up, but doesn't
compile right now (still quite some non heavy errors).

-- Sven @ workstation

File size: 794 bytes
Line 
1#include "card.h"
2
3using namespace QPunchCard;
4
5
6/*
7void QPunchCard::changeCard(int card, const Column& new_value) {
8        if(!isValid(card))
9                return;
10        // TODO: PROBLEM: Alte Karte wird einfach
11        // weggeschmissen (tote referenz).
12        this->at(card) = new_value;
13}
14*/
15
16QDebug QPunchCard::operator<<(QDebug dbg, const Column &c) {
17        for(int x=0; x < 12; x++) {
18                // seperate in 3 nibbles
19                if(x && x%4==0) dbg.nospace() << " ";
20                dbg.nospace() << (c.testBit(x)?"1":"0");
21        }
22        //os << std::endl;
23        return dbg.nospace();
24}
25
26QDebug QPunchCard::operator<<(QDebug dbg, const Card &c) {
27        dbg.nospace() << "/   1234 5678 9012\n";
28        for(int x=0; x < 80; x++) {
29                dbg.nospace() << QString("|%1 ").arg(QString::number(x), 2, ' ').toAscii().data();
30                dbg.nospace() << c.column[x] << "\n";
31        }
32        return dbg.nospace();
33}
34
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