]> err.no Git - sope/blob - Recycler/Snippets/NGCString.h
Xcode build fixed for linking against libical.framework
[sope] / Recycler / Snippets / NGCString.h
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
6   OGo is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with OGo; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21 // $Id$
22
23 #ifndef __NGExtensions_NGCString_H__
24 #define __NGExtensions_NGCString_H__
25
26 #import <Foundation/NSObject.h>
27
28 @class NSString;
29
30 @interface NGCString : NSObject < NSCopying, NSMutableCopying, NSCoding >
31 {
32   char         *value;
33   unsigned int len;
34 }
35
36 + (id)stringWithCString:(const char *)_value length:(unsigned)_len;
37 + (id)stringWithCString:(const char *)_value;
38 - (id)initWithCString:(const char *)_value length:(unsigned)_len;
39 - (id)initWithCString:(const char *)_value;
40
41 // unicode
42
43 - (unsigned int)length;
44 - (unichar)characterAtIndex:(unsigned int)_idx;
45
46 // comparing
47
48 - (BOOL)isEqual:(id)_object;
49 - (BOOL)isEqualToCString:(NGCString *)_cstr;
50 - (BOOL)isEqualToString:(NSString *)_str;
51 - (unsigned)hash;
52
53 // copying
54
55 - (id)copyWithZone:(NSZone *)_zone;
56 - (id)mutableCopyWithZone:(NSZone *)_zone;
57
58 // archiving
59
60 - (void)encodeWithCoder:(NSCoder *)_coder;
61 - (id)initWithCoder:(NSCoder *)_decoder;
62
63 // getting C strings
64
65 - (const char *)cString;
66 - (unsigned int)cStringLength;
67 - (void)getCString:(char *)_buffer;
68 - (void)getCString:(char *)_buffer maxLength:(unsigned int)_maxLength;
69 - (char)charAtIndex:(unsigned int)_idx;
70
71 // getting numeric values
72
73 - (double)doubleValue;
74 - (float)floatValue;
75 - (int)intValue;
76 - (NSString *)stringValue;
77
78 // description
79
80 - (NSString *)description;
81
82 @end
83
84 @interface NGMutableCString : NGCString
85 {
86   unsigned int capacity;
87 }
88
89 // appending
90
91 - (void)appendString:(id)_str; // either NSString or NGCString
92 - (void)appendCString:(const char *)_cstr;
93 - (void)appendCString:(const char *)_cstr length:(unsigned)_len;
94
95 // removing
96
97 - (void)removeAllContents;
98
99 @end
100
101 #endif /* __NGExtensions_NGCString_H__ */