"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/src/c2b/bibReference.h" (12 Feb 2021, 2117 Bytes) of package /linux/privat/cb2bib-2.0.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "bibReference.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.0.0_vs_2.0.1.

    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 BIBREFERENCE_H
    8 #define BIBREFERENCE_H
    9 
   10 #include "cb2bib_utilities.h"
   11 
   12 #include <QHash>
   13 
   14 typedef QHash<QString, QString>::const_iterator bibReferenceIterator;
   15 
   16 
   17 /**
   18     Basic class for a bibliographic reference
   19 
   20     @author Pere Constans
   21 */
   22 class bibReference : public QHash<QString, QString>
   23 {
   24 
   25 public:
   26     inline bibReference() : positionValue(0), pos(0) {}
   27 
   28     void clearFields()
   29     {
   30         pos = 0;
   31     }
   32     void clearReference()
   33     {
   34         positionValue = 0;
   35         citeidName.clear();
   36         typeName.clear();
   37         rawReference.clear();
   38         unicodeReference.clear();
   39         QHash<QString, QString>::clear();
   40     }
   41     /**
   42         Fallback for authors
   43     */
   44     inline const QString anyAuthor() const
   45     {
   46         const QString v(value("author"));
   47         if (v.isEmpty())
   48             return value("editor");
   49         return v;
   50     }
   51     /**
   52         Fallback for titles
   53     */
   54     inline const QString anyTitle() const
   55     {
   56         const QString v(value("title"));
   57         if (v.isEmpty())
   58         {
   59             const QString v1(value("booktitle"));
   60             if (v1.isEmpty())
   61                 return QFileInfo(value("file")).fileName();
   62             return v1;
   63         }
   64         return v;
   65     }
   66     /**
   67         Fallback for journal
   68     */
   69     inline const QString anyJournal() const
   70     {
   71         QString v(value("journal"));
   72         if (v.isEmpty())
   73             if (typeName == "inproceedings")
   74             {
   75                 v = value("booktitle");
   76                 c2bUtils::cleanTitle(v, true);
   77             }
   78         return v;
   79     }
   80     QString citeidName;
   81     QString rawReference;
   82     QString typeName;
   83     QString unicodeReference;
   84     int positionValue;
   85 
   86 
   87 private:
   88     int pos;
   89 
   90     friend class coreBibParser;
   91 };
   92 
   93 #endif