• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • core
pagesize.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007 by Pino Toscano <pino@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  ***************************************************************************/
9 
10 // local includes
11 #include "pagesize.h"
12 
13 using namespace Okular;
14 
15 class Okular::PageSizePrivate
16  : public QSharedData
17 {
18  public:
19  PageSizePrivate()
20  : m_width( 0 ), m_height( 0 )
21  {
22  }
23 
24  bool operator==( const PageSizePrivate &rhs ) const
25  {
26  return m_width == rhs.m_width &&
27  m_height == rhs.m_height &&
28  m_name == rhs.m_name;
29  }
30 
31  double m_width;
32  double m_height;
33  QString m_name;
34 };
35 
36 
37 PageSize::PageSize()
38 {
39 }
40 
41 PageSize::PageSize( double width, double height, const QString &name )
42  : d( new PageSizePrivate )
43 {
44  d->m_width = width;
45  d->m_height = height;
46  d->m_name = name;
47 }
48 
49 PageSize::PageSize( const PageSize &pageSize )
50  : d( pageSize.d )
51 {
52 }
53 
54 PageSize::~PageSize()
55 {
56 }
57 
58 double PageSize::width() const
59 {
60  if ( !d )
61  return 0;
62 
63  return d->m_width;
64 }
65 
66 double PageSize::height() const
67 {
68  if ( !d )
69  return 0;
70 
71  return d->m_height;
72 }
73 
74 QString PageSize::name() const
75 {
76  if ( !d )
77  return QString();
78 
79  return d->m_name;
80 }
81 
82 bool PageSize::isNull() const
83 {
84  if ( !d )
85  return true;
86 
87  return d->m_width == 0 && d->m_height == 0 && d->m_name.isEmpty();
88 }
89 
90 bool PageSize::operator==( const PageSize &pageSize ) const
91 {
92  // 1st: we're null: check if the other is null too
93  if ( !d )
94  return !pageSize.d;
95  // 2nd: we're not null, return if the other is null
96  if ( !pageSize.d )
97  return false;
98 
99  // 3rd: normal == check
100  return *d == *pageSize.d;
101 }
102 
103 bool PageSize::operator!=( const PageSize &pageSize ) const
104 {
105  return !operator==( pageSize );
106 }
107 
108 PageSize& PageSize::operator=( const PageSize &pageSize )
109 {
110  if ( this == &pageSize )
111  return *this;
112 
113  d = pageSize.d;
114  return *this;
115 }
116 
Okular::PageSize::operator!=
bool operator!=(const PageSize &pageSize) const
Definition: pagesize.cpp:103
Okular::PageSize::~PageSize
~PageSize()
Definition: pagesize.cpp:54
Okular::PageSize::operator=
PageSize & operator=(const PageSize &pageSize)
Definition: pagesize.cpp:108
pagesize.h
Okular::PageSize::height
double height() const
Returns the height of the page size.
Definition: pagesize.cpp:66
Okular::PageSize::name
QString name() const
Returns the ID of the page size.
Definition: pagesize.cpp:74
Okular::PageSize::width
double width() const
Returns the width of the page size.
Definition: pagesize.cpp:58
Okular::PageSize::isNull
bool isNull() const
Whether the page size is null.
Definition: pagesize.cpp:82
Okular::PageSize::PageSize
PageSize()
Construct a null page size.
Definition: pagesize.cpp:37
Okular::PageSize
A small class that represents the size of a page.
Definition: pagesize.h:26
Okular::PageSize::operator==
bool operator==(const PageSize &pageSize) const
Comparison operator.
Definition: pagesize.cpp:90
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal