• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Konsole

BlockArray.h

Go to the documentation of this file.
00001 /*
00002     This file is part of Konsole, an X terminal.
00003     Copyright 2000 by Stephan Kulow <coolo@kde.org>
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00018     02110-1301  USA.
00019 */
00020 
00021 #ifndef BLOCKARRAY_H
00022 #define BLOCKARRAY_H
00023 
00024 #include <unistd.h>
00025 
00026 //#error Do not use in KDE 2.1
00027 
00028 #define BlockSize (1 << 12)
00029 #define ENTRIES   ((BlockSize - sizeof(size_t) ) / sizeof(unsigned char))
00030 
00031 namespace Konsole
00032 {
00033 
00034 struct Block {
00035     Block() { size = 0; }
00036     unsigned char data[ENTRIES];
00037     size_t size;
00038 };
00039 
00040 // ///////////////////////////////////////////////////////
00041 
00042 class BlockArray {
00043 public:
00050     BlockArray();
00051 
00053     ~BlockArray();
00054 
00066     size_t append(Block *block);
00067 
00076     const Block *at(size_t index);
00077 
00084     bool setHistorySize(size_t newsize);
00085 
00086     size_t newBlock();
00087 
00088     Block *lastBlock() const;
00089 
00094     bool setSize(size_t newsize);
00095 
00096     size_t len() const { return length; }
00097 
00098     bool has(size_t index) const;
00099 
00100     size_t getCurrent() const { return current; }
00101 
00102 private:
00103     void unmap();
00104     void increaseBuffer();
00105     void decreaseBuffer(size_t newsize);
00106 
00107     size_t size;
00108     // current always shows to the last inserted block
00109     size_t current;
00110     size_t index;
00111 
00112     Block *lastmap;
00113     size_t lastmap_index;
00114     Block *lastblock;
00115 
00116     int ion;
00117     size_t length;
00118 
00119 };
00120 
00121 }
00122 
00123 #endif

Konsole

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

API Reference

Skip menu "API Reference"
  • Konsole
  • Libraries
  •   libkonq
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal