diff --git a/LICENSE b/LICENSE index 5cf9523..6d9e234 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,20 @@ 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. diff --git a/main.cpp b/main.cpp index 5d4e6ba..e04af97 100644 --- a/main.cpp +++ b/main.cpp @@ -1,25 +1,25 @@ -/* +/* * Ferienwohnung Management * File: main.cpp - * + * * Author: Dominic Reich * Created on 20. Februar 2016, 16:11 * Last modified: Freitag, 04.03.2016 23:39 - * + * * The MIT License (MIT) {{{ - * + * * Copyright (c) 2015 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: - * + * * 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 @@ -27,7 +27,7 @@ * 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. }}} - * + * */ #include @@ -75,18 +75,18 @@ void ToggleEntry( const char *Filename, const char *Counter ); * Main */ int main( int argc, char** argv ) { - + char cAuswahl; const char * cFilename = "daten.txt"; const char * cCounter = "counter.txt"; - + unsigned int iGesamt = 0; unsigned int * pGesamt; pGesamt = &iGesamt; - + ClearScreen(); SetTitle( "Ferienwohnung Reich : Blacklist" ); - + do{ ifstream Counter( cCounter, ios::in ); if( !Counter.is_open() ){ @@ -95,9 +95,9 @@ int main( int argc, char** argv ) { } Counter >> *pGesamt; Counter.close(); - + cAuswahl = GetChoice( *pGesamt ); - + switch( cAuswahl ) { case 'n': case 'N': { @@ -165,15 +165,15 @@ void ClearScreen() { char GetChoice( unsigned int &x ) { int bis; char Choice; - + unsigned int * px = &x; - + if( *px < MAX_LIST ) { bis = *px; } else { bis = MAX_LIST; } - + cout << HEADER; cout << LINES << endl; cout << " [ n ] Neuen Gast hinzufuegen\n"; @@ -184,7 +184,7 @@ char GetChoice( unsigned int &x ) { cout << " [ q ] Programm beenden\n" << endl; cout << "Auswahl: "; cin >> Choice; - + return Choice; } @@ -194,7 +194,7 @@ char GetChoice( unsigned int &x ) { void NewEntry( unsigned int &x, const char *Filename, const char *Counter ) { int pos = 0; cin.ignore(); - + ofstream DataFile( Filename, ios::out | ios::app ); if( !DataFile.is_open() ) { 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 ); cout << "Kommentar: "; getline( cin, Kommentar ); - + if( Telefon.empty() ) Telefon = "-"; if( Email.empty() ) Email = "-"; if( Kommentar.empty() ) Kommentar = "-"; - + while( ( pos = Name.find(' ')) != string::npos ) Name[pos] = '*'; while( ( pos = Strasse.find(' ')) != string::npos ) Strasse[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 << "\t1" << endl; DataFile.close(); - + ofstream CounterFile( Counter, ios::out ); if( !CounterFile.is_open() ) { cout << "Konnte die Datei " << Counter << " nicht oeffnen." << endl; exit(1); } - + CounterFile << *px; 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 ) { unsigned int * px = &x; int bis; - + if( *px < MAX_LIST ) { bis = 0; } else { bis = *px - MAX_LIST; } - + ifstream DataFile( Filename, ios::in ); if( !DataFile.is_open() ) { cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl; exit(1); } - + unsigned int Id; string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar; bool Active; - + cout << "Es werden die letzten " << *px - bis << " Eintraege angezeigt.\n" << endl; cout << LINES << endl; - + DataFile.seekg( ios::beg ); for( int i = 0; i < bis; i++ ) { DataFile.ignore( numeric_limits::max(), '\n' ); } - + while( DataFile >> Id >> Name >> Strasse >> Plz >> Ort >> Telefon >> Email >> Kommentar >> Active ) { PrintSingleGuest( *px, Id, Name, Strasse, Plz, Ort, Telefon, Email, Kommentar, Active ); } - + DataFile.close(); PressKeyToContinue(); } @@ -291,20 +291,20 @@ void PrintInfo() { #ifndef _WIN32 cout << "\033[1;32m"; #endif - cout << "\n Dominic Reich Kontakt: dominic@mm.st\n"; - cout << " Seite 37 http://dominicreich.com/work/tools/\n 6433 Oetz\n"; - cout << " AUSTRIA Version: " << Version::FULLVERSION_STRING << Version::STATUS_SHORT; + cout << "\n Dominic Reich Kontakt: dominic@mm.st\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 << " (" << Version::STATUS << ")\n\n"; cout << " https://github.com/freefallcid/Fewo-Blacklist/\n\n"; #ifndef _WIN32 cout << "\033[0m"; #endif - + cout << "Dieses Programm ist lizenziert unter der MIT Lizenz.\n"; - + //PressKeyToContinue(); string line; - + ifstream LicenseFile( LICENSE_FILE ); if( !LicenseFile.is_open() ) { cout << endl; @@ -318,9 +318,9 @@ void PrintInfo() { cout << line << endl; } } - + LicenseFile.close(); - + cout << "Weiter mit "; cin.get(); //PressKeyToContinue(); @@ -340,37 +340,37 @@ void PressKeyToContinue() { */ void SearchGuests( unsigned int &x, const char *Filename ) { unsigned int * px = &x; - + ifstream DataFile( Filename, ios::in ); if( !DataFile.is_open() ) { cout << "Konnte die Datei " << Filename << "nicht oeffnen." << endl; exit(1); } - + unsigned int Id; string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar; bool Active; int pos = 0; - + string s = ""; string f = ""; - + cin.ignore(); //DataFile.seekg(0, DataFile.beg); - + cout << "\nSuchbegriff: "; getline( cin, s ); while( ( pos = s.find(' ')) != string::npos ) s[pos] = '*'; - + ClearScreen(); - + //#ifndef _WIN32 cout << "\033[1;34mSuchergebnisse fuer '\033[1;32m" << s << "\033[1;34m':\033[0m\n" << endl; //#else // cout << "Suchergebnisse fuer '" << s << "':\n" << endl; //#endif cout << LINES << endl; - + while( DataFile >> Id >> Name >> Strasse >> Plz >> Ort >> Telefon >> Email >> Kommentar >> Active ) { f = Name + " " + Strasse + " " + Plz + " " + Ort + " " + Telefon + " " + Email + " " + Kommentar; 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 ); } } - + cout << "\nWeiter mit "; cin.get(); //PressKeyToContinue(); - + ClearScreen(); DataFile.close(); //PressKeyToContinue(); @@ -395,20 +395,20 @@ void PrintSingleGuest( unsigned int &x, unsigned int Id, string Name, string Str unsigned int * px = &x; int pos = 0; string sAktiv = ""; - + if( Active == true ) { sAktiv = "AKTIV"; } else { sAktiv = "INAKTIV"; } - + while( ( pos = Name.find('*')) != string::npos ) Name[pos] = ' '; while( ( pos = Strasse.find('*')) != string::npos ) Strasse[pos] = ' '; while( ( pos = Ort.find('*')) != string::npos ) Ort[pos] = ' '; while( ( pos = Telefon.find('*')) != string::npos ) Telefon[pos] = ' '; while( ( pos = Email.find('*')) != string::npos ) Email[pos] = ' '; while( ( pos = Kommentar.find('*')) != string::npos ) Kommentar[pos] = ' '; - + cout << SetBoldText( Name ) << ", " << Strasse << ", " << Plz << " " << Ort << "\n"; cout << "Email: " << SetBoldText( Email ) << "\tTelefon: " << Telefon; cout << "\nKommentar: " << Kommentar; @@ -456,14 +456,14 @@ string SetBoldText( string Text ) { void ToggleEntry( const char *Filename, const char *Counter ) { // int pos = 0; // cin.ignore(); -// +// // ofstream DataFile( Filename, ios::out | ios::app ); // if( !DataFile.is_open() ) { // cout << "Konnte die Datei " << Filename << " nicht oeffnen." << endl; // exit(1); // } // string Name, Strasse, Plz, Ort, Telefon, Email, Kommentar; -// +// // DataFile.close(); cout << "Sorry, diese Funktion ist noch in Arbeit." << endl; PressKeyToContinue(); diff --git a/version.h b/version.h index 7ec1751..f6a5482 100644 --- a/version.h +++ b/version.h @@ -1,4 +1,4 @@ -/* +/* * Ferienwohnung Blacklist Version Information * File: version.h * @@ -13,20 +13,20 @@ #define VERSION_H namespace Version{ - + //Software Status static const char STATUS[] = "Beta"; static const char STATUS_SHORT[] = "b"; - + //Standard Version Type static const long MAJOR = 0; static const long MINOR = 2; - static const long BUILD = 1; + static const long BUILD = 2; //static const long REVISION = 0; - + //Miscellaneous Version Types //static const long BUILDS_COUNT = 0; - static const char FULLVERSION_STRING [] = "0.2.1"; + static const char FULLVERSION_STRING [] = "0.2.2"; }