1 /* 2 * BibTeX Converter 3 * Copyright (C) 2010-2021 by Thomas Dreibholz 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 * Contact: dreibh@iem.uni-due.de 19 */ 20 21 #ifndef NODE_H 22 #define NODE_H 23 24 #include <string> 25 #include <vector> 26 27 28 extern void yyerror(const char* errorText); 29 extern int yylex(); 30 31 32 #define NODE_CUSTOM_ENTRIES 9 33 34 struct Node { 35 struct Node* prev; 36 struct Node* next; 37 struct Node* child; 38 std::string keyword; 39 std::string value; 40 std::string anchor; 41 std::string custom[NODE_CUSTOM_ENTRIES]; 42 std::vector<std::string> arguments; 43 unsigned int priority; 44 int number; 45 }; 46 47 void freeNode(struct Node* node); 48 void dumpNode(struct Node* node); 49 50 size_t countNodes(const Node* node); 51 size_t countChildNodes(const Node* node, const char* childKeyword); 52 Node* findNode(Node* node, const char* keyword); 53 Node* findChildNode(Node* node, const char* childKeyword); 54 Node* addOrUpdateChildNode(Node* node, const char* childKeyword, const char* value); 55 56 struct Node* makePublicationCollection(struct Node* node1, struct Node* node2); 57 struct Node* makePublication(const char* type, const char* label, 58 struct Node* publicationInfo); 59 struct Node* makePublicationInfo(struct Node* node1, struct Node* node2); 60 struct Node* makePublicationInfoItem(const char* keyword, const char* value); 61 62 #endif 63