LCOV - code coverage report
Current view: top level - hwpfilter/source - mapping.h (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 10 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_HWPFILTER_SOURCE_MAPPING_H
      21             : #define INCLUDED_HWPFILTER_SOURCE_MAPPING_H
      22             : 
      23             : #include <string.h>
      24             : #include <stdio.h>
      25             : #include <sal/macros.h>
      26             : 
      27             : #include <hwplib.h>
      28             : 
      29             : 
      30             : struct FormulaEntry{
      31             :      const char *tex;
      32             :      hchar ucs;
      33             : };
      34             : 
      35             : // empty square
      36             : #define DEFAULT_VALUE   0x25a1
      37             : const struct FormulaEntry FormulaMapTab[] = {
      38             : /* Capital Greek */
      39             : {"Alpha", 0x0391},
      40             : {"Beta", 0x0392},
      41             : {"Gamma", 0x0393},
      42             : {"Delta", 0x0394},
      43             : {"Epsilon", 0x0395},
      44             : {"Zeta", 0x0396},
      45             : {"Eta", 0x0397},
      46             : {"Theta", 0x0398},
      47             : {"Iota", 0x0399},
      48             : {"Kappa", 0x039a},
      49             : {"Lambda",0x039b },
      50             : {"Mu", 0x039c},
      51             : {"Nu", 0x039d},
      52             : {"Xi", 0x039e},
      53             : {"Omicron", 0x039f},
      54             : {"Pi", 0x03a0},
      55             : {"Rho", 0x03a1},
      56             : {"Sigma", 0x03a3},
      57             : {"Tau", 0x03a4},
      58             : {"Upsilon", 0x03a5},
      59             : {"Phi", 0x03a6},
      60             : {"Chi", 0x03a7},
      61             : {"Psi", 0x03a8},
      62             : {"Omega", 0x03a9},
      63             : 
      64             : /* Small Greek */
      65             : {"alpha", 0x03b1},
      66             : {"beta", 0x03b2},
      67             : {"gamma", 0x03b3},
      68             : {"delta", 0x03b4},
      69             : {"epsilon", 0x03b5},
      70             : {"zeta", 0x03b6},
      71             : {"eta", 0x03b7},
      72             : {"theta", 0x03b8},
      73             : {"iota", 0x03b9},
      74             : {"kappa", 0x03ba},
      75             : {"lambda",0x03bb },
      76             : {"mu", 0x03bc},
      77             : {"nu", 0x03bd},
      78             : {"xi", 0x03be},
      79             : {"omicron", 0x03bf},
      80             : {"pi", 0x03c0},
      81             : {"rho", 0x03c1},
      82             : {"varrho", 0},
      83             : {"sigma", 0x03c3},
      84             : {"tau", 0x03c4},
      85             : {"upsilon", 0x03c5},
      86             : {"phi", 0x03d5},
      87             : {"chi", 0x03c7},
      88             : {"psi", 0x03c8},
      89             : {"omega", 0x03c9},
      90             : 
      91             : /* General Symbol */
      92             : {"aleph", 0x2135},
      93             : {"hbar", 0x045b},
      94             : {"imath", 0x2129},
      95             : {"jmath", 0x2110},
      96             : {"mho", 0x2127},
      97             : {"ell", 0x2113},
      98             : {"wp", 0x2118},
      99             : {"imag", 0x2111},
     100             : {"angstrom", 0x212b},
     101             : {"vartheta", 0x03d1},
     102             : {"varpi", 0x03d6},
     103             : {"varsigma", 0x04aa},
     104             : {"varupsilon", 0x03d2},
     105             : {"varphi", 0x03c6},
     106             : 
     107             : 
     108             : // Big Symbol
     109             : {"sum", 0x2211},
     110             : {"smallsum", 0x03a3},
     111             : {"prod", 0x220f},
     112             : {"amalg", 0x2210},
     113             : {"int", 0x222b},
     114             : {"oint", 0x222e},
     115             : {"cap", 0x22c2},
     116             : {"cup", 0x22c3},
     117             : {"uplus", 0x2282},
     118             : {"vee", 0x22c1},
     119             : {"wedge", 0x22c0},
     120             : {"bigcap", 0x22c2},
     121             : {"bigcup", 0x22c3},
     122             : {"bigsqcap", 0x2293},
     123             : {"bigsqcup", 0x2294},
     124             : {"bigoplus", 0x2295},
     125             : {"bigominus", 0x2296},
     126             : {"bigotimes", 0x2297},
     127             : {"bigodiv", 0x2298},
     128             : {"bigodot", 0x2299},
     129             : {"oplus", 0x2295},
     130             : {"ominus", 0x2296},
     131             : {"otimes", 0x2297},
     132             : {"oslash", 0x2298},
     133             : {"odot", 0x2299},
     134             : {"bigvee", 0x22c1},
     135             : {"bigwedge", 0x22c0},
     136             : {"subset", 0x2282},
     137             : {"superset", 0x2283},
     138             : {"supset", 0x2283},
     139             : {"subseteq", 0x2286},
     140             : {"supseteq", 0x2287},
     141             : {"in", 0x2208},
     142             : {"ni", 0x220b},
     143             : {"notin", 0x2209},
     144             : {"notni", 0x220c},
     145             : {"leq", 0x2264},
     146             : {"geq", 0x2265},
     147             : {"sqsubset", 0x228f},
     148             : {"sqsupset", 0x2290},
     149             : {"sqsubseteq", 0x2291},
     150             : {"sqsupseteq", 0x2292},
     151             : {"mlt", 0x2292}, // much less than
     152             : {"mgt", 0x2292}, // much greater than
     153             : {"vmlt", 0x22d8}, // much less than
     154             : {"vmgt", 0x22d9}, // much greater than
     155             : {"prec", 0x227a},
     156             : {"succ", 0x227b},
     157             : {"biguplus", 0x228e},
     158             : 
     159             : // Binary Operator
     160             : {"pm", 0x00b1},
     161             : {"mp", 0x2213},
     162             : {"times", 0x00d7},
     163             : {"div", 0x00f7},
     164             : {"circ", 0x2218},
     165             : {"cdot", 0x2219},
     166             : {"bullet", 0x2022},
     167             : {"deg", 0x00b0},
     168             : {"ast", 0x002a},
     169             : {"star", 0x2205},
     170             : {"bigcirc", 0x25cb},
     171             : {"emptyset", 0x2205},
     172             : {"therefore", 0x2234},
     173             : {"because", 0x2235},
     174             : {"identical", 0x2237},
     175             : {"exists", 0x2203},
     176             : {"noteq", 0x2260}, // !=
     177             : {"neq", 0x2260},
     178             : {"doteq", 0x2250},
     179             : {"image", 0x2252},
     180             : {"reimage", 0x2253},
     181             : {"sim", 0x223c},
     182             : {"approx", 0x2248},
     183             : {"simeq", 0x2243},
     184             : {"cong", 0x2245},
     185             : {"equiv", 0x2261},
     186             : {"asymp", 0x224d},
     187             : {"iso", 0x224e},
     188             : {"diamond", 0x22c4},
     189             : {"dsum", 0x2214}, // add
     190             : {"forall", 0x2200},
     191             : {"prime", DEFAULT_VALUE}, // '
     192             : {"partial", 0x2202},
     193             : {"infty", 0x221e},
     194             : {"propto", 0x221d},
     195             : {"xor", 0x22bb},
     196             : {"del", 0x2207},
     197             : {"dagger", 0x2020},
     198             : {"ddagger", 0x2021},
     199             : {"LNOT", DEFAULT_VALUE},
     200             : 
     201             : // Arrows
     202             : {"leftarrow", 0x2190},
     203             : {"uparrow", 0x2191},
     204             : {"rightarrow", 0x2192},
     205             : {"downarrow", 0x2193},
     206             : {"Leftarrow", 0x21d0},
     207             : {"Uparrow", 0x21d1},
     208             : {"Rightarrow", 0x21d2},
     209             : {"Downarrow", 0x21d3},
     210             : {"updownarrow", 0x2195},
     211             : {"Updownarrow", 0x21d5},
     212             : {"leftrightarrow", 0x2194},
     213             : {"Leftrightarrow", 0x21d4},
     214             : {"nwarrow", 0x2196},
     215             : {"searrow", 0x2198},
     216             : {"nearrow", 0x2197},
     217             : {"swarrow", 0x2199},
     218             : {"hookleft", 0x21a9},
     219             : {"hookleftarrow", 0x21a9},
     220             : {"hookright", 0x21aa},
     221             : {"hookrightarrow", 0x21aa},
     222             : {"mapsto", 0x21a6},
     223             : {"vert", 0x2223},
     224             : {"dline", 0x2225},
     225             : 
     226             : {"cdots", 0x22ef},
     227             : {"ldots", 0x2026},
     228             : {"vdots", 0x22ee},
     229             : {"ddots", 0x22f1},
     230             : {"triangle", 0x2206},
     231             : {"triangled", 0x2207},
     232             : {"angle", 0x2220},
     233             : {"msangle", 0x2221},
     234             : {"sangle", 0x2222},
     235             : {"rtangle", 0x22be},
     236             : {"vdash", 0x22a2},
     237             : {"dashv", 0x22a3},
     238             : {"bot", 0x22a5},
     239             : {"top", 0x22a4},
     240             : {"models", 0x22a8},
     241             : 
     242             : {"coprod", DEFAULT_VALUE},
     243             : {"varepsilon", DEFAULT_VALUE},
     244             : {"setminus", DEFAULT_VALUE},
     245             : {"sqcap", DEFAULT_VALUE},
     246             : {"sqcup", DEFAULT_VALUE},
     247             : {"wr", DEFAULT_VALUE},
     248             : {"bigtriangleup", DEFAULT_VALUE},
     249             : {"bigtriangledown", DEFAULT_VALUE},
     250             : {"triangleleft", DEFAULT_VALUE},
     251             : {"triangleright", DEFAULT_VALUE},
     252             : {"lhd", DEFAULT_VALUE},
     253             : {"rhd", DEFAULT_VALUE},
     254             : {"unlhd", DEFAULT_VALUE},
     255             : {"unrhd", DEFAULT_VALUE},
     256             : {"nabla", DEFAULT_VALUE},
     257             : {"surd", DEFAULT_VALUE},
     258             : {"Box", DEFAULT_VALUE},
     259             : {"Diamond", DEFAULT_VALUE},
     260             : {"neg", DEFAULT_VALUE},
     261             : {"flat", DEFAULT_VALUE},
     262             : {"natural", DEFAULT_VALUE},
     263             : {"sharp", DEFAULT_VALUE},
     264             : {"clubsuit", DEFAULT_VALUE},
     265             : {"diamondsuit", DEFAULT_VALUE},
     266             : {"heartsuit", DEFAULT_VALUE},
     267             : {"spadesuit", DEFAULT_VALUE},
     268             : {"Re", DEFAULT_VALUE},
     269             : {"Im", DEFAULT_VALUE},
     270             : {"S", DEFAULT_VALUE},
     271             : {"P", DEFAULT_VALUE},
     272             : {"smallint", DEFAULT_VALUE},
     273             : {"backslash", DEFAULT_VALUE},
     274             : 
     275             : // Relation Operator
     276             : {"le", DEFAULT_VALUE},
     277             : {"ge", DEFAULT_VALUE},
     278             : {"perp", DEFAULT_VALUE},
     279             : {"preceq", DEFAULT_VALUE},
     280             : {"succeq", DEFAULT_VALUE},
     281             : {"mid", DEFAULT_VALUE},
     282             : {"ll", DEFAULT_VALUE},
     283             : {"gg", DEFAULT_VALUE},
     284             : {"parallel", DEFAULT_VALUE},
     285             : {"bowtie", DEFAULT_VALUE},
     286             : {"Join", DEFAULT_VALUE},
     287             : {"smile", DEFAULT_VALUE},
     288             : {"frown", DEFAULT_VALUE},
     289             : {"not", DEFAULT_VALUE},
     290             : {"mapsto", DEFAULT_VALUE},
     291             : 
     292             : // Arrows
     293             : {"to", DEFAULT_VALUE},
     294             : 
     295             : {"leftharpoonup", DEFAULT_VALUE},
     296             : {"leftharpoondown", DEFAULT_VALUE},
     297             : {"longleftarrow", DEFAULT_VALUE},
     298             : {"Longleftarrow", DEFAULT_VALUE},
     299             : {"longrightarrow", DEFAULT_VALUE},
     300             : {"Longrightarrow", DEFAULT_VALUE},
     301             : {"longleftrightarrow", DEFAULT_VALUE},
     302             : {"Longleftrightarrow", DEFAULT_VALUE},
     303             : {"longmapsto", DEFAULT_VALUE},
     304             : {"rightharpoonup", DEFAULT_VALUE},
     305             : {"rightharpoondown", DEFAULT_VALUE},
     306             : 
     307             : // Delimeter
     308             : {"(", DEFAULT_VALUE},
     309             : {")", DEFAULT_VALUE},
     310             : {"[", DEFAULT_VALUE},
     311             : {"]", DEFAULT_VALUE},
     312             : {"{", DEFAULT_VALUE},
     313             : {"}", DEFAULT_VALUE},
     314             : {"lfloor", DEFAULT_VALUE},
     315             : {"rfloor", DEFAULT_VALUE},
     316             : {"lceil", DEFAULT_VALUE},
     317             : {"rceil", DEFAULT_VALUE},
     318             : {"langle", DEFAULT_VALUE},
     319             : {"rangle", DEFAULT_VALUE},
     320             : {"mid", DEFAULT_VALUE},
     321             : 
     322             : // Large Delimeter
     323             : {"rmoustache", DEFAULT_VALUE},
     324             : {"lmoustache", DEFAULT_VALUE},
     325             : {"rgroup", DEFAULT_VALUE},
     326             : {"lgroup", DEFAULT_VALUE},
     327             : {"arrowvert", DEFAULT_VALUE},
     328             : {"Arrowvert", DEFAULT_VALUE},
     329             : {"bracevert", DEFAULT_VALUE},
     330             : 
     331             : // Accent
     332             : {"hat", DEFAULT_VALUE},
     333             : {"breve", DEFAULT_VALUE},
     334             : {"grave", DEFAULT_VALUE},
     335             : {"bar", DEFAULT_VALUE},
     336             : {"ddot", DEFAULT_VALUE},
     337             : {"check", DEFAULT_VALUE},
     338             : {"acute", DEFAULT_VALUE},
     339             : {"tilde", DEFAULT_VALUE},
     340             : {"dot", DEFAULT_VALUE},
     341             : {"vec", DEFAULT_VALUE},
     342             : 
     343             : // Decoration
     344             : {"overline", DEFAULT_VALUE},
     345             : {"underline", DEFAULT_VALUE},
     346             : {"overbrace", DEFAULT_VALUE},
     347             : {"underbrace", DEFAULT_VALUE},
     348             : {"widehat", DEFAULT_VALUE},
     349             : {"widetilde", DEFAULT_VALUE},
     350             : {"overleftarrow", DEFAULT_VALUE},
     351             : {"overrightarrow", DEFAULT_VALUE},
     352             : 
     353             : // Space Symbol
     354             : {",", DEFAULT_VALUE},
     355             : {":", DEFAULT_VALUE},
     356             : {";", DEFAULT_VALUE},
     357             : {"!", DEFAULT_VALUE},
     358             : {"quad", DEFAULT_VALUE},
     359             : {"qquad", DEFAULT_VALUE}, // double size of character
     360             : 
     361             : };
     362             : 
     363             : #ifndef DEBUG
     364           0 : hchar_string getMathMLEntity(const char *tex)
     365             : {
     366             :      static const size_t tabSize = sizeof(FormulaMapTab) / sizeof(FormulaMapTab[0]);
     367             : 
     368           0 :      hchar_string buf;
     369           0 :      for (size_t i = 0 ; i < tabSize ; i++) {
     370           0 :           if( !strcmp(tex, FormulaMapTab[i].tex ) ) {
     371           0 :                 buf.push_back(FormulaMapTab[i].ucs);
     372           0 :                 return buf;
     373             :           }
     374             :      }
     375             : 
     376           0 :      size_t const len = strlen(tex);
     377           0 :      for (size_t i = 0 ; i < len ; i++)
     378             :      {
     379           0 :          buf.push_back(tex[i]);
     380             :      }
     381           0 :      return buf;
     382             : }
     383             : 
     384             : #else
     385             : ::std::string getMathMLEntity(const char *tex)
     386             : {
     387             :      ::std::string buf;
     388             :      buf.append(tex);
     389             :      return buf;
     390             : }
     391             : #endif
     392             : 
     393             : #endif
     394             : 
     395             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11