bibhtml  1.0
 All Classes Functions Variables Enumerations
bibdefs.hpp
1 
2 // bibhtml: Generates HTML page (with images) from BibTex files
3 // See: https://www.telecom-paris.fr/~elc/software/
4 //
5 // Copyright 2020 Eric Lecolinet (eric.lecolinet@gmail.com)
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 // http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 
19 #ifndef __BibDefs__
20 #define __BibDefs__
21 
22 #include <string>
23 #include "ccstringset.hpp"
24 
25 
40 class BibTypes {
42 #define BIBTYPES \
43 none, article, book, booklet, collection, inbook, incollection, inproceedings, \
44 manual, mastersthesis, misc, phdthesis, proceedings, techreport, unpublished, \
45 conference, electronic, online, patent, reference, report, www, \
46 knownmedia, style, authgroup
47 
48 public:
50  enum ID {BIBTYPES};
51 
53  static const std::string& typeName(BibTypes::ID typeID);
54 
56  static BibTypes::ID addType(const std::string& typeName);
57 
59  static int count();
60 
61 private:
62  BibTypes() : names(STRINGIFY(BIBTYPES)) {} // inits type names.
63 
64  static BibTypes instance; // singleton
65  ccuty::istringset names; // stores type names
66 
67 #undef BIBTYPES
68 };
69 
70 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
71 
94 class BibFields {
96 #define BIBFIELDS \
97 none, address, abstract, annote, author, booktitle, chapter, crossref, \
98 edition, editor, eprint, howpublished, institution, journal, key, month, note, \
99 number, organization, pages, publisher, school, series, title, type, url, volume, year, \
100 doi, introduction, issn, issue, journaltitle, language, location, \
101 pagetotal, pdf, pubstate, subtitle, venue, \
102 award, hal, image, keywords, link, media, slides, poster, project, video, software,\
103 bibkey, bibcite, rank, authgroup
104 
105 public:
107  enum ID {BIBFIELDS};
108 
110  static const std::string& fieldName(BibFields::ID fieldID);
111 
113  static BibFields::ID addField(const std::string& fieldName);
114 
119  static BibFields::ID fieldID(const std::string& fieldName, bool abridged);
120 
121 
122 private:
124  BibFields() : names(STRINGIFY(BIBFIELDS)) {}
125 
126  static BibFields instance; // singleton
127  ccuty::istringset names; // stores field names
128 
129 #undef BIBFIELDS
130 };
131 
132 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
133 
136 class BibSettings {
137 public:
139  static constexpr const char* OutHtml = "out.html";
140 
142  static constexpr const char* OutBib = "out.bib";
143 
145  static constexpr const char* TemplateFile = "template.html";
146 
148  static constexpr const char* TemplateMark = "###CONTENT";
149 
151  static constexpr const char* DoiPrefix = "https://dx.doi.org/";
152 
154  static constexpr const char* HalPrefix = "https://hal.archives-ouvertes.fr/";
155 
159  static const char* DefaultStyleFormat;
160 };
161 
162 #endif