Samond Classes Library 1.1.6-RELEASE build 132

SCStrings.h

Go to the documentation of this file.
00001 //
00002 //  SCStrings.h
00003 //  scl
00004 //
00005 //  Created by Viacheslav Smolensky on 05.02.13.
00006 //  Copyright (c) 2007 - 2014 by Samond Development Corporation. All rights reserved.
00007 //
00008 
00016 #import <scl/SCObject.h>
00017 #import <scl/SCArray.h>
00018 #import <scl/SCTextDelegate.h>
00019 
00020 #define SCStringsClass           @"SCStrings"         ///< SCStrings class name
00021 
00022 #pragma mark Strings list support constants
00023 
00025 #define SCTextUnlimited   0           ///< Unlimited text size
00026 
00053 @interface SCStrings : SCObject {
00054         SCArray *fStrings;                              // Array with strings
00055         id<SCTextDelegate> fDelegate;   // Delegate object
00056         BOOL fModified;                                 // Modification flag
00057         BOOL fCaseInsensitive;                  // Case insensitive flag
00058         BOOL fUnique;                   // Unique flag
00059         BOOL fStrongUnique;             // String unique flag
00060 }
00061 #pragma mark -
00062 #pragma mark Class properties
00063 #if (__MAC_OS_X_VERSION_MIN_REQUIRED > 1040) || IOS_TARGET
00064 // List name property
00065 @property (retain, getter=textName, setter=setTextName:) NSString *textName;
00066 // Items count property
00067 @property (assign, readonly, getter=count) SCULong count;
00068 // Read only property
00069 @property (assign, getter=isReadOnly, setter=setReadOnly:) BOOL isReadOnly;
00070 // List capacity property
00071 @property (assign, getter=capacity, setter=setCapacity:) SCULong capacity;
00072 // Unlimited list size property
00073 @property (assign, readonly, getter=isUnlimited) BOOL isUnlimited;
00074 // Free items count property
00075 @property (assign, readonly, getter=freeCount) SCLong freeCount;
00076 // Free items availability property
00077 @property (assign, readonly, getter=freeItemsAvailable) BOOL freeItemsAvailable;
00078 // Empty list flag property
00079 @property (assign, readonly, getter=isEmpty) BOOL isEmpty;
00080 // Description property
00081 @property (retain, readonly, getter=description) NSString *description;
00082 // List events delegate object
00083 @property (assign, getter=delegate, setter=setDelegate:) id<SCTextDelegate> delegate;
00084 // Modified flag property
00085 @property (assign, readonly, getter=isModified) BOOL isModified;
00086 // Case insensitive flag property
00087 @property (assign, getter=caseInsensitive, setter=setCaseInsensitive:) BOOL caseInsensitive;
00088 // Unique flag property
00089 @property (assign, getter=isUnique, setter=setUnique:) BOOL isUnique;
00090 // String unique flag property
00091 @property (assign, getter=isStrongUnique, setter=setStrongUnique:) BOOL isStrongUnique;
00092 #endif
00093 
00094 #pragma mark -
00095 #pragma mark Creating List
00096 
00102 + (SCStrings *)listWithDataDictionary:(NSDictionary *)dictionary;
00103 
00109 + (SCStrings *)listWithDataDictionaryFromFile:(NSString *)path;
00110 
00116 + (SCStrings *)listWithCoder:(NSCoder *)coder;
00117 
00123 + (SCStrings *)listWithContentsOfSerializedFile:(NSString *)path;
00124 
00132 + (SCStrings *)listWithStream:(SCStream *)stream;
00133 
00141 + (SCStrings *)listWithFileStream:(NSString *)path;
00142 
00150 + (SCStrings *)listWithName:(NSString *)name
00151                                    capacity:(SCULong)capacity
00152                                    delegate:(id<SCTextDelegate>)delegate;
00153 
00160 + (SCStrings *)listWithName:(NSString *)name capacity:(SCULong)capacity;
00161 
00168 + (SCStrings *)listWithName:(NSString *)name delegate:(id<SCTextDelegate>)delegate;
00169 
00175 + (SCStrings *)listWithName:(NSString *)name;
00176 
00182 + (SCStrings *)listWithDelegate:(id<SCTextDelegate>)delegate;
00183 
00189 + (SCStrings *)listWithCapacity:(SCULong)capacity;
00190 
00195 + (SCStrings *)list;
00196 
00203 + (SCStrings *)listWithString:(NSString *)string;
00204 
00212 + (SCStrings *)listWithStrings:(NSString *)string, ...;
00213 
00220 + (SCStrings *)listWithCollection:(id)collection;
00221 
00228 + (SCStrings *)listWithList:(SCStrings *)list;
00229 
00230 #pragma mark -
00231 #pragma mark Initializing List
00232 
00240 - (id)initWithName:(NSString *)name
00241                   capacity:(SCULong)capacity
00242                   delegate:(id<SCTextDelegate>)delegate;
00243 
00250 - (id)initWithName:(NSString *)name capacity:(SCULong)capacity;
00251 
00258 - (id)initWithName:(NSString *)name delegate:(id<SCTextDelegate>)delegate;
00259 
00265 - (id)initWithName:(NSString *)name;
00266 
00272 - (id)initWithDelegate:(id<SCTextDelegate>)delegate;
00273 
00279 - (id)initWithCapacity:(SCULong)capacity;
00280 
00285 - (id)init;
00286 
00293 - (id)initWithString:(NSString *)string;
00294 
00302 - (id)initWithStrings:(NSString *)string, ...;
00303 
00310 - (id)initWithCollection:(id)collection;
00311 
00318 - (id)initWithList:(SCStrings *)list;
00319 
00320 #pragma mark -
00321 #pragma mark Querying and Setting List Properties
00322 
00327 - (NSString *)textName;
00328 
00333 - (SCULong)count;
00334 
00339 - (BOOL)isReadOnly;
00340 
00345 - (SCULong)capacity;
00346 
00351 - (BOOL)isUnlimited;
00352 
00357 - (SCLong)freeCount;
00358 
00363 - (BOOL)freeItemsAvailable;
00364 
00369 - (BOOL)isEmpty;
00370 
00375 - (id<SCTextDelegate>)delegate;
00376 
00382 - (BOOL)isModified;
00383 
00388 - (BOOL)caseInsensitive;
00389 
00395 - (BOOL)isUnique;
00396 
00402 - (BOOL)isStrongUnique;
00403 
00408 - (void)setTextName:(NSString *)name;
00409 
00414 - (void)setReadOnly:(BOOL)flag;
00415 
00420 - (void)setCapacity:(SCULong)capacity;
00421 
00426 - (void)setDelegate:(id<SCTextDelegate>)delegate;
00427 
00432 - (void)setCaseInsensitive:(BOOL)value;
00433 
00438 - (void)setUnique:(BOOL)flag;
00439 
00444 - (void)setStrongUnique:(BOOL)flag;
00445 
00446 #pragma mark -
00447 #pragma mark Setting and Copying Lists
00448 
00455 - (void)copyFromCollection:(id)collection;
00456 
00463 - (void)copyFromList:(SCStrings *)list;
00464 
00470 - (void)copyFromString:(NSString *)string;
00471 
00478 - (void)copyFromStrings:(NSString *)string, ...;
00479 
00488 - (void)copySortedAscendingFromCollection:(id)collection usingMethod:(id<SCSortingProtocol>)method;
00489 
00498 - (void)copySortedAscendingFromList:(SCStrings *)list usingMethod:(id<SCSortingProtocol>)method;
00499 
00508 - (void)copySortedDescendingFromCollection:(id)collection usingMethod:(id<SCSortingProtocol>)method;
00509 
00518 - (void)copySortedDescendingFromList:(SCStrings *)list usingMethod:(id<SCSortingProtocol>)method;
00519 
00528 - (void)copySortedFromCollection:(id)collection usingMethod:(id<SCSortingProtocol>)method;
00529 
00538 - (void)copySortedFromList:(SCStrings *)list usingMethod:(id<SCSortingProtocol>)method;
00539 
00547 - (void)copySortedAscendingFromCollection:(id)collection;
00548 
00556 - (void)copySortedAscendingFromList:(SCStrings *)list;
00557 
00565 - (void)copySortedDescendingFromCollection:(id)collection;
00566 
00574 - (void)copySortedDescendingFromList:(SCStrings *)list;
00575 
00583 - (void)copySortedFromCollection:(id)collection;
00584 
00592 - (void)copySortedFromList:(SCStrings *)list;
00593 
00594 #pragma mark -
00595 #pragma mark Comparing Lists
00596 
00608 - (BOOL)isEqualToCollection:(id)collection caseInsensitive:(BOOL)value;
00609 
00619 - (BOOL)isEqualToCollection:(id)collection;
00620 
00632 - (BOOL)isEqualToList:(SCStrings *)list caseInsensitive:(BOOL)value;
00633 
00643 - (BOOL)isEqualToList:(SCStrings *)list;
00644 
00656 - (BOOL)isEqualToContentsOfCollection:(id)collection caseInsensitive:(BOOL)value;
00657 
00667 - (BOOL)isEqualToContentsOfCollection:(id)collection;
00668 
00680 - (BOOL)isEqualToContentsOfList:(SCStrings *)list caseInsensitive:(BOOL)value;
00681 
00691 - (BOOL)isEqualToContentsOfList:(SCStrings *)list;
00692 
00698 - (BOOL)isEqual:(id)object;
00699 
00700 #pragma mark -
00701 #pragma mark Enumerating Lists
00702 
00707 - (NSEnumerator *)stringEnumerator;
00708 
00714 - (NSEnumerator *)reverseStringEnumerator;
00715 
00720 - (void)enumerateWithDelegate:(id<SCTextDelegate>)delegate;
00721 
00725 - (void)enumerate;
00726 
00732 - (void)reverseEnumerateWithDelegate:(id<SCTextDelegate>)delegate;
00733 
00738 - (void)reverseEnumerate;
00739 
00740 #pragma mark -
00741 #pragma mark Describing List
00742 
00747 - (NSString *)description;
00748 
00749 #pragma mark -
00750 #pragma mark Converting List
00751 
00756 - (SCArray *)array;
00757 
00762 - (SCSet *)set;
00763 
00768 - (SCStack *)stack;
00769 
00774 - (SCQueue *)queue;
00775 
00780 - (SCDictionary *)dictionary;
00781 
00786 - (SCUnidirectionalList *)unidirectionalList;
00787 
00792 - (SCBidirectionalList *)bidirectionalList;
00793 
00798 - (NSArray *)foundationArray;
00799 
00804 - (NSSet *)foundationSet;
00805 
00810 - (NSDictionary *)foundationDictionary;
00811 
00812 #pragma mark -
00813 #pragma mark Sorting List
00814 
00820 - (void)sortingListAscendingWithMethod:(id<SCSortingProtocol>)method;
00821 
00827 - (void)sortingListDescendingWithMethod:(id<SCSortingProtocol>)method;
00828 
00834 - (void)sortingListWithMethod:(id<SCSortingProtocol>)method;
00835 
00840 - (void)sortingListAscending;
00841 
00846 - (void)sortingListDescending;
00847 
00852 - (void)sortingList;
00853 
00861 - (SCStrings *)sortedListAscendingWithMethod:(id<SCSortingProtocol>)method;
00862 
00870 - (SCStrings *)sortedListDescendingWithMethod:(id<SCSortingProtocol>)method;
00871 
00879 - (SCStrings *)sortedListWithMethod:(id<SCSortingProtocol>)method;
00880 
00887 - (SCStrings *)sortedListAscending;
00888 
00895 - (SCStrings *)sortedListDescending;
00896 
00903 - (SCStrings *)sortedList;
00904 
00905 #pragma mark -
00906 #pragma mark Adding Strings
00907 
00913 - (void)addString:(NSString *)string;
00914 
00921 - (void)addStrings:(NSString *)string, ...;
00922 
00928 - (void)addStringsFromCollection:(id)collection;
00929 
00935 - (void)addStringsFromList:(SCStrings *)list;
00936 
00941 - (void)addLine;
00942 
00949 - (void)insertString:(NSString *)string atIndex:(SCIndex)index;
00950 
00959 - (void)insertAtIndex:(SCIndex)index strings:(NSString *)string, ...;
00960 
00967 - (void)insertStringsFromCollection:(id)collection atIndex:(SCIndex)index;
00968 
00975 - (void)insertStringsFromList:(SCStrings *)list atIndex:(SCIndex)index;
00976 
00985 - (void)insertAtIndexes:(NSIndexSet *)indexes strings:(NSString *)string, ...;
00986 
00994 - (void)insertStringsFromCollection:(id)collection atIndexes:(NSIndexSet *)indexes;
00995 
01003 - (void)insertStringsFromList:(SCStrings *)list atIndexes:(NSIndexSet *)indexes;
01004 
01010 - (void)insertLineAtIndex:(SCIndex)index;
01011 
01012 #pragma mark -
01013 #pragma mark Removing Strings
01014 
01019 - (void)removeAllStrings;
01020 
01025 - (void)removeFirstString;
01026 
01031 - (void)removeLastString;
01032 
01038 - (void)removeStringAtIndex:(SCIndex)index;
01039 
01045 - (void)removeStringsAtIndexes:(NSIndexSet *)indexes;
01046 
01055 - (void)removeStringsEqualTo:(NSString *)string caseInsensitive:(BOOL)value;
01056 
01063 - (void)removeStringsEqualTo:(NSString *)string;
01064 
01074 - (void)removeStringsInCollection:(id)collection caseInsensitive:(BOOL)value;
01075 
01083 - (void)removeStringsInCollection:(id)collection;
01084 
01094 - (void)removeStringsInList:(SCStrings *)list caseInsensitive:(BOOL)value;
01095 
01102 - (void)removeStringsInList:(SCStrings *)list;
01103 
01112 - (void)removeString:(NSString *)string caseInsensitive:(BOOL)value;
01113 
01120 - (void)removeString:(NSString *)string;
01121 
01131 - (void)removeWithCaseInsensitive:(BOOL)value strings:(NSString *)string, ...;
01132 
01140 - (void)removeStrings:(NSString *)string, ...;
01141 
01150 - (void)removeStringsWithSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01151 
01158 - (void)removeStringsWithSubstring:(NSString *)substring;
01159 
01165 - (void)removeStringsNotAtIndexes:(NSIndexSet *)indexes;
01166 
01175 - (void)removeStringsNotEqualTo:(NSString *)string caseInsensitive:(BOOL)value;
01176 
01183 - (void)removeStringsNotEqualTo:(NSString *)string;
01184 
01193 - (void)removeStringsNotInCollection:(id)collection caseInsensitive:(BOOL)value;
01194 
01201 - (void)removeStringsNotInCollection:(id)collection;
01202 
01211 - (void)removeStringsNotInList:(SCStrings *)list caseInsensitive:(BOOL)value;
01212 
01220 - (void)removeStringsNotInList:(SCStrings *)list;
01221 
01230 - (void)removeStringsWithoutSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01231 
01239 - (void)removeStringsWithoutSubstring:(NSString *)substring;
01240 
01245 - (void)removeDuplicatedStrings;
01246 
01247 #pragma mark -
01248 #pragma mark Replacing Strings
01249 
01256 - (void)replaceStringAtIndex:(SCIndex)index withString:(NSString *)string;
01257 
01266 - (void)replaceStringsAtIndexes:(NSIndexSet *)indexes withStrings:(NSString *)string, ...;
01267 
01275 - (void)replaceStringsAtIndexes:(NSIndexSet *)indexes withStringsFromCollection:(id)collection;
01276 
01284 - (void)replaceStringsAtIndexes:(NSIndexSet *)indexes withStringsFromList:(SCStrings *)list;
01285 
01286 #pragma mark -
01287 #pragma mark Moving and Copying Strings
01288 
01295 - (void)exchangeStringAtIndex:(SCIndex)index withStringAtIndex:(SCIndex)destination;
01296 
01302 - (void)duplicateStringAtIndex:(SCIndex)index;
01303 
01308 - (void)duplicateAllStrings;
01309 
01314 - (void)duplicate;
01315 
01322 - (void)copyStringAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
01323 
01330 - (void)moveStringAtIndex:(SCIndex)index toIndex:(SCIndex)destination;
01331 
01338 - (void)forwardMoveStringAtIndex:(SCIndex)index steps:(SCULong)steps;
01339 
01345 - (void)forwardMoveStringAtIndex:(SCIndex)index;
01346 
01353 - (void)backwardMoveStringAtIndex:(SCIndex)index steps:(SCULong)steps;
01354 
01360 - (void)backwardMoveStringAtIndex:(SCIndex)index;
01361 
01367 - (void)moveToFirstPositionStringAtIndex:(SCIndex)index;
01368 
01374 - (void)moveToLastPositionStringAtIndex:(SCIndex)index;
01375 
01380 - (void)reverse;
01381 
01386 - (SCStrings *)reversedList;
01387 
01388 #pragma mark -
01389 #pragma mark Querying List
01390 
01396 - (NSString *)firstString;
01397 
01403 - (NSString *)lastString;
01404 
01411 - (NSString *)stringAtIndex:(SCIndex)index;
01412 
01420 - (SCStrings *)stringsAtIndexes:(NSIndexSet *)indexes;
01421 
01422 #pragma mark -
01423 #pragma mark Finding and Selecting Strings
01424 
01433 - (BOOL)containsString:(NSString *)string caseInsensitive:(BOOL)value;
01434 
01442 - (BOOL)containsString:(NSString *)string;
01443 
01454 - (BOOL)containsWithCaseInsensitive:(BOOL)value strings:(NSString *)string, ...;
01455 
01464 - (BOOL)containsStrings:(NSString *)string, ...;
01465 
01475 - (BOOL)containsStringsFromCollection:(id)collection caseInsensitive:(BOOL)value;
01476 
01485 - (BOOL)containsStringsFromCollection:(id)collection;
01486 
01495 - (BOOL)containsStringsFromList:(SCStrings *)list caseInsensitive:(BOOL)value;
01496 
01504 - (BOOL)containsStringsFromList:(SCStrings *)list;
01505 
01516 - (BOOL)containsWithCaseInsensitive:(BOOL)value anyString:(NSString *)string, ...;
01517 
01526 - (BOOL)containsAnyString:(NSString *)string, ...;
01527 
01538 - (BOOL)containsAnyStringFromCollection:(id)collection caseInsensitive:(BOOL)value;
01539 
01548 - (BOOL)containsAnyStringFromCollection:(id)collection;
01549 
01560 - (BOOL)containsAnyStringFromList:(SCStrings *)list caseInsensitive:(BOOL)value;
01561 
01570 - (BOOL)containsAnyStringFromList:(SCStrings *)list;
01571 
01580 - (BOOL)containsSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01581 
01589 - (BOOL)containsSubstring:(NSString *)substring;
01590 
01601 - (BOOL)containsWithCaseInsensitive:(BOOL)value substrings:(NSString *)substring, ...;
01602 
01611 - (BOOL)containsSubstrings:(NSString *)substring, ...;
01612 
01623 - (BOOL)containsSubstringsFromCollection:(id)collection caseInsensitive:(BOOL)value;
01624 
01633 - (BOOL)containsSubstringsFromCollection:(id)collection;
01634 
01645 - (BOOL)containsSubstringsFromList:(SCStrings *)list caseInsensitive:(BOOL)value;
01646 
01655 - (BOOL)containsSubstringsFromList:(SCStrings *)list;
01656 
01667 - (BOOL)containsWithCaseInsensitive:(BOOL)value anySubstring:(NSString *)substring, ...;
01668 
01677 - (BOOL)containsAnySubstring:(NSString *)substring, ...;
01678 
01690 - (BOOL)containsAnySubstringFromCollection:(id)collection caseInsensitive:(BOOL)value;
01691 
01701 - (BOOL)containsAnySubstringFromCollection:(id)collection;
01702 
01714 - (BOOL)containsAnySubstringFromList:(SCStrings *)list caseInsensitive:(BOOL)value;
01715 
01725 - (BOOL)containsAnySubstringFromList:(SCStrings *)list;
01726 
01732 - (BOOL)containsDuplicatedStrings;
01733 
01743 - (SCIndex)indexOfString:(NSString *)string caseInsensitive:(BOOL)value;
01744 
01752 - (SCIndex)indexOfString:(NSString *)string;
01753 
01764 - (SCIndex)indexOfString:(NSString *)string fromIndex:(SCIndex)index caseInsensitive:(BOOL)value;
01765 
01775 - (SCIndex)indexOfString:(NSString *)string fromIndex:(SCIndex)index;
01776 
01781 - (SCIndex)indexOfLastString;
01782 
01792 - (SCIndex)indexOfSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01793 
01801 - (SCIndex)indexOfSubstring:(NSString *)substring;
01802 
01811 - (SCStrings *)stringsWithSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01812 
01819 - (SCStrings *)stringsWithSubstring:(NSString *)substring;
01820 
01829 - (SCStrings *)stringsWithoutSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01830 
01837 - (SCStrings *)stringsWithoutSubstring:(NSString *)substring;
01838 
01847 - (SCULong)countOfString:(NSString *)string caseInsensitive:(BOOL)value;
01848 
01855 - (SCULong)countOfString:(NSString *)string;
01856 
01865 - (SCULong)countOfSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01866 
01873 - (SCULong)countOfSubstring:(NSString *)substring;
01874 
01883 - (SCULong)countOfStringsWithSubstring:(NSString *)substring caseInsensitive:(BOOL)value;
01884 
01892 - (SCULong)countOfStringsWithSubstring:(NSString *)substring;
01893 
01894 @end
 All Classes Files Functions Typedefs Enumerations Enumerator Defines