Orb/Doxygen/src/cmdmapper.h
changeset 0 42188c7ea2d9
child 4 468f4c8d3d5b
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     1 /******************************************************************************
       
     2  *
       
     3  * 
       
     4  *
       
     5  *
       
     6  * Copyright (C) 1997-2008 by Dimitri van Heesch.
       
     7  *
       
     8  * Permission to use, copy, modify, and distribute this software and its
       
     9  * documentation under the terms of the GNU General Public License is hereby 
       
    10  * granted. No representations are made about the suitability of this software 
       
    11  * for any purpose. It is provided "as is" without express or implied warranty.
       
    12  * See the GNU General Public License for more details.
       
    13  *
       
    14  * Documents produced by Doxygen are derivative works derived from the
       
    15  * input used in their production; they are not affected by this license.
       
    16  *
       
    17  */
       
    18 
       
    19 #ifndef _CMDMAPPER_H
       
    20 #define _CMDMAPPER_H
       
    21 
       
    22 #include <qdict.h>
       
    23 
       
    24 struct CommandMap
       
    25 {
       
    26   const char *cmdName;
       
    27   int cmdId;
       
    28 };
       
    29 
       
    30 const int SIMPLESECT_BIT = 0x1000;
       
    31 
       
    32 enum CommandType
       
    33 {
       
    34   CMD_UNKNOWN      = 0,
       
    35   CMD_ADDINDEX     = 1,   
       
    36   CMD_AMP          = 2,
       
    37   CMD_ANCHOR       = 3,  
       
    38   CMD_AT           = 4,
       
    39   CMD_ATTENTION    = 5  | SIMPLESECT_BIT,
       
    40   CMD_AUTHOR       = 6  | SIMPLESECT_BIT,
       
    41   CMD_AUTHORS      = 7  | SIMPLESECT_BIT,
       
    42   CMD_BOLD         = 8,
       
    43   CMD_BSLASH       = 9,
       
    44   CMD_CODE         = 10,
       
    45   CMD_COPYDOC      = 11,      
       
    46   CMD_DATE         = 12 | SIMPLESECT_BIT,
       
    47   CMD_DOLLAR       = 13,
       
    48   CMD_DONTINCLUDE  = 14,   
       
    49   CMD_DOTFILE      = 15,      
       
    50   CMD_EMPHASIS     = 16,
       
    51   CMD_ENDCODE      = 17,      
       
    52   CMD_ENDHTMLONLY  = 18,  
       
    53   CMD_ENDLATEXONLY = 19, 
       
    54   CMD_ENDLINK      = 20,      
       
    55   CMD_ENDSECREFLIST= 21,
       
    56   CMD_ENDVERBATIM  = 22, 
       
    57   CMD_ENDXMLONLY   = 23,
       
    58   CMD_EXCEPTION    = 24 | SIMPLESECT_BIT,
       
    59   CMD_FORMULA      = 25,
       
    60   CMD_GREATER      = 26,
       
    61   CMD_HASH         = 27,
       
    62   CMD_HTMLINCLUDE  = 28,
       
    63   CMD_HTMLONLY     = 29,
       
    64   CMD_IMAGE        = 30,           
       
    65   CMD_INCLUDE      = 31,
       
    66   CMD_INTERNAL     = 32,         
       
    67   CMD_INTERNALREF  = 33,
       
    68   CMD_INVARIANT    = 34 | SIMPLESECT_BIT ,
       
    69   CMD_LATEXONLY    = 35,
       
    70   CMD_LESS         = 36,
       
    71   CMD_LI           = 37,
       
    72   CMD_LINE         = 38,
       
    73   CMD_LINEBREAK    = 39,
       
    74   CMD_LINK         = 40,             
       
    75   CMD_NOTE         = 41 | SIMPLESECT_BIT,
       
    76   CMD_PAR          = 42 | SIMPLESECT_BIT,
       
    77   CMD_PARAM        = 43 | SIMPLESECT_BIT,
       
    78   CMD_PERCENT      = 44, 
       
    79   CMD_POST         = 45 | SIMPLESECT_BIT,
       
    80   CMD_PRE          = 46 | SIMPLESECT_BIT ,
       
    81   CMD_REF          = 47,
       
    82   CMD_SECREFITEM   = 48,
       
    83   CMD_REMARK       = 49 | SIMPLESECT_BIT ,
       
    84   CMD_RETURN       = 50 | SIMPLESECT_BIT ,
       
    85   CMD_RETVAL       = 51 | SIMPLESECT_BIT,
       
    86   CMD_SA           = 52 | SIMPLESECT_BIT ,
       
    87   CMD_SECREFLIST   = 53,
       
    88   CMD_SECTION      = 54,
       
    89   CMD_SUBPAGE      = 55,
       
    90   CMD_SUBSECTION   = 56,
       
    91   CMD_SUBSUBSECTION= 57,
       
    92   CMD_PARAGRAPH    = 58,
       
    93   CMD_SINCE        = 59 | SIMPLESECT_BIT,
       
    94   CMD_SKIP         = 60,
       
    95   CMD_SKIPLINE     = 61,
       
    96   CMD_STARTCODE    = 62,
       
    97   CMD_JAVALINK     = 63,
       
    98   CMD_UNTIL        = 64,
       
    99   CMD_VERBATIM     = 65,
       
   100   CMD_VERBINCLUDE  = 66,
       
   101   CMD_VERSION      = 67 | SIMPLESECT_BIT,
       
   102   CMD_WARNING      = 68 | SIMPLESECT_BIT,
       
   103   CMD_XREFITEM     = 69 | SIMPLESECT_BIT,
       
   104   CMD_XMLONLY      = 70,
       
   105   CMD_DOT          = 71,
       
   106   CMD_ENDDOT       = 72,
       
   107   CMD_MSC          = 73,
       
   108   CMD_ENDMSC       = 74,
       
   109   CMD_MANONLY      = 75,
       
   110   CMD_ENDMANONLY   = 76,
       
   111   CMD_INCWITHLINES = 77,
       
   112   CMD_INHERITDOC   = 78,
       
   113   CMD_TPARAM       = 79 | SIMPLESECT_BIT,
       
   114   CMD_COPYBRIEF    = 80,
       
   115   CMD_COPYDETAILS  = 81,
       
   116   CMD_QUOTE        = 82 
       
   117 };
       
   118 
       
   119 enum HtmlTagType
       
   120 {
       
   121   HTML_UNKNOWN   = 0,
       
   122   HTML_CENTER    = 1,
       
   123   HTML_TABLE     = 2,
       
   124   HTML_CAPTION   = 3,
       
   125   HTML_SMALL     = 4,
       
   126   HTML_CODE      = 5,
       
   127   HTML_IMG       = 6,
       
   128   HTML_PRE       = 7,
       
   129   HTML_SUB       = 8,
       
   130   HTML_SUP       = 9,
       
   131   HTML_TR        = 10,
       
   132   HTML_TD        = 11,
       
   133   HTML_TH        = 12,
       
   134   HTML_OL        = 13,
       
   135   HTML_UL        = 14,
       
   136   HTML_LI        = 15,
       
   137   HTML_EMPHASIS  = 16,
       
   138   HTML_HR        = 17,
       
   139   HTML_DL        = 18,
       
   140   HTML_DT        = 19,
       
   141   HTML_DD        = 20,
       
   142   HTML_BR        = 21,
       
   143   HTML_A         = 22,
       
   144   HTML_BOLD      = 23,
       
   145   HTML_P         = 24,
       
   146   HTML_H1        = 25,
       
   147   HTML_H2        = 26,
       
   148   HTML_H3        = 27,
       
   149   HTML_H4        = 28,
       
   150   HTML_H5        = 29,
       
   151   HTML_H6        = 30,
       
   152   HTML_SPAN      = 31,
       
   153   HTML_DIV       = 32,
       
   154 
       
   155   XML_CmdMask    = 0x100,
       
   156 
       
   157   XML_C            = XML_CmdMask + 0,
       
   158   XML_CODE         = XML_CmdMask + 1,
       
   159   XML_DESCRIPTION  = XML_CmdMask + 2,
       
   160   XML_EXAMPLE      = XML_CmdMask + 3,
       
   161   XML_EXCEPTION    = XML_CmdMask + 4,
       
   162   XML_INCLUDE      = XML_CmdMask + 5,
       
   163   XML_ITEM         = XML_CmdMask + 6,
       
   164   XML_LIST         = XML_CmdMask + 7,
       
   165   XML_LISTHEADER   = XML_CmdMask + 8,
       
   166   XML_PARA         = XML_CmdMask + 9,
       
   167   XML_PARAM        = XML_CmdMask + 10,
       
   168   XML_PARAMREF     = XML_CmdMask + 11,
       
   169   XML_PERMISSION   = XML_CmdMask + 12,
       
   170   XML_REMARKS      = XML_CmdMask + 13,
       
   171   XML_RETURNS      = XML_CmdMask + 14,
       
   172   XML_SEE          = XML_CmdMask + 15,
       
   173   XML_SEEALSO      = XML_CmdMask + 16,
       
   174   XML_SUMMARY      = XML_CmdMask + 17,
       
   175   XML_TERM         = XML_CmdMask + 18,
       
   176   XML_TYPEPARAM    = XML_CmdMask + 19,
       
   177   XML_TYPEPARAMREF = XML_CmdMask + 20,
       
   178   XML_VALUE        = XML_CmdMask + 21
       
   179 };
       
   180 
       
   181 class Mapper
       
   182 {
       
   183   public:
       
   184     int map(const char *n)
       
   185     {
       
   186       QCString name=n;
       
   187       if (!m_cs) name=name.lower();
       
   188       int *result;
       
   189       return !name.isEmpty() && (result=m_map.find(name)) ? *result: 0;
       
   190     }
       
   191 
       
   192     Mapper(const CommandMap *cm,bool caseSensitive) : m_map(89), m_cs(caseSensitive)
       
   193     {
       
   194       m_map.setAutoDelete(TRUE);
       
   195       const CommandMap *p = cm;
       
   196       while (p->cmdName)
       
   197       {
       
   198         m_map.insert(p->cmdName,new int(p->cmdId));
       
   199         p++;
       
   200       }
       
   201     }
       
   202   private:
       
   203     QDict<int> m_map;
       
   204     bool m_cs;
       
   205 };
       
   206 
       
   207 struct Mappers
       
   208 {
       
   209   static void freeMappers();
       
   210   static Mapper *cmdMapper;
       
   211   static Mapper *htmlTagMapper;
       
   212 };
       
   213 
       
   214 
       
   215 #endif