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 #ifndef CMXPPROCESSOR_H
0016 #define CMXPPROCESSOR_H
0017 
0018 #include "libmxp.h"
0019 
0020 class cResultHandler;
0021 class cMXPState;
0022 class cMXPParser;
0023 class cEntityManager;
0024 class cElementManager;
0025 
0026 /**
0027 This class wraps the public API of the library.
0028 
0029 @author Tomas Mecir
0030 */
0031 class cMXPProcessor {
0032 public:
0033   cMXPProcessor ();
0034   ~cMXPProcessor ();
0035 
0036   /** text processing */
0037   void processText (const char *text);
0038   /** fetch next result of the processing */
0039   mxpResult *nextResult ();
0040   /** are there any more results to fetch? */
0041   bool hasResults ();
0042   
0043   /** switch to OPEN mode - use this immediately after creating this object, in case that
0044   you don't want to be in LOCKED mode by default (where MXP is only used if some line tag
0045   is received) */
0046   void switchToOpen ();
0047   
0048   /** set default text attributes */
0049   void setDefaultText (const char *font, int size, bool _bold, bool _italic, bool _underline,
0050       bool _strikeout, RGB fg, RGB bg);
0051   /** set attributes of header 1-6 (for tags <h1>-<h6> */
0052   void setHeaderParams (int which, const char *font, int size, bool _bold, bool _italic,
0053       bool _underline, bool _strikeout, RGB fg, RGB bg);
0054   /** set default color for gauges */
0055   void setDefaultGaugeColor (RGB color);
0056   /** set used non-proportional font */
0057   void setNonProportFont (const char *font);
0058   /** set client name and version reported to the MUD */
0059   void setClient (const char *name, const char *version);
0060   /* screen, window and font size, used by FRAME and IMAGE tags */
0061   void setScreenProps (int sx, int sy, int wx, int wy, int fx, int fy);
0062   
0063   //SUPPORTS stuff
0064   void supportsLink (bool supports);
0065   void supportsGauge (bool supports);
0066   void supportsStatus (bool supports);
0067   void supportsSound (bool supports);
0068   void supportsFrame (bool supports);
0069   void supportsImage (bool supports);
0070   void supportsRelocate (bool supports);
0071   
0072 protected:
0073   cResultHandler *results;
0074   cMXPState *state;
0075   cMXPParser *parser;
0076   cEntityManager *entities;
0077   cElementManager *elements;
0078 };
0079 
0080 #endif