cmdmapper.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * 
00004  *
00005  *
00006  * Copyright (C) 1997-2008 by Dimitri van Heesch.
00007  *
00008  * Permission to use, copy, modify, and distribute this software and its
00009  * documentation under the terms of the GNU General Public License is hereby 
00010  * granted. No representations are made about the suitability of this software 
00011  * for any purpose. It is provided "as is" without express or implied warranty.
00012  * See the GNU General Public License for more details.
00013  *
00014  * Documents produced by Doxygen are derivative works derived from the
00015  * input used in their production; they are not affected by this license.
00016  *
00017  */
00018 
00019 #ifndef _CMDMAPPER_H
00020 #define _CMDMAPPER_H
00021 
00022 #include <qdict.h>
00023 
00024 struct CommandMap
00025 {
00026   const char *cmdName;
00027   int cmdId;
00028 };
00029 
00030 const int SIMPLESECT_BIT = 0x1000;
00031 
00032 enum CommandType
00033 {
00034   CMD_UNKNOWN      = 0,
00035   CMD_ADDINDEX     = 1,   
00036   CMD_AMP          = 2,
00037   CMD_ANCHOR       = 3,  
00038   CMD_AT           = 4,
00039   CMD_ATTENTION    = 5  | SIMPLESECT_BIT,
00040   CMD_AUTHOR       = 6  | SIMPLESECT_BIT,
00041   CMD_AUTHORS      = 7  | SIMPLESECT_BIT,
00042   CMD_BOLD         = 8,
00043   CMD_BSLASH       = 9,
00044   CMD_CODE         = 10,
00045   CMD_COPYDOC      = 11,      
00046   CMD_DATE         = 12 | SIMPLESECT_BIT,
00047   CMD_DOLLAR       = 13,
00048   CMD_DONTINCLUDE  = 14,   
00049   CMD_DOTFILE      = 15,      
00050   CMD_EMPHASIS     = 16,
00051   CMD_ENDCODE      = 17,      
00052   CMD_ENDHTMLONLY  = 18,  
00053   CMD_ENDLATEXONLY = 19, 
00054   CMD_ENDLINK      = 20,      
00055   CMD_ENDSECREFLIST= 21,
00056   CMD_ENDVERBATIM  = 22, 
00057   CMD_ENDXMLONLY   = 23,
00058   CMD_EXCEPTION    = 24 | SIMPLESECT_BIT,
00059   CMD_FORMULA      = 25,
00060   CMD_GREATER      = 26,
00061   CMD_HASH         = 27,
00062   CMD_HTMLINCLUDE  = 28,
00063   CMD_HTMLONLY     = 29,
00064   CMD_IMAGE        = 30,           
00065   CMD_INCLUDE      = 31,
00066   CMD_INTERNAL     = 32,         
00067   CMD_INTERNALREF  = 33,
00068   CMD_INVARIANT    = 34 | SIMPLESECT_BIT ,
00069   CMD_LATEXONLY    = 35,
00070   CMD_LESS         = 36,
00071   CMD_LI           = 37,
00072   CMD_LINE         = 38,
00073   CMD_LINEBREAK    = 39,
00074   CMD_LINK         = 40,             
00075   CMD_NOTE         = 41 | SIMPLESECT_BIT,
00076   CMD_PAR          = 42 | SIMPLESECT_BIT,
00077   CMD_PARAM        = 43 | SIMPLESECT_BIT,
00078   CMD_PERCENT      = 44, 
00079   CMD_POST         = 45 | SIMPLESECT_BIT,
00080   CMD_PRE          = 46 | SIMPLESECT_BIT ,
00081   CMD_REF          = 47,
00082   CMD_SECREFITEM   = 48,
00083   CMD_REMARK       = 49 | SIMPLESECT_BIT ,
00084   CMD_RETURN       = 50 | SIMPLESECT_BIT ,
00085   CMD_RETVAL       = 51 | SIMPLESECT_BIT,
00086   CMD_SA           = 52 | SIMPLESECT_BIT ,
00087   CMD_SECREFLIST   = 53,
00088   CMD_SECTION      = 54,
00089   CMD_SUBPAGE      = 55,
00090   CMD_SUBSECTION   = 56,
00091   CMD_SUBSUBSECTION= 57,
00092   CMD_PARAGRAPH    = 58,
00093   CMD_SINCE        = 59 | SIMPLESECT_BIT,
00094   CMD_SKIP         = 60,
00095   CMD_SKIPLINE     = 61,
00096   CMD_STARTCODE    = 62,
00097   CMD_JAVALINK     = 63,
00098   CMD_UNTIL        = 64,
00099   CMD_VERBATIM     = 65,
00100   CMD_VERBINCLUDE  = 66,
00101   CMD_VERSION      = 67 | SIMPLESECT_BIT,
00102   CMD_WARNING      = 68 | SIMPLESECT_BIT,
00103   CMD_XREFITEM     = 69 | SIMPLESECT_BIT,
00104   CMD_XMLONLY      = 70,
00105   CMD_DOT          = 71,
00106   CMD_ENDDOT       = 72,
00107   CMD_MSC          = 73,
00108   CMD_ENDMSC       = 74,
00109   CMD_MANONLY      = 75,
00110   CMD_ENDMANONLY   = 76,
00111   CMD_INCWITHLINES = 77,
00112   CMD_INHERITDOC   = 78,
00113   CMD_TPARAM       = 79 | SIMPLESECT_BIT
00114 };
00115 
00116 enum HtmlTagType
00117 {
00118   HTML_UNKNOWN   = 0,
00119   HTML_CENTER    = 1,
00120   HTML_TABLE     = 2,
00121   HTML_CAPTION   = 3,
00122   HTML_SMALL     = 4,
00123   HTML_CODE      = 5,
00124   HTML_IMG       = 6,
00125   HTML_PRE       = 7,
00126   HTML_SUB       = 8,
00127   HTML_SUP       = 9,
00128   HTML_TR        = 10,
00129   HTML_TD        = 11,
00130   HTML_TH        = 12,
00131   HTML_OL        = 13,
00132   HTML_UL        = 14,
00133   HTML_LI        = 15,
00134   HTML_EMPHASIS  = 16,
00135   HTML_HR        = 17,
00136   HTML_DL        = 18,
00137   HTML_DT        = 19,
00138   HTML_DD        = 20,
00139   HTML_BR        = 21,
00140   HTML_A         = 22,
00141   HTML_BOLD      = 23,
00142   HTML_P         = 24,
00143   HTML_H1        = 25,
00144   HTML_H2        = 26,
00145   HTML_H3        = 27,
00146   HTML_H4        = 28,
00147   HTML_H5        = 29,
00148   HTML_H6        = 30,
00149   HTML_SPAN      = 31,
00150   HTML_DIV       = 32,
00151 
00152   XML_CmdMask    = 0x100,
00153 
00154   XML_C            = XML_CmdMask + 0,
00155   XML_CODE         = XML_CmdMask + 1,
00156   XML_DESCRIPTION  = XML_CmdMask + 2,
00157   XML_EXAMPLE      = XML_CmdMask + 3,
00158   XML_EXCEPTION    = XML_CmdMask + 4,
00159   XML_INCLUDE      = XML_CmdMask + 5,
00160   XML_ITEM         = XML_CmdMask + 6,
00161   XML_LIST         = XML_CmdMask + 7,
00162   XML_LISTHEADER   = XML_CmdMask + 8,
00163   XML_PARA         = XML_CmdMask + 9,
00164   XML_PARAM        = XML_CmdMask + 10,
00165   XML_PARAMREF     = XML_CmdMask + 11,
00166   XML_PERMISSION   = XML_CmdMask + 12,
00167   XML_REMARKS      = XML_CmdMask + 13,
00168   XML_RETURNS      = XML_CmdMask + 14,
00169   XML_SEE          = XML_CmdMask + 15,
00170   XML_SEEALSO      = XML_CmdMask + 16,
00171   XML_SUMMARY      = XML_CmdMask + 17,
00172   XML_TERM         = XML_CmdMask + 18,
00173   XML_TYPEPARAM    = XML_CmdMask + 19,
00174   XML_TYPEPARAMREF = XML_CmdMask + 20,
00175   XML_VALUE        = XML_CmdMask + 21
00176 };
00177 
00178 class Mapper
00179 {
00180   public:
00181     int map(const char *n)
00182     {
00183       QCString name=n;
00184       if (!m_cs) name=name.lower();
00185       int *result;
00186       return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0;
00187     }
00188 
00189     Mapper(const CommandMap *cm,bool caseSensitive) : m_map(89), m_cs(caseSensitive)
00190     {
00191       m_map.setAutoDelete(TRUE);
00192       const CommandMap *p = cm;
00193       while (p->cmdName)
00194       {
00195         m_map.insert(p->cmdName,new int(p->cmdId));
00196         p++;
00197       }
00198     }
00199   private:
00200     QDict<int> m_map;
00201     bool m_cs;
00202 };
00203 
00204 struct Mappers
00205 {
00206   static void freeMappers();
00207   static Mapper *cmdMapper;
00208   static Mapper *htmlTagMapper;
00209 };
00210 
00211 
00212 #endif



Generated on Mon Mar 31 10:58:32 2008 by  doxygen 1.5.1