show.cpp 931 Bytes
Newer Older
Mario Bajer's avatar
Mario Bajer committed
1
2
3
/** @file show.cpp
 *  @brief Enthält die Logik um ein Matrix File als Json anzeigen zu lassen.
 * */
4

Mario Bajer's avatar
cleanup  
Mario Bajer committed
5
#include "Matrix.hpp"
Mario Bajer's avatar
Mario Bajer committed
6
#include "notmatrix.hpp"
Mario Bajer's avatar
cleanup  
Mario Bajer committed
7

8
int main(){                             // idee: schwarz/weiß pixel zur darstellung von matrixelementen mit https://www.w3schools.com/html/html5_canvas.asp
9
    Cgicc formData;
Mario Bajer's avatar
cleanup  
Mario Bajer committed
10

11
12
    htmlHeader("show.cgi");
    cout << "<body>\n";
Mario Bajer's avatar
Mario Bajer committed
13
    cout << "<div class = \"container\">" << endl;
14
    cout << "<br>" << endl;
Mario Bajer's avatar
Mario Bajer committed
15
16
    string folderpath;
    auto fi = formData.getElement("showBtn");
17
    if( !fi->isEmpty() && fi != (*formData).end()) {
Mario Bajer's avatar
cleanup  
Mario Bajer committed
18
19
20
21
22
23
        folderpath = **fi;
    }
    else {
        cout << "Error!" << endl;
    }

Mario Bajer's avatar
Mario Bajer committed
24
25
26
    Matrix matrix(2, 2);
    matrix.getmatrixfromfile(folderpath);
    matrix.print(cout);
Mario Bajer's avatar
cleanup  
Mario Bajer committed
27

Mario Bajer's avatar
Mario Bajer committed
28
    cout << "<a href=\"http://localhost:80/index.html\">Back to Index</a>";
Mario Bajer's avatar
cleanup    
Mario Bajer committed
29
    cout << "</div>" << endl;
Mario Bajer's avatar
cleanup  
Mario Bajer committed
30
31
32
33
    cout << "</body>\n";
    cout << "</html>\n";
    return 0;
}