1/* EOBitmaskQualifier.m - this file is part of SOGo 2 * 3 * Copyright (C) 2010-2014 Inverse inc 4 * 5 * This file is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3, or (at your option) 8 * any later version. 9 * 10 * This file is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; see the file COPYING. If not, write to 17 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 * Boston, MA 02111-1307, USA. 19 */ 20 21#import <Foundation/NSString.h> 22 23#import "EOBitmaskQualifier.h" 24 25@implementation EOBitmaskQualifier 26 27- (id) initWithKey: (NSString *) newKey 28 mask: (uint32_t) newMask 29 isZero: (BOOL) newIsZero 30{ 31 if ((self = [self init])) 32 { 33 ASSIGN (key, newKey); 34 isZero = newIsZero; 35 mask = newMask; 36 } 37 38 return self; 39} 40 41- (void) dealloc 42{ 43 [key release]; 44 [super dealloc]; 45} 46 47- (NSString *) key 48{ 49 return key; 50} 51 52- (uint32_t ) mask 53{ 54 return mask; 55} 56 57- (BOOL) isZero 58{ 59 return isZero; 60} 61 62- (NSString *) description 63{ 64 NSMutableString *desc; 65 66 desc = [NSMutableString stringWithCapacity: [key length] + 24]; 67 68 if (isZero) 69 [desc appendString: @"!"]; 70 [desc appendFormat: @"(%@ & 0x%.8x)", key, mask]; 71 72 return desc; 73} 74 75@end 76