"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/c2b/documentContents.h" between
cb2bib-1.9.9.tar.gz and cb2bib-2.0.0.tar.gz

About: cb2Bib is a multiplatform application for rapidly extracting unformatted, or unstandardized bibliographic references from email alerts, journal Web pages, and PDF files.

documentContents.h  (cb2bib-1.9.9):documentContents.h  (cb2bib-2.0.0)
/*************************************************************************** /***************************************************************************
* Copyright (C) 2004-2018 by Pere Constans * Copyright (C) 2004-2019 by Pere Constans
* constans@molspaces.com * constans@molspaces.com
* cb2Bib version 1.9.9. Licensed under the GNU GPL version 3. * cb2Bib version 2.0.0. Licensed under the GNU GPL version 3.
* See the LICENSE file that comes with this distribution. * See the LICENSE file that comes with this distribution.
***************************************************************************/ ***************************************************************************/
#ifndef DOCUMENTCONTENTS_H #ifndef DOCUMENTCONTENTS_H
#define DOCUMENTCONTENTS_H #define DOCUMENTCONTENTS_H
#include "cb2bib_utilities.h" #include "cb2bib_utilities.h"
#include <QHash> #include <QHash>
#include <QString> #include <QString>
class documentContents class documentContents
{ {
public: public:
enum Type {Simplified, Complete}; enum Type
{
Simplified,
Complete
};
inline const QString& signature() const inline const QString& signature() const
{ {
if (!_is_signature_loaded) if (!_is_signature_loaded)
{ {
_signature = QString::fromUtf8(_cache.value(_signature_key)); _signature = QString::fromUtf8(_cache.value(_signature_key));
_is_signature_loaded = true; _is_signature_loaded = true;
} }
return _signature; return _signature;
} }
inline const QString& text() const inline const QString& text() const
{ {
if (!_is_text_loaded) if (!_is_text_loaded)
{ {
if (_type == Simplified) if (_type == Simplified)
_text = c2bUtils::toAscii(c2bUtils::fromUtf8(c2bUtils::uncompres _text = c2bUtils::toAscii(c2bUtils::fromUtf8(c2bUtils::uncompres
s(_cache.value(_text_key))), c2bUtils::KeepWords); s(_cache.value(_text_key))),
c2bUtils::KeepWords);
else else
_text = c2bUtils::fromUtf8(c2bUtils::uncompress(_cache.value(_te xt_key))); _text = c2bUtils::fromUtf8(c2bUtils::uncompress(_cache.value(_te xt_key)));
_is_text_loaded = true; _is_text_loaded = true;
} }
return _text; return _text;
} }
private: private:
inline explicit documentContents(const QHash<QString, QByteArray>& cache) : inline explicit documentContents(const QHash<QString, QByteArray>& cache)
_cache(cache) {} : _type(Complete), _cache(cache), _is_signature_loaded(false), _is_text_
loaded(false) {}
inline ~documentContents() {} inline ~documentContents() {}
inline void clear() inline void clear()
{ {
_is_signature_loaded = false; _is_signature_loaded = false;
_is_text_loaded = false; _is_text_loaded = false;
_signature.clear(); _signature.clear();
_signature_key.clear(); _signature_key.clear();
_text.clear(); _text.clear();
_text_key.clear(); _text_key.clear();
skipping to change at line 76 skipping to change at line 82
QString _signature_key; QString _signature_key;
QString _text_key; QString _text_key;
Type _type; Type _type;
const QHash<QString, QByteArray>& _cache; const QHash<QString, QByteArray>& _cache;
mutable QString _signature; mutable QString _signature;
mutable QString _text; mutable QString _text;
mutable bool _is_signature_loaded; mutable bool _is_signature_loaded;
mutable bool _is_text_loaded; mutable bool _is_text_loaded;
friend class documentCache; friend class documentCache;
}; };
#endif #endif
 End of changes. 6 change blocks. 
8 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)