NSArray_Extensions.m
上传用户:center1979
上传日期:2022-07-26
资源大小:50633k
文件大小:3k
源码类别:

OpenGL

开发平台:

Visual C++

  1. /*
  2. NSArray_Extensions.m
  3. Copyright (c) 2001 by Apple Computer, Inc., all rights reserved.
  4. Author: Chuck Pisula
  5. Milestones:
  6. Initially created 3/1/01
  7.         NSArray and NSMutableArray categories (MyExtensions).
  8. */
  9. /*
  10.  IMPORTANT:  This Apple software is supplied to you by Apple Computer, Inc. ("Apple") in
  11.  consideration of your agreement to the following terms, and your use, installation, 
  12.  modification or redistribution of this Apple software constitutes acceptance of these 
  13.  terms.  If you do not agree with these terms, please do not use, install, modify or 
  14.  redistribute this Apple software.
  15.  
  16.  In consideration of your agreement to abide by the following terms, and subject to these 
  17.  terms, Apple grants you a personal, non-exclusive license, under Apple誷 copyrights in 
  18.  this original Apple software (the "Apple Software"), to use, reproduce, modify and 
  19.  redistribute the Apple Software, with or without modifications, in source and/or binary 
  20.  forms; provided that if you redistribute the Apple Software in its entirety and without 
  21.  modifications, you must retain this notice and the following text and disclaimers in all 
  22.  such redistributions of the Apple Software.  Neither the name, trademarks, service marks 
  23.  or logos of Apple Computer, Inc. may be used to endorse or promote products derived from 
  24.  the Apple Software without specific prior written permission from Apple. Except as expressly
  25.  stated in this notice, no other rights or licenses, express or implied, are granted by Apple
  26.  herein, including but not limited to any patent rights that may be infringed by your 
  27.  derivative works or by other works in which the Apple Software may be incorporated.
  28.  
  29.  The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO WARRANTIES, 
  30.  EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, 
  31.  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS 
  32.  USE AND OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
  33.  
  34.  IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL 
  35.  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
  36.  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, 
  37.  REPRODUCTION, MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND 
  38.  WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR 
  39.  OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  40. */
  41. #import "NSArray_Extensions.h"
  42. @implementation NSArray (MyExtensions)
  43. - (BOOL) containsObjectIdenticalTo: (id)obj { 
  44.     return [self indexOfObjectIdenticalTo: obj]!=NSNotFound; 
  45. }
  46. @end
  47. @implementation NSMutableArray (MyExtensions)
  48. - (void) insertObjectsFromArray:(NSArray *)array atIndex:(int)index {
  49.     NSObject *entry = nil;
  50.     NSEnumerator *enumerator = [array objectEnumerator];
  51.     while ((entry=[enumerator nextObject])) {
  52.         [self insertObject:entry atIndex:index++];
  53.     }
  54. }
  55. @end