ObjFW
src/OFDataArray.h
00001 /*
00002  * Copyright (c) 2008, 2009, 2010, 2011
00003  *   Jonathan Schleifer <js@webkeks.org>
00004  *
00005  * All rights reserved.
00006  *
00007  * This file is part of ObjFW. It may be distributed under the terms of the
00008  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
00009  * the packaging of this file.
00010  *
00011  * Alternatively, it may be distributed under the terms of the GNU General
00012  * Public License, either version 2 or 3, which can be found in the file
00013  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
00014  * file.
00015  */
00016 
00017 #import "OFObject.h"
00018 
00019 @class OFString;
00020 
00027 @interface OFDataArray: OFObject <OFCopying, OFComparing>
00028 {
00029         char   *data;
00030         size_t count;
00031         size_t itemSize;
00032 }
00033 
00034 #ifdef OF_HAVE_PROPERTIES
00035 @property (readonly) size_t count;
00036 @property (readonly) size_t itemSize;
00037 #endif
00038 
00045 + dataArrayWithItemSize: (size_t)is;
00046 
00054 + dataArrayWithContentsOfFile: (OFString*)path;
00055 
00063 + dataArrayWithBase64EncodedString: (OFString*)str;
00064 
00072 - initWithItemSize: (size_t)is;
00073 
00081 - initWithContentsOfFile: (OFString*)path;
00082 
00090 - initWithBase64EncodedString: (OFString*)str;
00091 
00095 - (size_t)count;
00096 
00100 - (size_t)itemSize;
00101 
00105 - (void*)cArray;
00106 
00113 - (void*)itemAtIndex: (size_t)index;
00114 
00118 - (void*)firstItem;
00119 
00123 - (void*)lastItem;
00124 
00130 - (void)addItem: (const void*)item;
00131 
00138 - (void)addItem: (const void*)item
00139         atIndex: (size_t)index;
00140 
00147 - (void)addNItems: (size_t)nitems
00148        fromCArray: (const void*)carray;
00149 
00157 - (void)addNItems: (size_t)nitems
00158        fromCArray: (const void*)carray
00159           atIndex: (size_t)index;
00160 
00166 - (void)removeItemAtIndex: (size_t)index;
00167 
00173 - (void)removeNItems: (size_t)nitems;
00174 
00181 - (void)removeNItems: (size_t)nitems
00182              atIndex: (size_t)index;
00183 
00187 - (OFString*)stringByBase64Encoding;
00188 @end
00189 
00197 @interface OFBigDataArray: OFDataArray
00198 {
00199         size_t size;
00200 }
00201 @end
00202 
00203 #import "OFDataArray+Hashing.h"
 All Classes Functions Variables