Commit 6d0d61c2 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable clazy copyable-polymorphic

parent 93540ac1
......@@ -48,7 +48,7 @@ build_clazy_clang_tidy:
script:
- srcdir=`pwd` && mkdir -p /tmp/okular_build && cd /tmp/okular_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && cat compile_commands.aux.json | jq '[.[] | select(.file | contains("/synctex/")| not)]' > compile_commands.json
- CLAZY_IGNORE_DIRS="settings_core.cpp|settings.cpp" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-copyable-polymorphic,no-qstring-allocations,no-missing-qobject-macro" ninja
- CLAZY_IGNORE_DIRS="settings_core.cpp|settings.cpp" CLAZY_CHECKS="level0,level1,level2,no-ctor-missing-parent-argument,no-qstring-allocations,no-missing-qobject-macro" ninja
# Fix the poppler header, remove when debian:unstable ships poppler 0.82 or later
- sed -i "N;N;N;N; s#class MediaRendition\;\nclass MovieAnnotation\;\nclass ScreenAnnotation;#class MediaRendition\;#g" /usr/include/poppler/qt5/poppler-link.h
- "run-clang-tidy -header-filter='.*/okular/.*' -checks='-*,performance-*,bugprone-*,readability-inconsistent-declaration-parameter-name,readability-string-compare,modernize-redundant-void-arg,modernize-use-bool-literals,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-loop-convert,modernize-use-nullptr,-bugprone-macro-parentheses,-bugprone-narrowing-conversions,-bugprone-branch-clone,-bugprone-incorrect-roundings' -config=\"{WarningsAsErrors: '*'}\""
......@@ -32,6 +32,9 @@ class Okular::ActionPrivate
qDeleteAll( m_nextActions );
}
ActionPrivate(const ActionPrivate &) = delete;
ActionPrivate &operator=(const ActionPrivate &) = delete;
QVariant m_nativeId;
QVector< Action * > m_nextActions;
};
......
......@@ -168,6 +168,10 @@ QRect AnnotationUtils::annotationGeometry( const Annotation * annotation,
}
//END AnnotationUtils implementation
AnnotationProxy::AnnotationProxy()
{
}
AnnotationProxy::~AnnotationProxy()
{
}
......
......@@ -716,11 +716,16 @@ class OKULARCORE_EXPORT AnnotationProxy
Removal ///< Generator can remove native annotations
};
AnnotationProxy();
/**
* Destroys the annotation proxy.
*/
virtual ~AnnotationProxy();
AnnotationProxy(const AnnotationProxy &) = delete;
AnnotationProxy &operator=(const AnnotationProxy &) = delete;
/**
* Query for the supported capabilities.
*/
......
......@@ -32,6 +32,9 @@ class AnnotationPrivate
virtual ~AnnotationPrivate();
AnnotationPrivate(const AnnotationPrivate &) = delete;
AnnotationPrivate &operator=(const AnnotationPrivate &) = delete;
/**
* Transforms the annotation coordinates with the transformation
* defined by @p matrix.
......
......@@ -493,6 +493,9 @@ class OKULARCORE_EXPORT ObjectRect
*/
virtual ~ObjectRect();
ObjectRect(const ObjectRect &o) = delete;
ObjectRect &operator=(const ObjectRect &o) = delete;
/**
* Returns the object type of the object rectangle.
* @see ObjectType
......
......@@ -106,6 +106,9 @@ class BookmarkManager::Private : public KBookmarkOwner
// delete manager;
}
Private(const Private &) = delete;
Private &operator=(const Private &) = delete;
QUrl currentUrl() const override;
QString currentTitle() const override;
bool enableOption(BookmarkOption option) const override;
......
......@@ -1410,6 +1410,9 @@ class OKULARCORE_EXPORT EmbeddedFile
*/
virtual ~EmbeddedFile();
EmbeddedFile(const EmbeddedFile &) = delete;
EmbeddedFile &operator=(const EmbeddedFile &) = delete;
/**
* Returns the name of the file
*/
......
......@@ -25,6 +25,9 @@ class FormFieldPrivate
explicit FormFieldPrivate( FormField::FieldType type );
virtual ~FormFieldPrivate();
FormFieldPrivate(const FormFieldPrivate &) = delete;
FormFieldPrivate &operator=(const FormFieldPrivate &) = delete;
void setDefault();
virtual void setValue( const QString& ) = 0;
......
......@@ -37,6 +37,9 @@ class OKULARCORE_EXPORT DocumentObserver
*/
virtual ~DocumentObserver();
DocumentObserver(const DocumentObserver &) = delete;
DocumentObserver &operator=(const DocumentObserver &) = delete;
/**
* Flags that can be sent from the document to all observers to
* inform them about the type of object that has been changed.
......
......@@ -33,6 +33,9 @@ class RotationJobInternal : public ThreadWeaver::Job
Rotation rotation() const;
NormalizedRect rect() const;
RotationJobInternal(const RotationJobInternal &) = delete;
RotationJobInternal &operator=(const RotationJobInternal &) = delete;
protected:
void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) override;
......
......@@ -24,6 +24,9 @@ class ViewPrivate
ViewPrivate();
virtual ~ViewPrivate();
ViewPrivate(const ViewPrivate &) = delete;
ViewPrivate &operator=(const ViewPrivate &) = delete;
QString name;
DocumentPrivate *document;
};
......
......@@ -37,6 +37,9 @@ public:
ProtocolMSITS ( const QByteArray&, const QByteArray& );
~ProtocolMSITS() override;
ProtocolMSITS(const ProtocolMSITS &) = delete;
ProtocolMSITS &operator=(const ProtocolMSITS &) = delete;
void get (const QUrl & ) override;
void listDir (const QUrl & url) override;
void stat (const QUrl & url) override;
......
......@@ -84,6 +84,9 @@ class EBook
EBook();
virtual ~EBook();
EBook(const EBook &) = delete;
EBook &operator=(const EBook &) = delete;
/*!
* \brief Attempts to load chm or epub file.
* \param archiveName filename.
......
......@@ -29,6 +29,9 @@ class UnrarFlavour
public:
virtual ~UnrarFlavour();
UnrarFlavour(const UnrarFlavour &) = delete;
UnrarFlavour &operator=(const UnrarFlavour &) = delete;
virtual QStringList processListing( const QStringList &data ) = 0;
virtual QString name() const = 0;
......
......@@ -70,8 +70,12 @@ class KDjVu
friend class KDjVu;
public:
Link() = default;
virtual ~Link();
Link(const Link &) = delete;
Link &operator=(const Link &) = delete;
enum LinkType { PageLink, UrlLink };
enum LinkArea { UnknownArea, RectArea, EllipseArea, PolygonArea };
virtual int type() const = 0;
......@@ -130,6 +134,9 @@ class KDjVu
public:
virtual ~Annotation();
Annotation(const Annotation &) = delete;
Annotation &operator=(const Annotation &) = delete;
enum AnnotationType { TextAnnotation, LineAnnotation };
virtual int type() const = 0;
QPoint point() const;
......
......@@ -23,6 +23,9 @@ class TeXFont {
virtual ~TeXFont();
TeXFont(const TeXFont &) = delete;
TeXFont &operator=(const TeXFont &) = delete;
void setDisplayResolution()
{
for(glyph &g : glyphtable)
......
......@@ -9,14 +9,6 @@
#include "dviPageInfo.h"
dviPageInfo::dviPageInfo( const dviPageInfo &dvipi )
{
width = dvipi.width;
height = dvipi.height;
resolution = dvipi.resolution;
pageNumber = dvipi.pageNumber;
}
dviPageInfo::dviPageInfo()
{
sourceHyperLinkList.reserve(200);
......
......@@ -26,10 +26,12 @@ public:
PageNumber pageNumber;
dviPageInfo();
dviPageInfo( const dviPageInfo &dvipi );
virtual ~dviPageInfo();
dviPageInfo(const dviPageInfo &) = delete;
dviPageInfo &operator=(const dviPageInfo &) = delete;
virtual void clear();
/** \brief List of source hyperlinks
......
......@@ -212,17 +212,12 @@ QImage DviGenerator::image( Okular::PixmapRequest *request )
if (s.isValid())
{
ps = s; /* it should be the user specified size, if any, instead */
pageInfo->resolution = (double)(pageInfo->width)/s.width().getLength_in_inch();
}
else
{
pageInfo->resolution = (double)(pageInfo->width)/ps.width().getLength_in_inch();
}
pageInfo->resolution = (double)(pageInfo->width)/ps.width().getLength_in_inch();
#if 0
qCDebug(OkularDviDebug) << *request
<< ", res:" << pageInfo->resolution << " - (" << pageInfo->width << ","
<< ps.width().getLength_in_inch() << ")," << ps.width().getLength_in_mm()
<< endl;
#endif
m_dviRenderer->drawPage( pageInfo );
......
......@@ -171,21 +171,6 @@ void pageSize::setPageSize(const QString& width, const QString& _widthUnits, con
emit sizeChanged(*this);
}
pageSize &pageSize::operator= (const pageSize &src)
{
SimplePageSize oldPage = *this;
currentSize = src.currentSize;
pageWidth = src.pageWidth;
pageHeight = src.pageHeight;
if ( !isNearlyEqual(oldPage))
emit sizeChanged(*this);
return *this;
}
void pageSize::rectifySizes()
{
// Now do some sanity checks to make sure that values are not
......
......@@ -53,6 +53,9 @@ public:
/** \brief Initializes the pageSize with a SimplePageSize. */
pageSize(const SimplePageSize&);
pageSize(const pageSize &) = delete;
pageSize &operator=(const pageSize &) = delete;
/** \brief List of standard pageSizes
This method returns the names of standard pageSizes,
......@@ -139,16 +142,9 @@ public:
@param height_in_mm page height in mm
*/
virtual void setPageSize(double width_in_mm, double height_in_mm);
void setPageSize(double width_in_mm, double height_in_mm);
using SimplePageSize::setPageSize;
/** \brief Copy operator.
This operator will emit the signal sizeChanged() if one of the
dimensions of *this and src differ by more than two millimeters.
*/
pageSize & operator= (const pageSize &src);
/** \brief Preferred unit for the current page size
@returns The name of the unit, one of "cm", "mm" or "in", which is
......
......@@ -47,7 +47,7 @@ class SimplePageSize
*/
SimplePageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; }
virtual ~SimplePageSize() {}
~SimplePageSize() {}
/** \brief Sets the page width and height
......@@ -57,7 +57,7 @@ class SimplePageSize
@param width
@param height
*/
virtual void setPageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; }
void setPageSize(const Length width, const Length height) { pageWidth = width; pageHeight = height; }
/** \brief Returns the page width. */
Length width() const { return pageWidth; }
......
......@@ -38,11 +38,16 @@ namespace Okular {
class OKULARCORE_EXPORT ConfigInterface
{
public:
ConfigInterface() {}
/**
* Destroys the config interface.
*/
virtual ~ConfigInterface() {}
ConfigInterface(const ConfigInterface &) = delete;
ConfigInterface &operator=(const ConfigInterface &) = delete;
/**
* This method is called to tell the generator to re-parse its configuration.
*
......
......@@ -39,11 +39,16 @@ namespace Okular {
class OKULARCORE_EXPORT GuiInterface : protected KXMLGUIClient
{
public:
GuiInterface() {}
/**
* Destroys the gui interface.
*/
~GuiInterface() override {}
GuiInterface(const GuiInterface &) = delete;
GuiInterface &operator=(const GuiInterface &) = delete;
/**
* This method requests the XML GUI Client provided by the interface.
*/
......
......@@ -39,11 +39,16 @@ namespace Okular {
class OKULARCORE_EXPORT PrintInterface
{
public:
PrintInterface() {}
/**
* Destroys the printer interface.
*/
virtual ~PrintInterface() {}
PrintInterface(const PrintInterface &) = delete;
PrintInterface &operator=(const PrintInterface &) = delete;
/**
* Builds and returns a new printing configuration widget.
*
......
......@@ -49,11 +49,16 @@ class OKULARCORE_EXPORT SaveInterface
};
Q_DECLARE_FLAGS( SaveOptions, SaveOption )
SaveInterface() {}
/**
* Destroys the save interface.
*/
virtual ~SaveInterface() {}
SaveInterface(const SaveInterface &) = delete;
SaveInterface &operator=(const SaveInterface &) = delete;
/**
* Query for the supported saving options.
*
......
......@@ -31,8 +31,12 @@ namespace Okular {
class VIEWERINTERFACE_EXPORT ViewerInterface
{
public:
ViewerInterface() {}
virtual ~ViewerInterface() {}
ViewerInterface(const ViewerInterface &) = delete;
ViewerInterface &operator=(const ViewerInterface &) = delete;
/**
* Show the specified source location centrally in the viewer.
*
......
......@@ -24,8 +24,12 @@ class QUrl;
class OKULARPART_EXPORT KDocumentViewer
{
public:
KDocumentViewer() {}
virtual ~KDocumentViewer() {}
KDocumentViewer(const KDocumentViewer &) = delete;
KDocumentViewer &operator=(const KDocumentViewer &) = delete;
/**
* Open the document at the specified @p url at page @p page.
*/
......
......@@ -35,6 +35,9 @@ class AnnotatorEngine
explicit AnnotatorEngine( const QDomElement & engineElement );
virtual ~AnnotatorEngine();
AnnotatorEngine(const AnnotatorEngine &) = delete;
AnnotatorEngine &operator=(const AnnotatorEngine &) = delete;
// enum definitions
enum EventType { Press, Move, Release };
enum Button { None, Left, Right };
......
......@@ -47,6 +47,9 @@ class BookmarkItem : public QTreeWidgetItem
setData( 0, PageItemDelegate::PageRole, QString::number( m_viewport.pageNumber + 1 ) );
}
BookmarkItem(const BookmarkItem &) = delete;
BookmarkItem &operator=(const BookmarkItem &) = delete;
QVariant data( int column, int role ) const override
{
switch ( role )
......@@ -101,6 +104,9 @@ class FileItem : public QTreeWidgetItem
setData( 0, UrlRole, QVariant::fromValue( url ) );
}
FileItem(const FileItem &) = delete;
FileItem &operator=(const FileItem &) = delete;
QVariant data( int column, int role ) const override
{
switch ( role )
......
......@@ -161,6 +161,9 @@ class FormWidgetIface
FormWidgetIface( QWidget * w, Okular::FormField * ff );
virtual ~FormWidgetIface();
FormWidgetIface(const FormWidgetIface &) = delete;
FormWidgetIface &operator=(const FormWidgetIface &) = delete;
Okular::NormalizedRect rect() const;
void setWidthHeight( int w, int h );
void moveTo( int x, int y );
......
......@@ -50,6 +50,9 @@ class SidebarItem : public QListWidgetItem
setToolTip( text );
}
SidebarItem(const SidebarItem &) = delete;
SidebarItem &operator=(const SidebarItem &) = delete;
QWidget* widget() const
{
return m_widget;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment