use auto, range for, etc.
This commit is contained in:
parent
156ba2668f
commit
4df9106b46
@ -55,21 +55,22 @@ bool PlainToRichQtPreview::haveAnchors()
|
|||||||
|
|
||||||
string PlainToRichQtPreview::PlainToRichQtPreview::header()
|
string PlainToRichQtPreview::PlainToRichQtPreview::header()
|
||||||
{
|
{
|
||||||
if (!m_inputhtml) {
|
if (m_inputhtml) {
|
||||||
switch (prefs.previewPlainPre) {
|
return cstr_null;
|
||||||
case PrefsPack::PP_BR:
|
}
|
||||||
m_eolbr = true;
|
switch (prefs.previewPlainPre) {
|
||||||
return "<qt><head><title></title></head><body>";
|
case PrefsPack::PP_BR:
|
||||||
case PrefsPack::PP_PRE:
|
m_eolbr = true;
|
||||||
m_eolbr = false;
|
return "<qt><head><title></title></head><body>";
|
||||||
return "<qt><head><title></title></head><body><pre>";
|
case PrefsPack::PP_PRE:
|
||||||
case PrefsPack::PP_PREWRAP:
|
m_eolbr = false;
|
||||||
m_eolbr = false;
|
return "<qt><head><title></title></head><body><pre>";
|
||||||
return "<qt><head><title></title></head><body>"
|
case PrefsPack::PP_PREWRAP:
|
||||||
"<pre style=\"white-space: pre-wrap\">";
|
default:
|
||||||
}
|
m_eolbr = false;
|
||||||
|
return "<qt><head><title></title></head><body>"
|
||||||
|
"<pre style=\"white-space: pre-wrap\">";
|
||||||
}
|
}
|
||||||
return cstr_null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string PlainToRichQtPreview::startMatch(unsigned int grpidx)
|
string PlainToRichQtPreview::startMatch(unsigned int grpidx)
|
||||||
@ -117,10 +118,8 @@ string PlainToRichQtPreview::startChunk()
|
|||||||
int PlainToRichQtPreview::nextAnchorNum(int grpidx)
|
int PlainToRichQtPreview::nextAnchorNum(int grpidx)
|
||||||
{
|
{
|
||||||
LOGDEB2("nextAnchorNum: group " << grpidx << "\n");
|
LOGDEB2("nextAnchorNum: group " << grpidx << "\n");
|
||||||
map<unsigned int, unsigned int>::iterator curit =
|
auto curit = m_groupcuranchors.find(grpidx);
|
||||||
m_groupcuranchors.find(grpidx);
|
auto vecit = m_groupanchors.find(grpidx);
|
||||||
map<unsigned int, vector<int> >::iterator vecit =
|
|
||||||
m_groupanchors.find(grpidx);
|
|
||||||
if (grpidx == -1 || curit == m_groupcuranchors.end() ||
|
if (grpidx == -1 || curit == m_groupcuranchors.end() ||
|
||||||
vecit == m_groupanchors.end()) {
|
vecit == m_groupanchors.end()) {
|
||||||
if (m_curanchor >= m_lastanchor)
|
if (m_curanchor >= m_lastanchor)
|
||||||
@ -140,10 +139,8 @@ int PlainToRichQtPreview::nextAnchorNum(int grpidx)
|
|||||||
|
|
||||||
int PlainToRichQtPreview::prevAnchorNum(int grpidx)
|
int PlainToRichQtPreview::prevAnchorNum(int grpidx)
|
||||||
{
|
{
|
||||||
map<unsigned int, unsigned int>::iterator curit =
|
auto curit = m_groupcuranchors.find(grpidx);
|
||||||
m_groupcuranchors.find(grpidx);
|
auto vecit = m_groupanchors.find(grpidx);
|
||||||
map<unsigned int, vector<int> >::iterator vecit =
|
|
||||||
m_groupanchors.find(grpidx);
|
|
||||||
if (grpidx == -1 || curit == m_groupcuranchors.end() ||
|
if (grpidx == -1 || curit == m_groupcuranchors.end() ||
|
||||||
vecit == m_groupanchors.end()) {
|
vecit == m_groupanchors.end()) {
|
||||||
if (m_curanchor <= 1)
|
if (m_curanchor <= 1)
|
||||||
@ -162,7 +159,7 @@ int PlainToRichQtPreview::prevAnchorNum(int grpidx)
|
|||||||
|
|
||||||
QString PlainToRichQtPreview::curAnchorName() const
|
QString PlainToRichQtPreview::curAnchorName() const
|
||||||
{
|
{
|
||||||
return QString::fromUtf8(termAnchorName(m_curanchor).c_str());
|
return u8s2qs(termAnchorName(m_curanchor));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,8 +186,7 @@ void ToRichThread::run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Convert C++ string list to QString list
|
// Convert C++ string list to QString list
|
||||||
for (list<string>::iterator it = out.begin();
|
for (const auto& chunk : out) {
|
||||||
it != out.end(); it++) {
|
m_output.push_back(u8s2qs(chunk));
|
||||||
m_output.push_back(QString::fromUtf8(it->c_str(), it->length()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user