filesystem improvements

library directory tree improved in order to better comply with unix fs
hierarchy standard
This commit is contained in:
giomba 2019-08-17 14:29:43 +02:00
parent 9b093be81e
commit 91492cad20
7 changed files with 38 additions and 57 deletions

View File

@ -1,5 +1,10 @@
#ifndef CONVERT_H #ifndef CNS_H
#define CONVERT_H #define CNS_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winscard.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -11,12 +16,31 @@
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include "Ex.h" // QT -- What to export
//#define CNS Q_DECL_EXPORT CNS
#include "read_dati_personali_c.h" // PCSCLITE
// --------------------------------------------------------------------
int read_dati_personali_c(char** output_buffer, int* len);
#define CNS Q_DECL_EXPORT CNS // EXCEPTIONS
// --------------------------------------------------------------------
/* `explicit` specifier forces constructors to not being implicitly called */
class Ex {
private:
std::string msg;
public:
explicit Ex();
explicit Ex(const char* msg);
explicit Ex(const std::string& msg);
friend std::ostream& operator<<(std::ostream&, const Ex&);
};
/* Parent::Parent makes classes inherit their constructors from parents (C++11) */
class ExPCSC : public Ex { using Ex::Ex; };
// CNS
// --------------------------------------------------------------------
enum Sex { enum Sex {
F, F,
M M

View File

@ -1,4 +1,4 @@
#include "Ex.h" #include "CNS.h"
Ex::Ex() { Ex::Ex() {
this->msg = std::string("generic exception"); this->msg = std::string("generic exception");
@ -12,13 +12,7 @@ Ex::Ex(const std::string& msg) {
this->msg = msg; this->msg = msg;
} }
/*
Ex::Ex(const char* msg, int n) {
this->msg = std::string(msg) + ": " + strerror(n);
}
*/
std::ostream& operator<<(std::ostream& os, const Ex& e) { std::ostream& operator<<(std::ostream& os, const Ex& e) {
os << e.msg; os << e.msg;
return os; return os;
} }

View File

@ -1,21 +0,0 @@
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include <iostream>
#include <string>
/* `explicit` specifier forces constructors to not being implicitly called */
class Ex {
private:
std::string msg;
public:
explicit Ex();
explicit Ex(const char* msg);
explicit Ex(const std::string& msg);
friend std::ostream& operator<<(std::ostream&, const Ex&);
};
/* Parent::Parent makes classes inherit their constructors from parents (C++11) */
class ExPCSC : public Ex { using Ex::Ex; };
#endif

View File

@ -28,10 +28,10 @@ SOURCES += \
read_dati_personali_c.cpp read_dati_personali_c.cpp
HEADERS += \ HEADERS += \
CNS.h \ CNS.h
Ex.h \
read_dati_personali_c.h
INSTALLS += target
target.path = /usr/lib target.path = /usr/lib
headers.path = /usr/include
headers.files += $$HEADERS
INSTALLS += target headers

View File

@ -1,4 +1,4 @@
#include "read_dati_personali_c.h" #include "CNS.h"
/* /*
`` ``

View File

@ -1,16 +0,0 @@
#ifndef READ_DATI_PERSONALI_H
#define READ_DATI_PERSONALI_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <winscard.h>
#include "Ex.h"
int read_dati_personali_c(char** output_buffer, int* len);
#endif

View File

@ -2,7 +2,7 @@
#include <QTextStream> #include <QTextStream>
#include "../lib/CNS.h" #include <CNS.h>
int main(void) { int main(void) {
CNS cns; CNS cns;