mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Checking in work in progress on the library reorganization
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
//
|
||||
// RKJSONParserNXJSON.h
|
||||
// RestKit
|
||||
//
|
||||
// Created by Evan Cordell on 7/26/11.
|
||||
// Copyright 2011 Two Toasters. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "../../RKParser.h"
|
||||
|
||||
@interface RKJSONParserNXJSON : NSObject <RKParser> {
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,23 +0,0 @@
|
||||
//
|
||||
// RKJSONParserNXJSON.m
|
||||
// RestKit
|
||||
//
|
||||
// Created by Evan Cordell on 7/26/11.
|
||||
// Copyright 2011 Two Toasters. All rights reserved.
|
||||
//
|
||||
|
||||
#import "RKJSONParserNXJSON.h"
|
||||
#import "NXJsonParser.h"
|
||||
#import "NXJsonSerializer.h"
|
||||
|
||||
@implementation RKJSONParserNXJSON
|
||||
|
||||
- (NSDictionary*)objectFromString:(NSString*)string error:(NSError**)error {
|
||||
return [NXJsonParser parseString:string error:error ignoreNulls:YES];
|
||||
}
|
||||
|
||||
- (NSString*)stringFromObject:(id)object error:(NSError**)error {
|
||||
return [NXJsonSerializer serialize:object];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// RKJSONParserSBJSON.h
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 5/14/11.
|
||||
// Copyright 2011 Two Toasters
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "../../RKParser.h"
|
||||
|
||||
@interface RKJSONParserSBJSON : NSObject <RKParser> {
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,48 +0,0 @@
|
||||
//
|
||||
// RKJSONParserSBJSON.m
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 3/4/10.
|
||||
// Copyright 2010 Two Toasters
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "RKJSONParserSBJSON.h"
|
||||
#import "SBJsonParser.h"
|
||||
#import "SBJsonWriter.h"
|
||||
|
||||
@implementation RKJSONParserSBJSON
|
||||
|
||||
- (NSDictionary*)objectFromString:(NSString*)string error:(NSError **)error {
|
||||
SBJsonParser* parser = [[SBJsonParser alloc] init];
|
||||
id result = [parser objectWithString:string];
|
||||
if (nil == result) {
|
||||
if (error) *error = [[parser errorTrace] lastObject];
|
||||
}
|
||||
[parser release];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSString*)stringFromObject:(id)object error:(NSError **)error {
|
||||
SBJsonWriter *jsonWriter = [SBJsonWriter new];
|
||||
NSString *json = [jsonWriter stringWithObject:object];
|
||||
if (!json) {
|
||||
if (error) *error = [[jsonWriter errorTrace] lastObject];
|
||||
}
|
||||
[jsonWriter release];
|
||||
return json;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// RKJSONParserYAJL.h
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 5/14/11.
|
||||
// Copyright 2011 Two Toasters
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "../../RKParser.h"
|
||||
|
||||
@interface RKJSONParserYAJL : NSObject <RKParser> {
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,34 +0,0 @@
|
||||
//
|
||||
// RKMappingFormatJSONParserYAJL.m
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 9/28/10.
|
||||
// Copyright 2010 Two Toasters
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
#import "RKJSONParserYAJL.h"
|
||||
#import "YAJL.h"
|
||||
|
||||
@implementation RKJSONParserYAJL
|
||||
|
||||
- (NSDictionary*)objectFromString:(NSString*)string error:(NSError **)error {
|
||||
return [string yajl_JSON:error];
|
||||
}
|
||||
|
||||
- (NSString*)stringFromObject:(id)object error:(NSError **)error {
|
||||
return [object yajl_JSONStringWithOptions:YAJLGenOptionsIncludeUnsupportedTypes indentString:@" "];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user