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_NODES_H 21 #define INCLUDED_HWPFILTER_SOURCE_NODES_H 22 23 #include <sal/config.h> 24 25 #include <memory> 26 #include <vector> 27 #include <stdio.h> 28 #include <stdlib.h> 29 #include <osl/diagnose.h> 30 31 enum IDLIST { 32 ID_MATHML, 33 ID_LINES, 34 ID_LINE, 35 ID_EXPRLIST, 36 ID_EXPR, 37 ID_BEGIN, 38 ID_END, 39 ID_LEFT, 40 ID_RIGHT, 41 ID_SUBEXPR, 42 ID_SUPEXPR, 43 ID_SUBSUPEXPR, 44 ID_FRACTIONEXPR, 45 ID_OVER, 46 ID_DECORATIONEXPR, 47 ID_SQRTEXPR, 48 ID_ROOTEXPR, 49 ID_ARROWEXPR, 50 ID_ACCENTEXPR, 51 ID_UNARYEXPR, 52 ID_PRIMARYEXPR, 53 ID_BRACKET, 54 ID_BLOCK, 55 ID_PARENTH, 56 ID_FENCE, 57 ID_ABS, 58 ID_IDENTIFIER, 59 ID_STRING, 60 ID_CHARACTER, 61 ID_NUMBER, 62 ID_OPERATOR, 63 ID_SPACE, 64 ID_DELIMITER 65 }; 66 67 class Node{ 68 public: Node(int _id)69 explicit Node(int _id) : id(_id) 70 { 71 value = nullptr; 72 child = nullptr; 73 next = nullptr; 74 #ifdef NODE_DEBUG 75 count++; 76 printf("Node count : [%d]\n",count); 77 #endif 78 } ~Node()79 ~Node() 80 { 81 if( value ) free( value ); 82 // if( child ) delete child; 83 // if( next ) delete next; 84 next = nullptr; 85 child = nullptr; 86 #ifdef NODE_DEBUG 87 count--; 88 printf("Node count : [%d]\n",count); 89 #endif 90 } 91 public: 92 static int count; /* For memory debugging */ 93 int id; 94 char *value; 95 Node *child; 96 Node *next; 97 }; 98 extern std::vector<std::unique_ptr<Node>> nodelist; 99 100 #endif 101 102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 103