ObjFW
|
00001 /* 00002 * Copyright (c) 2008, 2009, 2010, 2011, 2012 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 #import "OFSerialization.h" 00019 00020 @class OFString; 00021 @class OFURL; 00022 00032 @interface OFDataArray: OFObject <OFCopying, OFComparing, OFSerialization> 00033 { 00034 char *data; 00035 size_t count; 00036 size_t itemSize; 00037 } 00038 00039 #ifdef OF_HAVE_PROPERTIES 00040 @property (readonly, getter=cArray) void *data; 00041 @property (readonly) size_t count; 00042 @property (readonly) size_t itemSize; 00043 #endif 00044 00050 + dataArray; 00051 00058 + dataArrayWithItemSize: (size_t)itemSize; 00059 00067 + dataArrayWithContentsOfFile: (OFString*)path; 00068 00076 + dataArrayWithContentsOfURL: (OFURL*)URL; 00077 00085 + dataArrayWithBase64EncodedString: (OFString*)string; 00086 00092 - init; 00093 00101 - initWithItemSize: (size_t)itemSize; 00102 00110 - initWithContentsOfFile: (OFString*)path; 00111 00119 - initWithContentsOfURL: (OFURL*)URL; 00120 00128 - initWithBase64EncodedString: (OFString*)string; 00129 00135 - (size_t)count; 00136 00142 - (size_t)itemSize; 00143 00154 - (void*)cArray; 00155 00162 - (void*)itemAtIndex: (size_t)index; 00163 00169 - (void*)firstItem; 00170 00176 - (void*)lastItem; 00177 00183 - (void)addItem: (const void*)item; 00184 00191 - (void)addItem: (const void*)item 00192 atIndex: (size_t)index; 00193 00200 - (void)addNItems: (size_t)nItems 00201 fromCArray: (const void*)cArray; 00202 00210 - (void)addNItems: (size_t)nItems 00211 fromCArray: (const void*)cArray 00212 atIndex: (size_t)index; 00213 00219 - (void)removeItemAtIndex: (size_t)index; 00220 00226 - (void)removeNItems: (size_t)nItems; 00227 00234 - (void)removeNItems: (size_t)nItems 00235 atIndex: (size_t)index; 00236 00240 - (void)removeLastItem; 00241 00245 - (void)removeAllItems; 00246 00252 - (OFString*)stringByBase64Encoding; 00253 00259 - (void)writeToFile: (OFString*)path; 00260 @end 00261 00269 @interface OFBigDataArray: OFDataArray 00270 { 00271 size_t size; 00272 } 00273 @end 00274 00275 #import "OFDataArray+Hashing.h"