"Fossies" - the Fresh Open Source Software Archive

Member "cb2bib-2.0.1/src/c2b/networkQuery.h" (12 Feb 2021, 2969 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 "networkQuery.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 NETWORKQUERY_H
    8 #define NETWORKQUERY_H
    9 
   10 #include <QDateTime>
   11 #include <QObject>
   12 #include <QRegExp>
   13 
   14 class bibParser;
   15 class bibReference;
   16 class network;
   17 class settings;
   18 
   19 
   20 /**
   21     cb2Bib Network Queries
   22 
   23     @author Pere Constans
   24 */
   25 class networkQuery : public QObject
   26 {
   27 
   28     Q_OBJECT
   29 
   30 public:
   31     explicit networkQuery(bibParser* bp, QObject* parento = 0);
   32     networkQuery(bibParser* bp, network* net, QObject* parento = 0);
   33     inline virtual ~networkQuery() {}
   34 
   35     void submitQuery(const bibReference& reference, const QString& raw_reference, const bool check_document);
   36     inline QString errorString() const
   37     {
   38         return _error_string;
   39     }
   40     inline network* networkPtr() const
   41     {
   42         return _networkP;
   43     }
   44 
   45 signals:
   46     void queryEnded(bool succeeded, const QString& targetPDF, const QString& targetBib);
   47     void statusMessage(const QString& ms);
   48 
   49 
   50 protected:
   51     virtual bool checkQueryFile(const QString& fn) const;
   52     virtual inline QString fromHtmlString(const QString& str, const bool /* addMetadata */ = false) const
   53     {
   54         // Note: fromHtmlString in c2bUtils uses QTextDocument to perform HTML to text
   55         // conversions. c2bUtils::fromHtmlString is not set in the c2blib because GUI classes
   56         // are excluded from the core library.
   57         return str;
   58     }
   59     virtual bool openFile(const QString& /* fn */) const
   60     {
   61         // Reimplement to open files in GUI mode
   62         return false;
   63     }
   64 
   65 
   66 private:
   67     QDateTime _timing;
   68     QList<uint> _query_parameter_count;
   69     QString _Qauthor;
   70     QString _Qdoi;
   71     QString _Qeprint;
   72     QString _Qexcerpt;
   73     QString _Qjournal;
   74     QString _QjournalCode;
   75     QString _Qpage;
   76     QString _Qtitle;
   77     QString _Qvolume;
   78     QString _action;
   79     QString _captionQ;
   80     QString _error_string;
   81     QString _networkquery_tmp_fn1;
   82     QString _networkquery_tmp_fn2;
   83     QString _pdfurl_prefix;
   84     QString _pdfurl_sufix;
   85     QString _raw_metadata;
   86     QString _raw_reference;
   87     QString _referenceurl_prefix;
   88     QString _referenceurl_sufix;
   89     QString _targetBib;
   90     QString _targetPDF;
   91     QString _targetQ;
   92     bibParser* _bpP;
   93     bool _check_document;
   94     bool _is_end_of_file;
   95     bool _pdfurl_is_captured;
   96     const QString encodeUrl(const QString& url) const;
   97     network* _networkP;
   98     settings* _settingsP;
   99     void init();
  100 
  101 
  102 private slots:
  103     bool areQueryParametersValid();
  104     bool setQueryParameters();
  105     void queryDone(bool succeeded);
  106     void submitQuery1();
  107     void submitQuery2(bool succeeded);
  108     void submitQuery3(bool succeeded);
  109     void updateQueryPlaceholders();
  110 };
  111 
  112 #endif