update address and formatting

master
Dominic Reich 6 years ago
parent b00b8f679b
commit 380e279455
No known key found for this signature in database
GPG Key ID: 2664FE98B15DDE4F

@ -1,8 +1,20 @@
Copyright 2016 Dominic Reich Copyright 2016 Dominic Reich
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,25 +1,25 @@
/* /*
* Ferienwohnung Management * Ferienwohnung Management
* File: main.cpp * File: main.cpp
* *
* Author: Dominic Reich <dominic@tmsn.at> * Author: Dominic Reich <dominic@tmsn.at>
* Created on 20. Februar 2016, 16:11 * Created on 20. Februar 2016, 16:11
* Last modified: Freitag, 04.03.2016 23:39 * Last modified: Freitag, 04.03.2016 23:39
* *
* The MIT License (MIT) {{{ * The MIT License (MIT) {{{
* *
* Copyright (c) 2015 Dominic Reich * Copyright (c) 2015 Dominic Reich
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights * in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is * copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: * furnished to do so, subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. * copies or substantial portions of the Software.
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -27,7 +27,7 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. }}} * SOFTWARE. }}}
* *
*/ */
#include <iostream> #include <iostream>
@ -75,18 +75,18 @@ void ToggleEntry( const char *Filename, const char *Counter );
* Main * Main
*/ */
int main( int argc, char** argv ) { int main( int argc, char** argv ) {
char cAuswahl; char cAuswahl;
const char * cFilename = "daten.txt"; const char * cFilename = "daten.txt";
const char * cCounter = "counter.txt"; const char * cCounter = "counter.txt";
unsigned int iGesamt = 0; unsigned int iGesamt = 0;
unsigned int * pGesamt; unsigned int * pGesamt;
pGesamt = &iGesamt; pGesamt = &iGesamt;
ClearScreen(); ClearScreen();
SetTitle( "Ferienwohnung Reich : Blacklist" ); SetTitle( "Ferienwohnung Reich : Blacklist" );
do{ do{
ifstream Counter( cCounter, ios::in ); ifstream Counter( cCounter, ios::in );
if( !Counter.is_open() ){ if( !Counter.is_open() ){
@ -95,9 +95,9 @@ int main( int argc, char** argv ) {
} }
Counter >> *pGesamt; Counter >> *pGesamt;
Counter.close(); Counter.close();
cAuswahl = GetChoice( *pGesamt ); cAuswahl = GetChoice( *pGesamt );
switch( cAuswahl ) { switch( cAuswahl ) {
case 'n': case 'n':
case 'N': { case 'N': {
@ -165,15 +165,15 @@ void ClearScreen() {
char GetChoice( unsigned int &x ) { char GetChoice( unsigned int &x ) {
int bis; int bis;
char Choice; char Choice;
unsigned int * px = &x; unsigned int * px = &x;
if( *px < MAX_LIST ) { if( *px < MAX_LIST ) {
bis = *px; bis = *px;
} else { } else {
bis = MAX_LIST; bis = MAX_LIST;
} }
cout << HEADER; cout << HEADER;
cout << LINES << endl; cout << LINES << endl;
cout << " [ n ] Neuen Gast hinzufuegen\n"; cout << " [ n ] Neuen Gast hinzufuegen\n";
@ -184,7 +184,7 @@ char GetChoice( unsigned int &x ) {
cout << " [ q ] Programm beenden\n" << endl; cout << " [ q ] Programm beenden\n" << endl;
cout << "Auswahl: "; cout << "Auswahl: ";
cin >> Choice; cin >> Choice;
return Choice; return Choice;
} }
@ -194,7 +194,7 @@ char GetChoice( unsigned int &x ) {
void NewEntry( unsigned int &x, const char *Filename, const char *Counter ) { void NewEntry( unsigned int &x, const char *Filename, const char *Counter ) {
int pos = 0; int pos = 0;
cin.ignore(); cin.ignore();
ofstream DataFile( Filename, ios::out | ios::app ); ofstream DataFile( Filename, ios::out | ios::app );
if( !DataFile.is_open() ) { if( !DataFile.is_open() ) {
cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl; cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl;
@ -215,11 +215,11 @@ void NewEntry( unsigned int &x, const char *Filename, const char *Counter ) {
getline( cin, Email ); getline( cin, Email );
cout << "Kommentar: "; cout << "Kommentar: ";
getline( cin, Kommentar ); getline( cin, Kommentar );
if( Telefon.empty() ) Telefon = "-"; if( Telefon.empty() ) Telefon = "-";
if( Email.empty() ) Email = "-"; if( Email.empty() ) Email = "-";
if( Kommentar.empty() ) Kommentar = "-"; if( Kommentar.empty() ) Kommentar = "-";
while( ( pos = Name.find(' ')) != string::npos ) Name[pos] = '*'; while( ( pos = Name.find(' ')) != string::npos ) Name[pos] = '*';
while( ( pos = Strasse.find(' ')) != string::npos ) Strasse[pos] = '*'; while( ( pos = Strasse.find(' ')) != string::npos ) Strasse[pos] = '*';
while( ( pos = Ort.find(' ')) != string::npos ) Ort[pos] = '*'; while( ( pos = Ort.find(' ')) != string::npos ) Ort[pos] = '*';
@ -233,13 +233,13 @@ void NewEntry( unsigned int &x, const char *Filename, const char *Counter ) {
DataFile << Ort << "\t" << Telefon << "\t" << Email << "\t" << Kommentar; DataFile << Ort << "\t" << Telefon << "\t" << Email << "\t" << Kommentar;
DataFile << "\t1" << endl; DataFile << "\t1" << endl;
DataFile.close(); DataFile.close();
ofstream CounterFile( Counter, ios::out ); ofstream CounterFile( Counter, ios::out );
if( !CounterFile.is_open() ) { if( !CounterFile.is_open() ) {
cout << "Konnte die Datei " << Counter << " nicht oeffnen." << endl; cout << "Konnte die Datei " << Counter << " nicht oeffnen." << endl;
exit(1); exit(1);
} }
CounterFile << *px; CounterFile << *px;
CounterFile.close(); CounterFile.close();
} }
@ -250,35 +250,35 @@ void NewEntry( unsigned int &x, const char *Filename, const char *Counter ) {
void ListGuests( unsigned int &x, const char *Filename ) { void ListGuests( unsigned int &x, const char *Filename ) {
unsigned int * px = &x; unsigned int * px = &x;
int bis; int bis;
if( *px < MAX_LIST ) { if( *px < MAX_LIST ) {
bis = 0; bis = 0;
} else { } else {
bis = *px - MAX_LIST; bis = *px - MAX_LIST;
} }
ifstream DataFile( Filename, ios::in ); ifstream DataFile( Filename, ios::in );
if( !DataFile.is_open() ) { if( !DataFile.is_open() ) {
cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl; cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl;
exit(1); exit(1);
} }
unsigned int Id; unsigned int Id;
string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar; string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar;
bool Active; bool Active;
cout << "Es werden die letzten " << *px - bis << " Eintraege angezeigt.\n" << endl; cout << "Es werden die letzten " << *px - bis << " Eintraege angezeigt.\n" << endl;
cout << LINES << endl; cout << LINES << endl;
DataFile.seekg( ios::beg ); DataFile.seekg( ios::beg );
for( int i = 0; i < bis; i++ ) { for( int i = 0; i < bis; i++ ) {
DataFile.ignore( numeric_limits<streamsize>::max(), '\n' ); DataFile.ignore( numeric_limits<streamsize>::max(), '\n' );
} }
while( DataFile >> Id >> Name >> Strasse >> Plz >> Ort >> Telefon >> Email >> Kommentar >> Active ) { while( DataFile >> Id >> Name >> Strasse >> Plz >> Ort >> Telefon >> Email >> Kommentar >> Active ) {
PrintSingleGuest( *px, Id, Name, Strasse, Plz, Ort, Telefon, Email, Kommentar, Active ); PrintSingleGuest( *px, Id, Name, Strasse, Plz, Ort, Telefon, Email, Kommentar, Active );
} }
DataFile.close(); DataFile.close();
PressKeyToContinue(); PressKeyToContinue();
} }
@ -291,20 +291,20 @@ void PrintInfo() {
#ifndef _WIN32 #ifndef _WIN32
cout << "\033[1;32m"; cout << "\033[1;32m";
#endif #endif
cout << "\n Dominic Reich Kontakt: dominic@mm.st\n"; cout << "\n Dominic Reich Kontakt: dominic@mm.st\n";
cout << " Seite 37 http://dominicreich.com/work/tools/\n 6433 Oetz\n"; cout << " Unterlängenfeld 310 Top 2 http://dominicreich.com/work/tools/\n 6444 Längenfeld\n";
cout << " AUSTRIA Version: " << Version::FULLVERSION_STRING << Version::STATUS_SHORT; cout << " AUSTRIA Version: " << Version::FULLVERSION_STRING << Version::STATUS_SHORT;
cout << " (" << Version::STATUS << ")\n\n"; cout << " (" << Version::STATUS << ")\n\n";
cout << " https://github.com/freefallcid/Fewo-Blacklist/\n\n"; cout << " https://github.com/freefallcid/Fewo-Blacklist/\n\n";
#ifndef _WIN32 #ifndef _WIN32
cout << "\033[0m"; cout << "\033[0m";
#endif #endif
cout << "Dieses Programm ist lizenziert unter der MIT Lizenz.\n"; cout << "Dieses Programm ist lizenziert unter der MIT Lizenz.\n";
//PressKeyToContinue(); //PressKeyToContinue();
string line; string line;
ifstream LicenseFile( LICENSE_FILE ); ifstream LicenseFile( LICENSE_FILE );
if( !LicenseFile.is_open() ) { if( !LicenseFile.is_open() ) {
cout << endl; cout << endl;
@ -318,9 +318,9 @@ void PrintInfo() {
cout << line << endl; cout << line << endl;
} }
} }
LicenseFile.close(); LicenseFile.close();
cout << "Weiter mit <ENTER>"; cout << "Weiter mit <ENTER>";
cin.get(); cin.get();
//PressKeyToContinue(); //PressKeyToContinue();
@ -340,37 +340,37 @@ void PressKeyToContinue() {
*/ */
void SearchGuests( unsigned int &x, const char *Filename ) { void SearchGuests( unsigned int &x, const char *Filename ) {
unsigned int * px = &x; unsigned int * px = &x;
ifstream DataFile( Filename, ios::in ); ifstream DataFile( Filename, ios::in );
if( !DataFile.is_open() ) { if( !DataFile.is_open() ) {
cout << "Konnte die Datei " << Filename << "nicht oeffnen." << endl; cout << "Konnte die Datei " << Filename << "nicht oeffnen." << endl;
exit(1); exit(1);
} }
unsigned int Id; unsigned int Id;
string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar; string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar;
bool Active; bool Active;
int pos = 0; int pos = 0;
string s = ""; string s = "";
string f = ""; string f = "";
cin.ignore(); cin.ignore();
//DataFile.seekg(0, DataFile.beg); //DataFile.seekg(0, DataFile.beg);
cout << "\nSuchbegriff: "; cout << "\nSuchbegriff: ";
getline( cin, s ); getline( cin, s );
while( ( pos = s.find(' ')) != string::npos ) s[pos] = '*'; while( ( pos = s.find(' ')) != string::npos ) s[pos] = '*';
ClearScreen(); ClearScreen();
//#ifndef _WIN32 //#ifndef _WIN32
cout << "\033[1;34mSuchergebnisse fuer '\033[1;32m" << s << "\033[1;34m':\033[0m\n" << endl; cout << "\033[1;34mSuchergebnisse fuer '\033[1;32m" << s << "\033[1;34m':\033[0m\n" << endl;
//#else //#else
// cout << "Suchergebnisse fuer '" << s << "':\n" << endl; // cout << "Suchergebnisse fuer '" << s << "':\n" << endl;
//#endif //#endif
cout << LINES << endl; cout << LINES << endl;
while( DataFile >> Id >> Name >> Strasse >> Plz >> Ort >> Telefon >> Email >> Kommentar >> Active ) { while( DataFile >> Id >> Name >> Strasse >> Plz >> Ort >> Telefon >> Email >> Kommentar >> Active ) {
f = Name + " " + Strasse + " " + Plz + " " + Ort + " " + Telefon + " " + Email + " " + Kommentar; f = Name + " " + Strasse + " " + Plz + " " + Ort + " " + Telefon + " " + Email + " " + Kommentar;
size_t found = f.find( s ); size_t found = f.find( s );
@ -378,11 +378,11 @@ void SearchGuests( unsigned int &x, const char *Filename ) {
PrintSingleGuest( *px, Id, Name, Strasse, Plz, Ort, Telefon, Email, Kommentar, Active ); PrintSingleGuest( *px, Id, Name, Strasse, Plz, Ort, Telefon, Email, Kommentar, Active );
} }
} }
cout << "\nWeiter mit <ENTER>"; cout << "\nWeiter mit <ENTER>";
cin.get(); cin.get();
//PressKeyToContinue(); //PressKeyToContinue();
ClearScreen(); ClearScreen();
DataFile.close(); DataFile.close();
//PressKeyToContinue(); //PressKeyToContinue();
@ -395,20 +395,20 @@ void PrintSingleGuest( unsigned int &x, unsigned int Id, string Name, string Str
unsigned int * px = &x; unsigned int * px = &x;
int pos = 0; int pos = 0;
string sAktiv = ""; string sAktiv = "";
if( Active == true ) { if( Active == true ) {
sAktiv = "AKTIV"; sAktiv = "AKTIV";
} else { } else {
sAktiv = "INAKTIV"; sAktiv = "INAKTIV";
} }
while( ( pos = Name.find('*')) != string::npos ) Name[pos] = ' '; while( ( pos = Name.find('*')) != string::npos ) Name[pos] = ' ';
while( ( pos = Strasse.find('*')) != string::npos ) Strasse[pos] = ' '; while( ( pos = Strasse.find('*')) != string::npos ) Strasse[pos] = ' ';
while( ( pos = Ort.find('*')) != string::npos ) Ort[pos] = ' '; while( ( pos = Ort.find('*')) != string::npos ) Ort[pos] = ' ';
while( ( pos = Telefon.find('*')) != string::npos ) Telefon[pos] = ' '; while( ( pos = Telefon.find('*')) != string::npos ) Telefon[pos] = ' ';
while( ( pos = Email.find('*')) != string::npos ) Email[pos] = ' '; while( ( pos = Email.find('*')) != string::npos ) Email[pos] = ' ';
while( ( pos = Kommentar.find('*')) != string::npos ) Kommentar[pos] = ' '; while( ( pos = Kommentar.find('*')) != string::npos ) Kommentar[pos] = ' ';
cout << SetBoldText( Name ) << ", " << Strasse << ", " << Plz << " " << Ort << "\n"; cout << SetBoldText( Name ) << ", " << Strasse << ", " << Plz << " " << Ort << "\n";
cout << "Email: " << SetBoldText( Email ) << "\tTelefon: " << Telefon; cout << "Email: " << SetBoldText( Email ) << "\tTelefon: " << Telefon;
cout << "\nKommentar: " << Kommentar; cout << "\nKommentar: " << Kommentar;
@ -456,14 +456,14 @@ string SetBoldText( string Text ) {
void ToggleEntry( const char *Filename, const char *Counter ) { void ToggleEntry( const char *Filename, const char *Counter ) {
// int pos = 0; // int pos = 0;
// cin.ignore(); // cin.ignore();
// //
// ofstream DataFile( Filename, ios::out | ios::app ); // ofstream DataFile( Filename, ios::out | ios::app );
// if( !DataFile.is_open() ) { // if( !DataFile.is_open() ) {
// cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl; // cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl;
// exit(1); // exit(1);
// } // }
// string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar; // string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar;
// //
// DataFile.close(); // DataFile.close();
cout << "Sorry, diese Funktion ist noch in Arbeit." << endl; cout << "Sorry, diese Funktion ist noch in Arbeit." << endl;
PressKeyToContinue(); PressKeyToContinue();

@ -1,4 +1,4 @@
/* /*
* Ferienwohnung Blacklist Version Information * Ferienwohnung Blacklist Version Information
* File: version.h * File: version.h
* *
@ -13,20 +13,20 @@
#define VERSION_H #define VERSION_H
namespace Version{ namespace Version{
//Software Status //Software Status
static const char STATUS[] = "Beta"; static const char STATUS[] = "Beta";
static const char STATUS_SHORT[] = "b"; static const char STATUS_SHORT[] = "b";
//Standard Version Type //Standard Version Type
static const long MAJOR = 0; static const long MAJOR = 0;
static const long MINOR = 2; static const long MINOR = 2;
static const long BUILD = 1; static const long BUILD = 2;
//static const long REVISION = 0; //static const long REVISION = 0;
//Miscellaneous Version Types //Miscellaneous Version Types
//static const long BUILDS_COUNT = 0; //static const long BUILDS_COUNT = 0;
static const char FULLVERSION_STRING [] = "0.2.1"; static const char FULLVERSION_STRING [] = "0.2.2";
} }

Loading…
Cancel
Save