File indexing completed on 2024-04-28 15:35:14
0001 /*************************************************************************** 0002 * Copyright (C) 2004 by Tomas Mecir * 0003 * kmuddy@kmuddy.org * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU Library General Public License as * 0007 * published by the Free Software Foundation; either version 2 of the * 0008 * License, or (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU Library General Public License for more details. * 0014 ***************************************************************************/ 0015 #include "cmxpprocessor.h" 0016 0017 #include "cresulthandler.h" 0018 #include "cmxpstate.h" 0019 #include "cmxpparser.h" 0020 #include "centitymanager.h" 0021 #include "celementmanager.h" 0022 0023 cMXPProcessor::cMXPProcessor () 0024 { 0025 //create all the objects... 0026 results = new cResultHandler; 0027 entities = new cEntityManager; 0028 elements = new cElementManager (0, results, entities); 0029 state = new cMXPState (results, elements, entities); 0030 elements->assignMXPState (state); 0031 parser = new cMXPParser (state, elements, results); 0032 } 0033 0034 cMXPProcessor::~cMXPProcessor () 0035 { 0036 delete parser; 0037 parser = 0; 0038 delete state; 0039 state = 0; 0040 delete elements; 0041 elements = 0; 0042 delete entities; 0043 entities = 0; 0044 delete results; 0045 results = 0; 0046 } 0047 0048 void cMXPProcessor::processText (const char *text) 0049 { 0050 if (!text) 0051 return; 0052 parser->parse (text); 0053 } 0054 0055 mxpResult *cMXPProcessor::nextResult () 0056 { 0057 return results->nextResult (); 0058 } 0059 0060 bool cMXPProcessor::hasResults () 0061 { 0062 return results->haveResults (); 0063 } 0064 0065 void cMXPProcessor::switchToOpen () 0066 { 0067 state->switchToOpen (); 0068 } 0069 0070 void cMXPProcessor::setDefaultText (const char *font, int size, bool _bold, bool _italic, 0071 bool _underline, bool _strikeout, RGB fg, RGB bg) 0072 { 0073 state->setDefaultText (font, size, _bold, _italic, _underline, _strikeout, fg, bg); 0074 } 0075 0076 void cMXPProcessor::setHeaderParams (int which, const char *font, int size, bool _bold, 0077 bool _italic, bool _underline, bool _strikeout, RGB fg, RGB bg) 0078 { 0079 state->setHeaderParams (which, font, size, _bold, _italic, _underline, _strikeout, fg, bg); 0080 } 0081 0082 void cMXPProcessor::setDefaultGaugeColor (RGB color) 0083 { 0084 state->setDefaultGaugeColor (color); 0085 } 0086 0087 void cMXPProcessor::setNonProportFont (const char *font) 0088 { 0089 state->setNonProportFont (font); 0090 } 0091 0092 void cMXPProcessor::setClient (const char *name, const char *version) 0093 { 0094 state->setClient (name, version); 0095 } 0096 0097 void cMXPProcessor::setScreenProps (int sx, int sy, int wx, int wy, int fx, int fy) 0098 { 0099 state->setScreenProps (sx, sy, wx, wy, fx, fy); 0100 } 0101 0102 void cMXPProcessor::supportsLink (bool supports) 0103 { 0104 state->supportsLink (supports); 0105 } 0106 0107 void cMXPProcessor::supportsGauge (bool supports) 0108 { 0109 state->supportsGauge (supports); 0110 } 0111 0112 void cMXPProcessor::supportsSound (bool supports) 0113 { 0114 state->supportsSound (supports); 0115 } 0116 0117 void cMXPProcessor::supportsStatus (bool supports) 0118 { 0119 state->supportsStatus (supports); 0120 } 0121 0122 void cMXPProcessor::supportsFrame (bool supports) 0123 { 0124 state->supportsFrame (supports); 0125 } 0126 0127 void cMXPProcessor::supportsImage (bool supports) 0128 { 0129 state->supportsImage (supports); 0130 } 0131 0132 void cMXPProcessor::supportsRelocate (bool supports) 0133 { 0134 state->supportsRelocate (supports); 0135 }