Revision: 18390
http://bibdesk.svn.sourceforge.net/bibdesk/?rev=18390&view=rev
Author: hofman
Date: 2012-01-10 12:45:46 +0000 (Tue, 10 Jan 2012)
Log Message:
-----------
set most properties in custom initializer and remove setters
Modified Paths:
--------------
trunk/bibdesk/BDSKErrorObject.h
trunk/bibdesk/BDSKErrorObject.m
Modified: trunk/bibdesk/BDSKErrorObject.h
===================================================================
--- trunk/bibdesk/BDSKErrorObject.h 2012-01-10 12:44:39 UTC (rev 18389)
+++ trunk/bibdesk/BDSKErrorObject.h 2012-01-10 12:45:46 UTC (rev 18390)
@@ -55,25 +55,22 @@
+ (void)reportError:(NSString *)className message:(NSString *)msg
forFile:(NSString *)filePath line:(NSInteger)line isWarning:(BOOL)flag;
+ (void)reportErrorMessage:(NSString *)msg forFile:(NSString *)filePath
line:(NSInteger)line;
+- (id)initWithClassName:(NSString *)className message:(NSString *)msg
forFile:(NSString *)filePath line:(NSInteger)line isWarning:(BOOL)flag;
+
- (NSString *)fileName;
-- (void)setFileName:(NSString *)newFileName;
-- (BDSKErrorEditor *)editor;
-- (void)setEditor:(BDSKErrorEditor *)newEditor;
-
-- (BibItem *)publication;
-- (void)setPublication:(BibItem *)newPublication;
-
- (NSInteger)lineNumber;
-- (void)setLineNumber:(NSInteger)newLineNumber;
- (NSString *)errorClassName;
-- (void)setErrorClassName:(NSString *)newErrorClassName;
- (NSString *)errorMessage;
-- (void)setErrorMessage:(NSString *)newErrorMessage;
-- (void)setIgnorableWarning:(BOOL)flag;
- (BOOL)isIgnorableWarning;
+- (BDSKErrorEditor *)editor;
+- (void)setEditor:(BDSKErrorEditor *)newEditor;
+
+- (BibItem *)publication;
+- (void)setPublication:(BibItem *)newPublication;
+
@end
Modified: trunk/bibdesk/BDSKErrorObject.m
===================================================================
--- trunk/bibdesk/BDSKErrorObject.m 2012-01-10 12:44:39 UTC (rev 18389)
+++ trunk/bibdesk/BDSKErrorObject.m 2012-01-10 12:45:46 UTC (rev 18390)
@@ -45,41 +45,37 @@
@implementation BDSKErrorObject
-- (id)init {
+- (id)initWithClassName:(NSString *)className message:(NSString *)msg
forFile:(NSString *)filePath line:(NSInteger)line isWarning:(BOOL)flag{
self = [super init];
if (self) {
- isIgnorableWarning = NO;
- lineNumber = -1;
+ errorClassName = [className copy];
+ errorMessage = [msg copy];
+ fileName = [filePath copy];
+ lineNumber = line;
+ isIgnorableWarning = flag;
}
return self;
}
+- (id)init {
+ return [self initWithClassName:nil message:nil forFile:nil line:-1
isWarning:NO];
+}
+
- (id)copyWithZone:(NSZone *)zone {
- id error = [[[self class] alloc] init];
- [error setErrorClassName:errorClassName];
- [error setFileName:fileName];
- [error setLineNumber:lineNumber];
- [error setErrorMessage:errorMessage];
- [error setIgnorableWarning:isIgnorableWarning];
- return error;
+ return [[[self class] alloc] initWithClassName:errorClassName
message:errorMessage forFile:fileName line:lineNumber
isWarning:isIgnorableWarning];
}
- (void)dealloc {
- [fileName release];
- [editor release];
- [publication release];
- [errorClassName release];
- [errorMessage release];
+ BDSKDESTROY(fileName);
+ BDSKDESTROY(errorClassName);
+ BDSKDESTROY(errorMessage);
+ BDSKDESTROY(editor);
+ BDSKDESTROY(publication);
[super dealloc];
}
+ (void)reportError:(NSString *)className message:(NSString *)msg
forFile:(NSString *)filePath line:(NSInteger)line isWarning:(BOOL)flag{
- id error = [[self alloc] init];
- [error setErrorClassName:className];
- [error setFileName:filePath];
- [error setLineNumber:line];
- [error setErrorMessage:msg];
- [error setIgnorableWarning:flag];
+ id error = [[self alloc] initWithClassName:className message:msg
forFile:filePath line:line isWarning:flag];
[[BDSKErrorObjectController sharedErrorObjectController]
reportError:error];
[error release];
}
@@ -96,13 +92,22 @@
return fileName;
}
-- (void)setFileName:(NSString *)newFileName {
- if (fileName != newFileName) {
- [fileName release];
- fileName = [newFileName copy];
- }
+- (NSInteger)lineNumber {
+ return lineNumber;
}
+- (NSString *)errorClassName {
+ return errorClassName;
+}
+
+- (NSString *)errorMessage {
+ return errorMessage;
+}
+
+- (BOOL)isIgnorableWarning {
+ return isIgnorableWarning;
+}
+
- (BDSKErrorEditor *)editor {
return editor;
}
@@ -125,42 +130,4 @@
}
}
-- (NSInteger)lineNumber {
- return lineNumber;
-}
-
-- (void)setLineNumber:(NSInteger)newLineNumber {
- lineNumber = newLineNumber;
-}
-
-- (NSString *)errorClassName {
- return errorClassName;
-}
-
-- (void)setErrorClassName:(NSString *)newErrorClassName {
- if (errorClassName != newErrorClassName) {
- [errorClassName release];
- errorClassName = [newErrorClassName copy];
- }
-}
-
-- (NSString *)errorMessage {
- return errorMessage;
-}
-
-- (void)setErrorMessage:(NSString *)newErrorMessage {
- if (errorMessage != newErrorMessage) {
- [errorMessage release];
- errorMessage = [newErrorMessage copy];
- }
-}
-
-- (void)setIgnorableWarning:(BOOL)flag {
- isIgnorableWarning = flag;
-}
-
-- (BOOL)isIgnorableWarning {
- return isIgnorableWarning;
-}
-
@end
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit