1/*
2   Project: MPDCon
3
4   Copyright (C) 2006
5
6   Author: Daniel Luederwald
7
8   Created: 2006-02-22 13:52:30 +0100 by mrsanders
9
10   This application is free software; you can redistribute it and/or
11   modify it under the terms of the GNU General Public
12   License as published by the Free Software Foundation; either
13   version 2 of the License, or (at your option) any later version.
14
15   This application is distributed in the hope that it will be useful,
16   but WITHOUT ANY WARRANTY; without even the implied warranty of
17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   Library General Public License for more details.
19
20   You should have received a copy of the GNU General Public
21   License along with this library; if not, write to the Free
22   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
23*/
24
25#include "NormalFormatter.h"
26
27@implementation NormalFormatter
28- (NSString *) stringForObjectValue: (id) anObject
29{
30    return anObject;
31}
32
33- (NSAttributedString *)attributedStringForObjectValue: (id) anObject
34    withDefaultAttributes: (NSDictionary *) attr
35{
36  if (anObject != nil) {
37    NSFont *theFont = [NSFont systemFontOfSize: [NSFont systemFontSize]];
38    NSMutableAttributedString *aString = [[NSMutableAttributedString alloc] initWithString: anObject];
39    NSMutableDictionary *attrs = [NSMutableDictionary dictionaryWithDictionary: attr];
40
41    [attrs setObject: theFont forKey: NSFontAttributeName];
42    if ([aString length]) {
43      [aString setAttributes: attrs range: NSMakeRange(0, [aString length])];
44    }
45    return [aString autorelease];
46  } else {
47    NSMutableAttributedString *aString = [[NSMutableAttributedString alloc] initWithString: @""];
48    return [aString autorelease];
49  }
50}
51
52- (BOOL)getObjectValue:(id *)obj forString:(NSString *)string errorDescription:(NSString  **)error
53{
54  *obj = string;
55}
56
57@end
58