~ubuntu-branches/ubuntu/edgy/sope/edgy

« back to all changes in this revision

Viewing changes to sope-core/NGExtensions/NGExtensions/NGBitSet.h

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Ley
  • Date: 2005-08-19 16:53:31 UTC
  • Revision ID: james.westby@ubuntu.com-20050819165331-hs683wz1osm708pw
Tags: upstream-4.4rc.2
ImportĀ upstreamĀ versionĀ 4.4rc.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  Copyright (C) 2000-2005 SKYRIX Software AG
 
3
 
 
4
  This file is part of SOPE.
 
5
 
 
6
  SOPE 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
  SOPE 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 SOPE; 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
 
 
22
#ifndef __NGExtensions_NGBitSet_H__
 
23
#define __NGExtensions_NGBitSet_H__
 
24
 
 
25
#import <Foundation/NSObject.h>
 
26
#import <Foundation/NSRange.h>
 
27
 
 
28
@class NSArray, NSEnumerator;
 
29
 
 
30
typedef unsigned int NGBitSetStorage;
 
31
 
 
32
@protocol NGBitSet < NSObject >
 
33
 
 
34
// state
 
35
 
 
36
- (unsigned int)count;
 
37
 
 
38
// membership
 
39
 
 
40
- (BOOL)isMember:(unsigned int)_element;
 
41
- (void)addMember:(unsigned int)_element;
 
42
- (void)addMembersInRange:(NSRange)_range;
 
43
- (void)removeMember:(unsigned int)_element;
 
44
- (void)removeMembersInRange:(NSRange)_range;
 
45
- (void)removeAllMembers;
 
46
 
 
47
@end
 
48
 
 
49
@interface NGBitSet : NSObject < NGBitSet, NSCopying, NSCoding >
 
50
{
 
51
@protected
 
52
  unsigned int    universe;
 
53
  unsigned int    count;
 
54
  NGBitSetStorage *storage;
 
55
}
 
56
 
 
57
+ (id)bitSet;
 
58
+ (id)bitSetWithCapacity:(unsigned)_capacity;
 
59
+ (id)bitSetWithBitSet:(NGBitSet *)_set;
 
60
- (id)init;
 
61
- (id)initWithCapacity:(unsigned)_capacity; // designated initializer
 
62
- (id)initWithBitSet:(NGBitSet *)_set;
 
63
- (id)initWithNullTerminatedArray:(unsigned int *)_array;
 
64
 
 
65
// state
 
66
 
 
67
- (unsigned int)capacity;
 
68
 
 
69
// membership
 
70
 
 
71
- (unsigned int)firstMember;
 
72
- (unsigned int)lastMember;
 
73
- (void)addMembersFromBitSet:(NGBitSet *)_set;
 
74
 
 
75
// equality
 
76
 
 
77
- (BOOL)isEqual:(id)_object;
 
78
- (BOOL)isEqualToSet:(NGBitSet *)_set;
 
79
 
 
80
// enumerator
 
81
 
 
82
- (NSEnumerator *)objectEnumerator;
 
83
 
 
84
// NSCopying
 
85
 
 
86
- (id)copy;
 
87
- (id)copyWithZone:(NSZone *)_zone;
 
88
 
 
89
// NSCoding
 
90
 
 
91
- (void)encodeWithCoder:(NSCoder *)_coder;
 
92
- (id)initWithCoder:(NSCoder *)_coder;
 
93
 
 
94
// description
 
95
 
 
96
- (NSString *)description;
 
97
- (NSArray *)toArray;
 
98
 
 
99
@end
 
100
 
 
101
NSString *stringValueForBitset(unsigned int _set, char _setC, char _unsetC,
 
102
                               short _wide);
 
103
 
 
104
#endif /* __NGExtensions_NGBitSet_H__ */