diff --git a/src/Color.cpp b/src/Color.cpp index 54a4743d91..472f244a1a 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -303,7 +303,7 @@ ColorSet::ColorSet() { Color_inherit, N_("inherit"), "inherit", "black", "inherit" }, { Color_regexpframe, N_("regexp frame"), "regexpframe", "green", "regexpframe" }, { Color_ignore, N_("ignore"), "ignore", "black", "ignore" }, - { Color_ignore, 0, 0, 0, 0 } + { Color_ignore, nullptr, nullptr, nullptr, nullptr } }; for (int i = 0; items[i].guiname; ++i) diff --git a/src/EnchantChecker.cpp b/src/EnchantChecker.cpp index 47eb35e52e..66931fa07b 100644 --- a/src/EnchantChecker.cpp +++ b/src/EnchantChecker.cpp @@ -90,7 +90,7 @@ enchant::Dict * EnchantChecker::Private::addSpeller(string const & lang) const char * what = e.what(); LYXERR(Debug::FILES, "cannot add enchant speller: " << ((what && *what) ? what : "unspecified enchant exception in request_dict()")); - m.speller = 0; + m.speller = nullptr; } spellers_[lang] = m; return m.speller; diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 47e27eb97d..b24c31366f 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -67,7 +67,7 @@ EncodingException::EncodingException(char_type c) } -const char * EncodingException::what() const throw() +const char * EncodingException::what() const noexcept { return "Could not find LaTeX command for a character"; } diff --git a/src/Encoding.h b/src/Encoding.h index df900b343b..6bd90c7b80 100644 --- a/src/Encoding.h +++ b/src/Encoding.h @@ -28,8 +28,8 @@ namespace support { class FileName; } class EncodingException : public std::exception { public: EncodingException(char_type c); - virtual ~EncodingException() throw() {} - virtual const char * what() const throw(); + virtual ~EncodingException() noexcept {} + virtual const char * what() const noexcept; char_type failed_char; int par_id; @@ -130,7 +130,7 @@ public: /// Represent any of the above packages static int const any; /// - Encoding() : fixedwidth_(true), unsafe_(false), forced_(0), + Encoding() : fixedwidth_(true), unsafe_(false), forced_(nullptr), start_encodable_(0), package_(none), complete_(false) {} /// Encoding(std::string const & n, std::string const & l, @@ -333,7 +333,7 @@ public: */ static char_type fromLaTeXCommand(docstring const & cmd, int cmdtype, bool & combining, bool & needsTermination, - std::set * req = 0); + std::set * req = nullptr); /// enum LatexCmd { /// @@ -353,7 +353,7 @@ public: */ static docstring fromLaTeXCommand(docstring const & cmd, int cmdtype, bool & needsTermination, docstring & rem, - std::set * req = 0); + std::set * req = nullptr); protected: /// diff --git a/src/LayoutModuleList.cpp b/src/LayoutModuleList.cpp index b7da879253..b2e9067ed2 100644 --- a/src/LayoutModuleList.cpp +++ b/src/LayoutModuleList.cpp @@ -1,10 +1,10 @@ // -*- C++ -*- /** - * \file ModuleList.cpp + * \file LayoutModuleList.cpp * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author Richard Heck + * \author Richard Kimberly Heck * * Full author contact details are available in file CREDITS. */ diff --git a/src/Lexer.cpp b/src/Lexer.cpp index 098faa9737..3f0392902c 100644 --- a/src/Lexer.cpp +++ b/src/Lexer.cpp @@ -102,10 +102,10 @@ public: int lineno; /// string pushTok; - /// - char commentChar; /// used for error messages string context; + /// + char commentChar; private: /// non-copyable Pimpl(Pimpl const &); @@ -118,7 +118,7 @@ private: public: /// PushedTable() - : table_elem(0), table_siz(0) {} + : table_elem(nullptr), table_siz(0) {} /// PushedTable(LexerKeyword * ki, int siz) : table_elem(ki), table_siz(siz) {} @@ -567,7 +567,7 @@ void Lexer::Pimpl::pushToken(string const & pt) ////////////////////////////////////////////////////////////////////// Lexer::Lexer() - : pimpl_(new Pimpl(0, 0)), lastReadOk_(false) + : pimpl_(new Pimpl(nullptr, 0)), lastReadOk_(false) {} @@ -808,7 +808,7 @@ Lexer::operator void const *() const // use fail() here. However, our implementation of getString() et al. // can cause the eof() and fail() bits to be set, even though we // haven't tried to read 'em. - return lastReadOk_? this : 0; + return lastReadOk_? this : nullptr; } diff --git a/src/LyXVC.cpp b/src/LyXVC.cpp index cb2c5488f2..806d5e8143 100644 --- a/src/LyXVC.cpp +++ b/src/LyXVC.cpp @@ -37,7 +37,7 @@ namespace Alert = frontend::Alert; LyXVC::LyXVC() { - owner_ = 0; + owner_ = nullptr; } @@ -91,7 +91,7 @@ bool LyXVC::file_found_hook(FileName const & fn) } // file is not under any VCS. - vcs.reset(0); + vcs.reset(nullptr); return false; } @@ -186,7 +186,7 @@ bool LyXVC::registrer() _("(no initial description)")); if (!ok) { LYXERR(Debug::LYXVC, "LyXVC: user cancelled"); - vcs.reset(0); + vcs.reset(nullptr); return false; } if (response.empty()) diff --git a/src/ModuleList.cpp b/src/ModuleList.cpp index 356bbe9379..d283058046 100644 --- a/src/ModuleList.cpp +++ b/src/ModuleList.cpp @@ -259,7 +259,7 @@ LyXModule const * ModuleList::operator[](string const & str) const LyXModule const & mod = *it; return &mod; } - return 0; + return nullptr; } @@ -271,7 +271,7 @@ LyXModule * ModuleList::operator[](string const & str) LyXModule & mod = *it; return &mod; } - return 0; + return nullptr; } } // namespace lyx diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index d10de5ed74..9381bd5cda 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -21,7 +21,7 @@ namespace lyx { OutputParams::OutputParams(Encoding const * enc) : flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false), moving_arg(false), intitle(false), inbranch(false), inulemcmd(0), - local_font(0),master_language(0), encoding(enc), free_spacing(false), + local_font(nullptr),master_language(nullptr), encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false), use_hyperref(false), use_CJK(false), use_indices(false), use_japanese(false), linelen(0), depth(0), exportdata(new ExportData), postpone_fragile_stuff(false), inDisplayMath(false), diff --git a/src/Thesaurus.cpp b/src/Thesaurus.cpp index e2c28183ee..86cbd65906 100644 --- a/src/Thesaurus.cpp +++ b/src/Thesaurus.cpp @@ -216,7 +216,7 @@ bool Thesaurus::thesaurusInstalled(docstring const & lang) const Thesaurus::Meanings Thesaurus::lookup(WordLangTuple const & wl) { Meanings meanings; - MyThes * mythes = 0; + MyThes * mythes = nullptr; docstring const lang_code = from_ascii(wl.lang()->code()); docstring const t = wl.word(); diff --git a/src/Undo.cpp b/src/Undo.cpp index 28a2e82239..da4d27ca03 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -76,28 +76,25 @@ struct UndoElement StableDocIterator const & cel, pit_type fro, pit_type en, ParagraphList * pl, MathData * ar, bool lc, size_t gid) : - kind(kin), cur_before(cb), cell(cel), from(fro), end(en), - pars(pl), array(ar), bparams(0), - lyx_clean(lc), group_id(gid), time(current_time()) - { - } + cur_before(cb), cell(cel), from(fro), end(en), + pars(pl), array(ar), bparams(nullptr), + group_id(gid), time(current_time()), kind(kin), lyx_clean(lc) + {} /// UndoElement(CursorData const & cb, BufferParams const & bp, bool lc, size_t gid) : - kind(ATOMIC_UNDO), cur_before(cb), cell(), from(0), end(0), - pars(0), array(0), bparams(new BufferParams(bp)), - lyx_clean(lc), group_id(gid), time(current_time()) - { - } + cur_before(cb), cell(), from(0), end(0), + pars(nullptr), array(nullptr), bparams(new BufferParams(bp)), + group_id(gid), time(current_time()), kind(ATOMIC_UNDO), lyx_clean(lc) + {} /// UndoElement(UndoElement const & ue) : - kind(ue.kind), cur_before(ue.cur_before), cur_after(ue.cur_after), cell(ue.cell), from(ue.from), end(ue.end), pars(ue.pars), array(ue.array), - bparams(ue.bparams ? new BufferParams(*ue.bparams) : 0), - lyx_clean(ue.lyx_clean), group_id(ue.group_id), - time(current_time()) + bparams(ue.bparams ? new BufferParams(*ue.bparams) : nullptr), + group_id(ue.group_id), time(current_time()), kind(ue.kind), + lyx_clean(ue.lyx_clean) {} /// ~UndoElement() @@ -105,8 +102,6 @@ struct UndoElement if (bparams) delete bparams; } - /// Which kind of operation are we recording for? - UndoKind kind; /// the position of the cursor before recordUndo CursorData cur_before; /// the position of the cursor at the end of the undo group @@ -123,12 +118,14 @@ struct UndoElement MathData * array; /// Only used in case of params undo BufferParams const * bparams; - /// Was the buffer clean at this point? - bool lyx_clean; /// the element's group id size_t group_id; /// timestamp time_t time; + /// Which kind of operation are we recording for? + UndoKind kind; + /// Was the buffer clean at this point? + bool lyx_clean; private: /// Protect construction UndoElement(); @@ -193,8 +190,8 @@ private: struct Undo::Private { - Private(Buffer & buffer) : buffer_(buffer), undo_finished_(true), - group_id_(0), group_level_(0) {} + Private(Buffer & buffer) : buffer_(buffer), + group_id_(0), group_level_(0), undo_finished_(true) {} // Do one undo/redo step void doUndoRedoAction(CursorData & cur, UndoElementStack & stack, @@ -227,15 +224,16 @@ struct Undo::Private /// Redo stack. UndoElementStack redostack_; - /// The flag used by Undo::finishUndo(). - bool undo_finished_; - /// Current group Id. size_t group_id_; /// Current group nesting nevel. size_t group_level_; /// the position of cursor before the group was created CursorData group_cur_before_; + + /// The flag used by Undo::finishUndo(). + bool undo_finished_; + }; @@ -343,7 +341,7 @@ void Undo::Private::doRecordUndo(UndoKind kind, // create the position information of the Undo entry UndoElement undo(kind, group_cur_before_.empty() ? cur_before : group_cur_before_, - cell, from, end, 0, 0, buffer_.isClean(), group_id_); + cell, from, end, nullptr, nullptr, buffer_.isClean(), group_id_); // fill in the real data to be saved if (cell.inMathed()) { @@ -468,7 +466,7 @@ void Undo::Private::doUndoRedoAction(CursorData & cur, UndoElementStack & stack, dit.cell().swap(*undo.array); dit.inset().setBuffer(buffer_); delete undo.array; - undo.array = 0; + undo.array = nullptr; } else { // Some finer machinery is needed here. Text * text = dit.text(); @@ -504,12 +502,12 @@ void Undo::Private::doUndoRedoAction(CursorData & cur, UndoElementStack & stack, fpit->setInsetBuffers(buffer_); delete undo.pars; - undo.pars = 0; + undo.pars = nullptr; } // We'll clean up in release mode. - LASSERT(undo.pars == 0, undo.pars = 0); - LASSERT(undo.array == 0, undo.array = 0); + LASSERT(undo.pars == nullptr, undo.pars = nullptr); + LASSERT(undo.array == nullptr, undo.array = nullptr); if (!undo.cur_before.empty()) cur = undo.cur_before; diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index 42fd36be31..3ea4624399 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -971,7 +971,7 @@ string CVS::repoUpdate() dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName())); ret = frontend::Alert::prompt(_("Changes detected"), text, 0, 1, _("&Continue"), _("&Abort")); - hideDialogs("file", 0); + hideDialogs("file", nullptr); } if (ret == 1) return string(); @@ -1532,7 +1532,7 @@ string SVN::repoUpdate() dispatch(FuncRequest(LFUN_DIALOG_SHOW, "file " + tmpf.absFileName())); ret = frontend::Alert::prompt(_("Changes detected"), text, 0, 1, _("&Yes"), _("&No")); - hideDialogs("file", 0); + hideDialogs("file", nullptr); } if (ret == 1) return string(); diff --git a/src/lengthcommon.cpp b/src/lengthcommon.cpp index f71d009dbd..4478d84ae5 100644 --- a/src/lengthcommon.cpp +++ b/src/lengthcommon.cpp @@ -210,7 +210,7 @@ LaTeXLength table[] = { const char * stringFromUnit(int unit) { if (unit < 0 || unit > num_units) - return 0; + return nullptr; return unit_name[unit]; } diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index 080369f104..c820c8a015 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -878,7 +878,7 @@ ParagraphList::const_iterator makeParagraphs(Buffer const & buf, // because of branches, e.g., a branch that contains an entire new section. // We do not really want to wrap that whole thing in a
...
. bool special_case = false; - Inset const * specinset = par->size() == 1 ? par->getInset(0) : 0; + Inset const * specinset = par->size() == 1 ? par->getInset(0) : nullptr; if (specinset && !specinset->getLayout().htmlisblock()) { Layout const & style = par->layout(); FontInfo const first_font = style.labeltype == LABEL_MANUAL ? @@ -974,7 +974,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, xs << html::CR(); // we will on occasion need to remember a layout from before. - Layout const * lastlay = 0; + Layout const * lastlay = nullptr; while (par != pend) { Layout const & style = par->layout(); @@ -1002,9 +1002,9 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, // started---which we will be if the depth is the same. if (par->params().depth() == origdepth) { LATTEST(bstyle == style); - if (lastlay != 0) { + if (lastlay != nullptr) { closeItemTag(xs, *lastlay); - lastlay = 0; + lastlay = nullptr; } // this will be positive, if we want to skip the @@ -1093,7 +1093,7 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf, } } - if (lastlay != 0) + if (lastlay != nullptr) closeItemTag(xs, *lastlay); closeTag(xs, bstyle); xs << html::CR();