19 #ifndef LIB_QUENTIER_ENML_ENML_CONVERTER_H
20 #define LIB_QUENTIER_ENML_ENML_CONVERTER_H
22 #include <quentier/utility/Printable.h>
23 #include <quentier/utility/Linkage.h>
24 #include <quentier/utility/Macros.h>
25 #include <quentier/types/ErrorString.h>
26 #include <quentier/types/Note.h>
31 #include <QTextDocument>
35 QT_FORWARD_DECLARE_CLASS(Resource)
36 QT_FORWARD_DECLARE_CLASS(DecryptedTextManager)
37 QT_FORWARD_DECLARE_CLASS(ENMLConverterPrivate)
70 virtual QTextStream & print(QTextStream & strm)
const override;
72 QString m_elementNameToSkip;
73 ComparisonRule m_elementNameComparisonRule = ComparisonRule::Equals;
74 Qt::CaseSensitivity m_elementNameCaseSensitivity = Qt::CaseSensitive;
76 QString m_attributeNameToSkip;
77 ComparisonRule m_attributeNameComparisonRule = ComparisonRule::Equals;
78 Qt::CaseSensitivity m_attributeNameCaseSensitivity = Qt::CaseSensitive;
80 QString m_attributeValueToSkip;
81 ComparisonRule m_attributeValueComparisonRule = ComparisonRule::Equals;
82 Qt::CaseSensitivity m_attributeValueCaseSensitivity = Qt::CaseSensitive;
84 bool m_includeElementContents =
false;
87 bool htmlToNoteContent(
88 const QString & html, QString & noteContent,
91 const QVector<SkipHtmlElementRule> & skipRules = {})
const;
107 const QString & inputHtml, QString & cleanedUpHtml,
124 const QString & html, QTextDocument & doc,
126 const QVector<SkipHtmlElementRule> & skipRules = {})
const;
130 quint64 m_numEnToDoNodes = 0;
131 quint64 m_numHyperlinkNodes = 0;
132 quint64 m_numEnCryptNodes = 0;
133 quint64 m_numEnDecryptedNodes = 0;
136 bool noteContentToHtml(
137 const QString & noteContent, QString & html,
143 const QString & enml,
ErrorString & errorDescription)
const;
145 bool validateAndFixupEnml(
146 QString & enml,
ErrorString & errorDescription)
const;
148 static bool noteContentToPlainText(
149 const QString & noteContent, QString & plainText,
152 static bool noteContentToListOfWords(
153 const QString & noteContent, QStringList & listOfWords,
154 ErrorString & errorMessage, QString * plainText =
nullptr);
156 static QStringList plainTextToListOfWords(
const QString & plainText);
158 static QString toDoCheckboxHtml(
const bool checked,
const quint64 idNumber);
160 static QString encryptedTextHtml(
161 const QString & encryptedText,
const QString & hint,
162 const QString & cipher,
const size_t keyLength,
163 const quint64 enCryptIndex);
165 static QString decryptedTextHtml(
166 const QString & decryptedText,
const QString & encryptedText,
167 const QString & hint,
const QString & cipher,
168 const size_t keyLength,
const quint64 enDecryptedIndex);
170 static QString resourceHtml(
173 static void escapeString(QString &
string,
const bool simplify =
true);
212 const QVector<Note> & notes,
213 const QHash<QString, QString> & tagNamesByTagLocalUids,
216 const QString & version = {})
const;
238 const QString & enex, QVector<Note> & notes,
239 QHash<QString, QStringList> & tagNamesByNoteLocalUid,
246 ENMLConverterPrivate *
const d_ptr;
Definition: DecryptedTextManager.h:31
The SkipHtmlElementRule class describes the set of rules for HTML -> ENML conversion about the HTML e...
Definition: ENMLConverter.h:61
The ENMLConverter class encapsulates a set of methods and helper data structures for performing the c...
Definition: ENMLConverter.h:45
bool exportNotesToEnex(const QVector< Note > ¬es, const QHash< QString, QString > &tagNamesByTagLocalUids, const EnexExportTags exportTagsOption, QString &enex, ErrorString &errorDescription, const QString &version={}) const
exportNotesToEnex exports either a single note or a set of notes into ENEX format
EnexExportTags
The EnexExportTags enum allows to specify whether export of note(s) to ENEX should include the names ...
Definition: ENMLConverter.h:180
bool importEnex(const QString &enex, QVector< Note > ¬es, QHash< QString, QStringList > &tagNamesByNoteLocalUid, ErrorString &errorDescription) const
importEnex reads the content of input ENEX file and converts it into a set of notes and tag names.
bool cleanupExternalHtml(const QString &inputHtml, QString &cleanedUpHtml, ErrorString &errorDescription) const
cleanupExternalHtml method cleans up a piece of HTML coming from some external source: the cleanup in...
bool htmlToQTextDocument(const QString &html, QTextDocument &doc, ErrorString &errorDescription, const QVector< SkipHtmlElementRule > &skipRules={}) const
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
The Printable class is the interface for Quentier's internal classes which should be able to write th...
Definition: Printable.h:39
Definition: Resource.h:30