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

okteta

  • sources
  • kde-4.12
  • kdesdk
  • okteta
  • core
filebytearraymodel_p.h
Go to the documentation of this file.
1 /*
2  This file is part of the Okteta Core library, made within the KDE community.
3 
4  Copyright 2003,2007,2009 Friedrich W. H. Kossebau <kossebau@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) version 3, or any
10  later version accepted by the membership of KDE e.V. (or its
11  successor approved by the membership of KDE e.V.), which shall
12  act as a proxy defined in Section 6 of version 3 of the license.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public
20  License along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22 
23 #ifndef OKTETA_FILEBYTEARRAYMODEL_P_H
24 #define OKTETA_FILEBYTEARRAYMODEL_P_H
25 
26 // lib
27 #include "filebytearraymodel.h"
28 // Qt
29 #include <QtCore/QVector>
30 #include <QtCore/QFile>
31 
32 
33 namespace Okteta
34 {
35 
36 class FileByteArrayModelPrivate
37 {
38  typedef QVector<char*> KPageOfChar;
39 
40  public:
41  FileByteArrayModelPrivate( int pageNumber, int pageSize );
42 
43  ~FileByteArrayModelPrivate();
44 
45  public:
46  Byte byte( Address offset ) const;
47  Size size() const;
48  bool isReadOnly() const;
49  void setReadOnly( bool readonly );
50 
51  public:
52  bool isOpen() const;
53  bool open( const QString& fileName );
54  bool close();
55 
56  protected:
57  bool ensurePageLoaded( unsigned int pageIndex ) const;
58  bool freePage( unsigned int pageIndex ) const;
59 
60 
61  protected:
63  mutable QFile mFile;
65  bool mReadOnly :1;
66  bool mIsOpen :1;
67  bool mAtEof :1;
69  unsigned int mNoOfUsedPages;
71  mutable int mNoOfFreePages;
73  unsigned int mPageSize;
75  mutable int mFirstPage;
77  mutable int mLastPage;
79  mutable KPageOfChar mData;
81  int mSize;
82 
84  mutable unsigned int mOffsetOfActualPage;
86  mutable char* mActualPage;
87 };
88 
89 
90 inline Size FileByteArrayModelPrivate::size() const { return mSize; }
91 inline bool FileByteArrayModelPrivate::isReadOnly() const { return mReadOnly; }
92 inline void FileByteArrayModelPrivate::setReadOnly( bool readonly ) { mReadOnly = readonly; }
93 
94 inline bool FileByteArrayModelPrivate::isOpen() const { return mFile.isOpen(); }
95 
96 }
97 
98 #endif
Okteta::Address
qint32 Address
Definition: address.h:34
Okteta::FileByteArrayModelPrivate::mNoOfUsedPages
unsigned int mNoOfUsedPages
maximum number of pages which could be currently loaded
Definition: filebytearraymodel_p.h:69
Okteta::FileByteArrayModelPrivate::isOpen
bool isOpen() const
Definition: filebytearraymodel_p.h:94
Okteta::FileByteArrayModelPrivate::setReadOnly
void setReadOnly(bool readonly)
Definition: filebytearraymodel_p.h:92
Okteta::FileByteArrayModelPrivate::mNoOfFreePages
int mNoOfFreePages
number of actually not used pages (in terms of NoOfUsedPages)
Definition: filebytearraymodel_p.h:71
Okteta::Byte
unsigned char Byte
Definition: byte.h:29
Okteta::FileByteArrayModelPrivate
Definition: filebytearraymodel_p.h:36
Okteta::FileByteArrayModelPrivate::FileByteArrayModelPrivate
FileByteArrayModelPrivate(int pageNumber, int pageSize)
filebytearraymodel.h
Okteta::FileByteArrayModelPrivate::mAtEof
bool mAtEof
Definition: filebytearraymodel_p.h:67
QVector< char * >
Okteta::FileByteArrayModelPrivate::mIsOpen
bool mIsOpen
Definition: filebytearraymodel_p.h:66
Okteta::FileByteArrayModelPrivate::mLastPage
int mLastPage
last currently loaded page
Definition: filebytearraymodel_p.h:77
Okteta::FileByteArrayModelPrivate::size
Size size() const
Definition: filebytearraymodel_p.h:90
Okteta::FileByteArrayModelPrivate::ensurePageLoaded
bool ensurePageLoaded(unsigned int pageIndex) const
Okteta::FileByteArrayModelPrivate::mPageSize
unsigned int mPageSize
number of bytes in a page
Definition: filebytearraymodel_p.h:73
Okteta::FileByteArrayModelPrivate::mFirstPage
int mFirstPage
first currently loaded page
Definition: filebytearraymodel_p.h:75
Okteta::FileByteArrayModelPrivate::mOffsetOfActualPage
unsigned int mOffsetOfActualPage
current offset
Definition: filebytearraymodel_p.h:84
Okteta::FileByteArrayModelPrivate::mFile
QFile mFile
Definition: filebytearraymodel_p.h:63
Okteta::FileByteArrayModelPrivate::~FileByteArrayModelPrivate
~FileByteArrayModelPrivate()
Okteta::FileByteArrayModelPrivate::isReadOnly
bool isReadOnly() const
Definition: filebytearraymodel_p.h:91
Okteta::FileByteArrayModelPrivate::close
bool close()
Okteta::FileByteArrayModelPrivate::mSize
int mSize
Definition: filebytearraymodel_p.h:81
Okteta::FileByteArrayModelPrivate::mReadOnly
bool mReadOnly
Definition: filebytearraymodel_p.h:65
Okteta::Size
qint32 Size
Definition: size.h:33
Okteta::FileByteArrayModelPrivate::freePage
bool freePage(unsigned int pageIndex) const
Okteta::FileByteArrayModelPrivate::mData
KPageOfChar mData
Definition: filebytearraymodel_p.h:79
Okteta::FileByteArrayModelPrivate::open
bool open(const QString &fileName)
Okteta::FileByteArrayModelPrivate::mActualPage
char * mActualPage
points to the actual page
Definition: filebytearraymodel_p.h:86
Okteta::FileByteArrayModelPrivate::byte
Byte byte(Address offset) const
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:04:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okteta

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

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • okteta
  • umbrello
  •   umbrello

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