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

kget

array.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Joris Guisson                                   *
00003  *   joris.guisson@gmail.com                                               *
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                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.             *
00019  ***************************************************************************/
00020 #ifndef BTARRAY_H
00021 #define BTARRAY_H
00022 
00023 #include <btcore_export.h>
00024 #include "constants.h"
00025 
00026 namespace bt
00027 {
00028 
00035     template<class T>
00036     class BTCORE_EXPORT Array
00037     {
00038         Uint32 num;
00039         T* data;
00040     public:
00041         Array(Uint32 num = 0) : num(num),data(0)
00042         {
00043             if (num > 0)
00044                 data = new T[num];
00045         }
00046 
00047         ~Array()
00048         {
00049             delete [] data;
00050         }
00051 
00052         T & operator [] (Uint32 i) {return data[i];}
00053         const T & operator [] (Uint32 i) const {return data[i];}
00054 
00055         operator const T* () const {return data;}
00056         operator T* () {return data;}
00057 
00059         Uint32 size() const {return num;}
00060 
00065         void fill(T val)
00066         {
00067             for (Uint32 i = 0;i < num;i++)
00068                 data[i] = val;
00069         }
00070     };
00071 
00072 }
00073 
00074 #endif

kget

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

kdenetwork

Skip menu "kdenetwork"
  • kget
  • kopete
  •   kopete
  •   libkopete
  •       libpapillon
  • krfb
Generated for kdenetwork by doxygen 1.5.4
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