diff --git a/ClassesDiagram.graffle b/ClassesDiagram.graffle new file mode 100644 index 0000000..2eb5590 Binary files /dev/null and b/ClassesDiagram.graffle differ diff --git a/MUKit/MUCore/MUCore.h b/MUKit/MUCore/MUCore.h index 65ef06e..21b38de 100644 --- a/MUKit/MUCore/MUCore.h +++ b/MUKit/MUCore/MUCore.h @@ -9,6 +9,7 @@ #ifndef MUKitTest_MUCore_h #define MUKitTest_MUCore_h +// Base #import "MUKitDefines.h" #import "MUHelper.h" #import "MUWeakRef.h" @@ -17,9 +18,11 @@ #import "MUPair.h" #import "MUHelper.h" #import "MUFetchable.h" + // Validators #import "MUValidator.h" #import "MUValidationGroup.h" + // Formatters #import "MUCreditCardNumberFormatter.h" #import "MUPhoneNumberFormatter.h" diff --git a/MUKit/MUCore/MUInputTextFilter.h b/MUKit/MUCore/MUInputTextFilter.h index 8cfeece..ab3ae3e 100644 --- a/MUKit/MUCore/MUInputTextFilter.h +++ b/MUKit/MUCore/MUInputTextFilter.h @@ -8,64 +8,114 @@ #import -//============================================================================== -//============================================================================== -//============================================================================== -/// text filter : base class +/** + `MUInputFilter` is an `NSObject` that used for filtering input info in text fields and text views. + + @warning It's base class and should be subclassed for implenting some specified filters + + */ @interface MUInputFilter : NSObject +///------------------------------- +/// @name Main filter Methods +///------------------------------- + +/** + Should return `YES` if replacementString correspons to filter allowed input. + */ - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only number +/** + `MUInputFilterNumbreValue` is an `MUInputFilter` that allows to input only numbers. + + */ @interface MUInputFilterNumbreValue : MUInputFilter +///------------------------------- +/// @name Main filter Methods +///------------------------------- + @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only numbers, numbers value has max +/** + `MUInputFilterNumbreValueWithMaxLengthText` is an `MUInputFilterNumbreValue` that allows to input only numbers and input string should be less than specified maximum length. + + */ @interface MUInputFilterNumbreValueWithMaxLengthText : MUInputFilterNumbreValue @property (nonatomic, assign) NSUInteger maxLengthText; +///------------------------------- +/// @name Initialization Input Filter Methods +///------------------------------- + +/** + Creates and initializes an `MUInputFilterNumbreValueWithMaxLengthText` object with the specified maximum text's length. + + @param maximum length of allowed input text + + @return The newly-initialized Input Filter + */ - (id)initWithMaxLengthText:(NSUInteger) aMaxLengthText; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only letters +/** + `MUInputFilterLetterValue` is an `MUInputFilter` that allows to input only letters. + + */ @interface MUInputFilterLetterValue : MUInputFilter +///------------------------------- +/// @name Main filter Methods +///------------------------------- + @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only letters, text has limited the length +/** + `MUInputFilterLetterValueWithMaxLengthText` is an `MUInputFilterLetterValue` that allows to input only letters and input string should be less than specified maximum length. + + */ @interface MUInputFilterLetterValueWithMaxLengthText : MUInputFilterLetterValue @property (nonatomic, assign) NSUInteger maxLengthText; +///------------------------------- +/// @name Initialization Input Filter Methods +///------------------------------- + +/** + Creates and initializes an `MUInputFilterLetterValueWithMaxLengthText` object with the specified maximum text's length. + + @param maximum length of allowed input text + + @return The newly-initialized Input Filter + */ - (id)initWithMaxLengthText:(NSUInteger) aMaxLengthText; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text has limited the length +/** + `MUInputFilterStringWithMaxLengthText` is an `MUInputFilter` that allows to input any characters and input string should be less than specified maximum length. + + */ @interface MUInputFilterStringWithMaxLengthText : MUInputFilter @property (nonatomic, assign) NSUInteger maxLengthText; +///------------------------------- +/// @name Initialization Input Filter Methods +///------------------------------- + +/** + Creates and initializes an `MUInputFilterStringWithMaxLengthText` object with the specified maximum text's length. + + @param maximum length of allowed input text + + @return The newly-initialized Input Filter + */ - (id)initWithMaxLengthText:(NSUInteger) aMaxLengthText; @end diff --git a/MUKit/MUCore/MUInputTextFilter.m b/MUKit/MUCore/MUInputTextFilter.m index c5be1b9..a5ee774 100644 --- a/MUKit/MUCore/MUInputTextFilter.m +++ b/MUKit/MUCore/MUInputTextFilter.m @@ -8,10 +8,8 @@ #import "MUInputTextFilter.h" -//============================================================================== -//============================================================================== -//============================================================================== -/// text filter : base class +#pragma mark - MUInputFilter + @implementation MUInputFilter - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string @@ -21,10 +19,8 @@ - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)ra @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only number +#pragma mark - MUInputFilterNumbreValue + @implementation MUInputFilterNumbreValue //============================================================================== @@ -53,16 +49,12 @@ - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)ra @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only numbers, numbers value has max and min +#pragma mark - MUInputFilterNumbreValueWithMaxLengthText + @implementation MUInputFilterNumbreValueWithMaxLengthText -//============================================================================== @synthesize maxLengthText; -//============================================================================== - (id) initWithMaxLengthText:(NSUInteger)aMaxLengthText { self = [super init]; @@ -73,7 +65,6 @@ - (id) initWithMaxLengthText:(NSUInteger)aMaxLengthText return self; } -//============================================================================== - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { BOOL result = NO; @@ -99,13 +90,10 @@ - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)ra @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only letters +#pragma mark - MUInputFilterLetterValue + @implementation MUInputFilterLetterValue -//============================================================================== - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { BOOL result = NO; @@ -132,16 +120,12 @@ - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)ra @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text with only letters, text has limited the length +#pragma mark - MUInputFilterLetterValueWithMaxLengthText + @implementation MUInputFilterLetterValueWithMaxLengthText -//============================================================================== @synthesize maxLengthText; -//============================================================================== - (id) initWithMaxLengthText:(NSUInteger)aMaxLengthText { self = [super init]; @@ -152,7 +136,6 @@ - (id) initWithMaxLengthText:(NSUInteger)aMaxLengthText return self; } -//============================================================================== - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { BOOL result = NO; @@ -178,16 +161,12 @@ - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)ra @end -//============================================================================== -//============================================================================== -//============================================================================== -/// text has limited the length +#pragma mark - MUInputFilterStringWithMaxLengthText + @implementation MUInputFilterStringWithMaxLengthText -//============================================================================== @synthesize maxLengthText; -//============================================================================== - (id) initWithMaxLengthText:(NSUInteger)aMaxLengthText { self = [super init]; @@ -198,7 +177,6 @@ - (id) initWithMaxLengthText:(NSUInteger)aMaxLengthText return self; } -//============================================================================== - (BOOL) filterText:(id)inputTextField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { BOOL result = NO; diff --git a/MUKit/MUCore/MUValidator.h b/MUKit/MUCore/MUValidator.h index 9718bd5..02be10b 100644 --- a/MUKit/MUCore/MUValidator.h +++ b/MUKit/MUCore/MUValidator.h @@ -12,10 +12,18 @@ NSString* getOnlyNumbers(NSString *phoneNumber); @class MUValidator; -//============================================================================== -//============================================================================== -//============================================================================== -/// +/** + `MUValidationProtocol` is an interface made for `MUValidator`. + + ## Interface Methods + + - `setValidator:` + - `validator` + - `validate` + + @warning Object that supports this protocol should also have property `validatableText` + + */ @protocol MUValidationProtocol @property (nonatomic, assign) NSString* validatableText; @@ -25,176 +33,237 @@ NSString* getOnlyNumbers(NSString *phoneNumber); @end -//============================================================================== -//============================================================================== -//============================================================================== -/// TextField validator + +/** + `MUValidator` is an `NSObject` subclass that used for validate text in Text Field and Text View. + + ## Subclassing Notes + + The main method of this calss is -`validate` so for subclassing this class this method should be overriden to change validation behavior. + + */ @interface MUValidator : NSObject { id validatableObject; NSString *errorMessage; } +/** + Object that supports `MUValidationProtocol`. It will be used for validation. + */ @property (nonatomic, assign) id validatableObject; +/** + Specified text that should be shown in Alert View if validation process fails. + */ @property (nonatomic, retain) NSString *errorMessage; +/** + Validate `validatableObject` if it was set. + + @return YES if validatableObject passed validation process. + */ - (BOOL) validate; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// Alwayse return YES +/** + `MUValidatorAny` is an `MUValidator` subclass that returns YES for any validationableObject. + + */ @interface MUValidatorAny : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// return YES if textField has only numbers +/** + `MUValidatorNumber` is an `MUValidator` subclass that validate Text Field for allowed only numbers + + */ @interface MUValidatorNumber : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// only english letters +/** + `MUValidatorLetters` is an `MUValidator` subclass that validate Text Field for allowed only English letters + + */ @interface MUValidatorLetters : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// only english words +/** + `MUValidatorWords` is an `MUValidator` subclass that validate Text Field for allowed only English words + + */ @interface MUValidatorWords : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// only email +/** + `MUValidatorEmail` is an `MUValidator` subclass that validate Text Field for allowed only email format strings + + */ @interface MUValidatorEmail : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// return YES if current value equal with value of aTestedField +/** + `MUValidatorEmail` is an `MUValidator` subclass that validate Text Field for allowed only if validatableObject value equels value of aTestedField + + */ @interface MUValidatorEqual : MUValidator { MUValidator *testedValidator; } +///--------------------------------------- +/// @name Main methods +///--------------------------------------- + +/** + Creates and initializes an `MUValidatorIntWithRange` object with the specified Tested Text Field. + + @param Tested Text Field that support `MUValidationProtocol` + + @return The newly-initialized validator object with aTestedField + */ - (id) initWithTestedField:(id)aTestedObject; + +/** + Creates and initializes an `MUValidatorIntWithRange` object with the specified Tested Validator. + + @param Tested Validator object of class `MUValidator` + + @return The newly-initialized validator object with Tested Validator + */ - (id) initWithTestedFieldValidator:(MUValidator *)aTestedValidator; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// +/** + `MUValidatorNotEmpty` is an `MUValidator` subclass that validate Text Field for emtpiness not allowed + + */ @interface MUValidatorNotEmpty : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// +/** + `MUValidatorUSAZipCode` is an `MUValidator` subclass that validate Text Field for allowed only USA Zip format strings + + */ @interface MUValidatorUSAZipCode : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// full name consist of first name ' ' lastName +/** + `MUValidatorFullName` is an `MUValidator` subclass that validate Text Field for allowed only _full name_ format strings + + @warning full name consist of first name ' ' lastName + */ @interface MUValidatorFullName : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// +/** + `MUValidatorURL` is an `MUValidator` subclass that validate Text Field for allowed only URL format strings + + */ @interface MUValidatorURL : MUValidator { } @end -//============================================================================== -//============================================================================== -//============================================================================== -/// +/** + `MUValidatorIntWithRange` is an `MUValidator` subclass that validate Text Field for allowed only numbers with specified range. + + */ @interface MUValidatorIntWithRange : MUValidator { NSRange range; } +///--------------------------------------- +/// @name Main methods +///--------------------------------------- + +/** + Creates and initializes an `MUValidatorIntWithRange` object with the specified range. + + @param object of `NSRange` class + + @return The newly-initialized validator object with range + */ - (id) initWithRange:(NSRange)aRange; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// +/** + `MUValidatorStringWithRange` is an `MUValidator` subclass that validate Text Field for allowed strings with specified range. + + */ @interface MUValidatorStringWithRange : MUValidator { NSRange range; } +///--------------------------------------- +/// @name Main methods +///--------------------------------------- + +/** + Creates and initializes an `MUValidatorIntWithRange` object with the specified range. + + @param object of `NSRange` class + + @return The newly-initialized validator object with range + */ - (id) initWithRange:(NSRange)aRange; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// Exemple: validation count number in phone number (050)-50-50-500 +/** + `MUValidatorCountNumberInTextWithRange` is an `MUValidator` subclass that validate Text Field for allowed only phone format strings. + + @warning Exemple: validation count number in phone number (050)-50-50-500 + */ @interface MUValidatorCountNumberInTextWithRange : MUValidator { NSRange range; } +///--------------------------------------- +/// @name Main methods +///--------------------------------------- + +/** + Creates and initializes an `MUValidatorIntWithRange` object with the specified range. + + @param object of `NSRange` class + + @return The newly-initialized validator object with range + */ - (id) initWithRange:(NSRange)aRange; @end -//============================================================================== -//============================================================================== -//============================================================================== -/// +/** + `MUValidatorMoney` is an `MUValidator` subclass that validate Text Field for allowed only money format strings. + + */ @interface MUValidatorMoney : MUValidator { } @end - -////============================================================================== -////============================================================================== -////============================================================================== -///// -//@interface MUValidator : MUValidator -//{ -//} -//@end diff --git a/MUKit/MUCore/MUWeakRef.h b/MUKit/MUCore/MUWeakRef.h index 78dea59..ac6db72 100644 --- a/MUKit/MUCore/MUWeakRef.h +++ b/MUKit/MUCore/MUWeakRef.h @@ -12,9 +12,9 @@ @class MUWeakRef; -//============================================================================== -//============================================================================== -//============================================================================== +/** + `MUWeakRefProtocol` interface made for using in `MUWeakRef` class. + */ @protocol MUWeakRefProtocol - (MUWeakRef*) weakReference; @@ -22,9 +22,21 @@ @end -//============================================================================== -//============================================================================== -//============================================================================== +/** + `MUWeakRef` made for awoding circular references. + + ## Base Description + + Using assign to create weak references can be unsafe in a multithreaded system, particularly when either object can be retained by a third object, and then used to dereference the other object. + + Fortunately, this is often a problem of hierarchy, and the object containing the weak reference only cares about the object it refers to for the referred-to object's lifetime. This is the usual situation with a Superior<->Subordinate relationship. + + ## Some advantages + + It's thread safe. There is no way you can have the weak reference contained in Subordinate become an invalid pointer. It may become nil but that is OK. + Only the objects themselves need to know about the embedded weak reference. All other objects can treat Subordinate as if it has a regular reference to Superior. + + */ @interface MUWeakRef : NSObject { @private @@ -33,11 +45,23 @@ @property (readonly) NSObject* object; +///--------------------------------------- +/// @name Main methods +///--------------------------------------- + +/** + Creates and initializes an `MUWeakRef` object with the specified weak reference. + + @param object that corresponds to `MUWeakRefProtocol` + + @return The newly-initialized object with weak reference + */ - (id) initWithObject:(NSObject*) aObject; + +/** + Clear weak referenced object + */ - (void) invalidate; @end -//============================================================================== -//============================================================================== -//============================================================================== diff --git a/MUKit/MUCore/MUWeakRef.m b/MUKit/MUCore/MUWeakRef.m index c16289d..883659b 100644 --- a/MUKit/MUCore/MUWeakRef.m +++ b/MUKit/MUCore/MUWeakRef.m @@ -9,14 +9,10 @@ #import "MUWeakRef.h" -//============================================================================== -//============================================================================== -//============================================================================== @implementation MUWeakRef @dynamic object; -//============================================================================== - (id) initWithObject:(NSObject*) aObject { if( (self = [super init]) ) @@ -27,7 +23,6 @@ - (id) initWithObject:(NSObject*) aObject return self; } -//============================================================================== - (void) invalidate { @synchronized(self) @@ -36,7 +31,6 @@ - (void) invalidate } } -//============================================================================== - (NSObject*) object { @synchronized(self) @@ -45,7 +39,4 @@ - (void) invalidate } } -//============================================================================== -//============================================================================== -//============================================================================== @end diff --git a/MUKit/MULogger/MULogger.h b/MUKit/MULogger/MULogger.h index cc033d7..8382192 100644 --- a/MUKit/MULogger/MULogger.h +++ b/MUKit/MULogger/MULogger.h @@ -16,11 +16,40 @@ // formatters #import "MULogFormatterPlainText.h" -//============================================================================== + + +/** + `MULogger` is a set of functions that could be invoced for logging info to different consumers (like files etc). + + */ + +///------------------------------- +/// @name Logger's functions +///------------------------------- + +/** + Logging text with _info_ type. + */ void MULogInfo(NSString* format, ...); + +/** + Logging text with _debug_ type. + */ void MULogDebug(NSString* format, ...); + +/** + Logging text with _warning_ type. + */ void MULogWarning(NSString* format, ...); + +/** + Logging text with _error_ type. + */ void MULogError(NSString* format, ...); + +/** + Logging text with _fatal error_ type. + */ void MULogFatal(NSString* format, ...); #endif diff --git a/help/docset-installed.txt b/help/docset-installed.txt new file mode 100644 index 0000000..7459f9a --- /dev/null +++ b/help/docset-installed.txt @@ -0,0 +1,4 @@ +Documentation set was installed to Xcode! + +Path: /Users/zhenya/Library/Developer/Shared/Documentation/DocSets/com.111min.MUKitTest.docset +Time: 2012-05-21 14:23:11 +0000 \ No newline at end of file