exeptions.cpp

Idź do dokumentacji tego pliku.
00001 #include "exeptions.h"
00002 //konstruktory
00003 Exeptions::Exeptions(const QString & Troublemaker_comment)
00004 {
00005     troublemaker_comment = Troublemaker_comment;
00006     place = -1;
00007     makeErrorMessage(1);
00008 }
00009 Exeptions::Exeptions(int Error_number,const QString & Troublemaker_comment)
00010 {
00011     troublemaker_comment = Troublemaker_comment;
00012     error_number = Error_number;
00013     place = -1;
00014     makeErrorMessage(2);
00015 }
00016 Exeptions::Exeptions(int Error_number,const QString & Reason,const QString & Troublemaker_comment)
00017 {
00018     troublemaker_comment = Troublemaker_comment;
00019     error_number = Error_number;
00020     reason = Reason;
00021     place = -1;
00022     makeErrorMessage(3);
00023 }
00024 Exeptions::Exeptions(int Error_number,const QString & Reason,int Place,const QString & Troublemaker_comment)
00025 {
00026     troublemaker_comment = Troublemaker_comment;
00027     error_number = Error_number;
00028     reason = Reason;
00029     place = Place;
00030     makeErrorMessage(4);
00031 }
00032 Exeptions::Exeptions(int Error_number,const QString & Reason,const QString & Place_words,const QString & Troublemaker_comment)
00033 {
00034     troublemaker_comment = Troublemaker_comment;
00035     error_number = Error_number;
00036     reason = Reason;
00037     place_words = Place_words;
00038     place = -1;
00039     makeErrorMessage(5);
00040 }
00041 QString Exeptions::getErrorMessage()//zwraca komunikat bledu
00042 {
00043     return error_message;
00044 }        
00045 void Exeptions::makeErrorMessage(int detail_level)//tworzy komunikat bledu
00046 {
00047     QString linia0("Blad nr: ");
00048     QString linia1("Powod bledu: ");
00049     QString linia2("Miejsce zdazenia: ");
00050     QString linia3("Komentarz: ");
00051     switch(detail_level)
00052     {
00053         case 5:
00054         {
00055             linia2 = linia2 + "<strong>"  + place_words + "</strong>";
00056         }
00057         case 4:
00058         {
00059             if(detail_level != 5)
00060             {
00061                 linia2 = linia2 + "<strong>" + QString("%1").arg(place) + "</strong>";
00062             }
00063         }
00064         case 3:
00065         {
00066             linia1 = linia1 + "<strong>" + reason + "</strong>";
00067         }
00068         case 2:
00069         {
00070             linia0 = linia0 + "<strong>" + QString("%1").arg(error_number) + "</strong>"; 
00071         }
00072         default:
00073         {
00074             if(detail_level < 2)
00075             {
00076                 linia0 += "<strong>BRAK</strong>";
00077             }
00078             if(reason.isEmpty() == true)
00079             {
00080                 linia1 += "<strong>BRAK</strong>";
00081             }
00082             if(place_words.isEmpty() == true && place < 0)
00083             {
00084                 linia2 += "<strong>BRAK</strong>";
00085             }
00086             if(troublemaker_comment.isEmpty() == false)
00087             {
00088                 linia3 = linia3 + "<strong>" + troublemaker_comment + "</strong>";
00089             }
00090             else
00091             {
00092                 linia3 = linia3 + "<strong>" + "BRAK" + "</strong>";
00093             }
00094             linia0+="<br>";         
00095             linia1+="<br>";
00096             linia2+="<br>";
00097             linia3+="<br>";
00098             break;          
00099         }
00100     }
00101             error_message = linia0 + linia1 + linia2 + linia3;
00102 }
00103 

Wygenerowano Sun Jun 11 12:55:08 2006 dla lanChat programem  doxygen 1.4.6