QtGuiCallBacks.h

00001 #ifndef QTGUI_QTGUICALLBACKS_H
00002 #define QTGUI_QTGUICALLBACKS_H
00003 
00004 /*
00005  * RebeccaAIML, Artificial Intelligence Markup Language 
00006  * C++ api and engine.
00007  *
00008  * Copyright (C) 2005 Frank Hassanabad
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or (at your option) any later version.
00014  *
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023  */
00024 
00025 //rebecca includes
00026 #include <rebecca/CallBacks.h>
00027 
00028 //std includes
00029 #include <iostream>
00030 
00031 //Qt includes
00032 #include <QTextEdit>
00033 #include <QScrollBar>
00034 #include <QObject>
00035 
00036 namespace qtgui
00037 {
00038 
00039 using namespace rebecca;
00040 using namespace std;
00041 
00055 class QtGuiCallBacks : public QObject, public CallBacks
00056 {
00057     Q_OBJECT
00058 
00059     public:
00060         
00073         void storeGossip(const char * const gossip) 
00074         { 
00075             QString output;
00076             output += "[Gossip: ";
00077             output += gossip;
00078             output += " ]";
00079             emit addText(output);
00080         }
00081 
00093         void categoryLoaded()
00094         {
00095             static int i = 0;
00096             const int numberOfCategories = 5000;
00097             
00098             /*
00099              * Clever way to say if "i" is a multiple 
00100              * of 5000 then print out the number of 
00101              * categories loaded so far.
00102              */
00103             if(++i % numberOfCategories == 0)
00104             {
00105                 QString num;
00106                 num.setNum(i);
00107                 QString output;
00108                 output += "[";
00109                 output += num;
00110                 output += " categories loaded]";
00111                 emit addText(output);
00112             }
00113         }
00114 
00120         void filePreLoad(const char *const fileName)
00121         {
00122             QString output;
00123             output += "[Loading      ";
00124             output += fileName;
00125             output += "]";
00126             emit addText(output);
00127         }
00128         
00134         void filePostLoad(const char *const fileName)
00135         {
00136             QString output;
00137             output += "[Done loading ";
00138             output += fileName;
00139             output += "]";
00140             emit addText(output);
00141         }
00142 
00154         void symbolicReduction(const char *const symbol)
00155         {
00156             QString output;
00157             output += "Symbolic reduction: ";
00158             output += symbol;
00159             emit addText(output);
00160         }
00161 
00170         void infiniteSymbolicReduction()
00171         {
00172             emit addText("[Infinite Symbolic reduction detected]");
00173         }
00174         
00183         virtual void XMLParseError(const char * const message) 
00184         { 
00185             emit addText(message);
00186         } 
00187 
00196         virtual void XMLParseWarning(const char * const message)
00197         { 
00198             emit addText(message);
00199         } 
00200 
00209         virtual void XMLParseFatalError(const char * const message) 
00210         { 
00211             emit addText(message);
00212         } 
00213         
00220         virtual void thatStarTagSizeExceeded() 
00221         { 
00222             emit addText("[Warning thatStar Tag Size Exceeded]");
00223         }
00224         
00231         virtual void topicStarTagSizeExceeded() 
00232         { 
00233             emit addText("[Warning topicStar Tag Size Exceeded]");
00234         }
00235 
00242         virtual void starTagSizeExceeded() 
00243         { 
00244             emit addText("[Warning star Tag Size Exceeded]");
00245         }
00246 
00254         virtual void inputTagNumericConversionError(const char * const message) 
00255         { 
00256             QString output("inputTagNuermicConversionError:");
00257             output += message;
00258             emit addText(message);
00259         }
00260 
00267         virtual void inputTagSizeExceeded() 
00268         { 
00269             emit addText("[Warning input Tag Size Exceeded]");
00270         } 
00271 
00279         virtual void starTagNumericConversionError(const char * const message) 
00280         { 
00281             QString output("starTagNuermicConversionError:");
00282             output += message;
00283             emit addText(message);
00284         } 
00285 
00292         virtual void thatTagSizeExceeded() 
00293         { 
00294             emit addText("thatTag Size exceeded");
00295         }
00296 
00304         virtual void thatTagNumericConversionError(const char * const message) 
00305         { 
00306             QString output("thatTagNumericConversionError:");
00307             output += message;
00308             emit addText(output);
00309         } 
00310 
00318         virtual void topicStarTagNumericConversionError(const char * const message) 
00319         { 
00320             QString output("topicStarTagNumericConversionError:");
00321             output += message;
00322             emit addText(output);
00323         }   
00324         
00332         virtual void thatStarTagNumericConversionError(const char * const message) 
00333         { 
00334             QString output("thatStarTagNumericConversionError:");
00335             output += message;
00336             emit addText(output);
00337         }
00338 
00339     signals:
00340 
00347         void addText(const QString &text);
00348 };
00349 
00350 } //end of qtgui namespace
00351 
00352 #endif

Generated on Sat Mar 4 23:32:14 2006 for RebeccaAIML by  doxygen 1.4.5