]> git.lyx.org Git - features.git/commit
Remove unneccessary uses of dynamic_cast from the code.
authorVincent van Ravesteijn <vfr@lyx.org>
Tue, 26 Oct 2010 15:03:51 +0000 (15:03 +0000)
committerVincent van Ravesteijn <vfr@lyx.org>
Tue, 26 Oct 2010 15:03:51 +0000 (15:03 +0000)
commit573500dd04f154f27318ac5ec469a337f97fe9f0
tree531e38b9a8e51727965d0da79fe64b7bb89c51d9
parent8d10d82392aab330c2460d468dfa86ddd863c3c0
Remove unneccessary uses of dynamic_cast from the code.

A dynamic_cast is necessary when:

- the object to be casted is from an external library because we can't add Qxxx::asXxxx() to Qt e.g.:
    * QAbstractListModel to GuiIdListModel,
    * QValidator to PathValidator,
    * QWidget to TabWorkArea,
    * QWidget to GuiWorkArea;

- the object is to be casted from an interface to the implementing class, because the Interface does not know by whom it is implemented:
    * ProgressInterface to GuiProgress,
    * Application to GuiApplication.

A dynamic_cast can be replaced by:
  - already existing as***Inset() functions, e.g.:
    * asHullInset(),
    * asInsetMath()->asMacro(),
    * asInsetText();

  - a static_cast when we are sure this can't go wrong, e.g.:
    * we are sure that CellData::inset->clone() is an InsetTableCell,
    * in cases where we explicitly check it->lyxCode().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35855 a592a061-630c-0410-9148-cb99ea01b6c8
src/Buffer.cpp
src/CutAndPaste.cpp
src/DocIterator.cpp
src/Text3.cpp
src/insets/InsetTabular.cpp
src/mathed/InsetMathNest.cpp
src/mathed/MathMacro.cpp