1 /*************************************************************************** 2 * Copyright (C) 2004-2021 by Pere Constans 3 * constans@molspaces.com 4 * cb2Bib version 2.0.1. Licensed under the GNU GPL version 3. 5 * See the LICENSE file that comes with this distribution. 6 ***************************************************************************/ 7 #ifndef CRJSON_H 8 #define CRJSON_H 9 10 #include "bibReference.h" 11 12 13 class crJson 14 { 15 16 public: 17 explicit crJson(const QString& json); 18 inline ~crJson() {} 19 20 inline const bibReference& reference() const 21 { 22 return _reference; 23 } 24 inline bool hasError() const 25 { 26 return _has_error; 27 } 28 inline QString errorString() const 29 { 30 return _error_string; 31 } 32 33 34 private: 35 void readReference(const QString& json); 36 37 static QString _bibtex_booktitle(const QStringList& titles); 38 static QString _bibtex_series(const QStringList& titles); 39 static QString _bibtex_title(const QStringList& titles, const QStringList& subtitles); 40 static QString _normalize_jabstract(const QString& abstract); 41 static int _words(const QString& s); 42 static void _normalize_jtitles(QStringList* titles); 43 44 QString _error_string; 45 bibReference _reference; 46 bool _has_error; 47 }; 48 49 #endif