1 // -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; c-brace-offset: 0; -*-
5 // Part of KVIEWSHELL - A framework for multipage text/gfx viewers
7 // (C) 2004 Stefan Kebekus
8 // Distributed under the GPL
13 #include <QGlobalStatic>
16 /** \brief Class to represent a page number
18 The class PageNumber is really nothing but an alias for quint16, and
19 can be casted to and from quint16. It is used in kviewshell to remind
20 the programmer of the convention that page numbers start at '1' (for
21 'first page'), and that the value '0' means 'illegal page number' or
22 'no page number'. Accordingly, the value '0' is also named
23 PageNumber::invalidPage, and there is a trivial method isInvalid()
24 that checks if the page number is 0.
26 @author Stefan Kebekus <kebekus@kde.org>
34 invalidPage
= 0 /*! Invalid page number */
37 /** The default constructor sets the page number to 'invalidPage' */
38 PageNumber() {pgNum
= invalidPage
;}
40 /** \brief Constructor that sets the page number
42 @param num page number that is set initially
44 PageNumber(quint16 num
) {pgNum
= num
;}
46 /** \brief this method implements typecasts from quint16 */
47 PageNumber
&operator=(const quint16 p
) { pgNum
= p
; return *this; }
49 /** \brief This method implements typecasts to quint16 */
50 operator quint16() const { return pgNum
; }
52 /** \brief Checks if the page number is invalid
54 @returns true, if pgNum != invalidPage, i.e., does not equal 0
56 bool isValid() const {return (pgNum
!= invalidPage
);}
59 /** \brief Single number that represents the page number */