Permalink
Browse files

ZDSStreamJSONParser and start of sample project

  • Loading branch information...
1 parent 01c95cd commit 6b4db4bcc1ef4417bd9b06adfe2873b87fb937df Marcus S. Zarra committed Nov 3, 2011
View
38 FJImporter/Classes/CGFAppDelegate.h
@@ -0,0 +1,38 @@
+//
+// CGFAppDelegate.h
+// FJImporter
+//
+// Created by Marcus Zarra on 10/28/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+@interface CGFAppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (nonatomic, retain) UIWindow *window;
+@property (nonatomic, retain) UINavigationController *navController;
+
+@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
+
+- (void)saveContext;
+
+@end
View
116 FJImporter/Classes/CGFAppDelegate.m
@@ -0,0 +1,116 @@
+
+//
+// CGFAppDelegate.m
+// FJImporter
+//
+// Created by Marcus Zarra on 10/28/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+#import "CGFAppDelegate.h"
+
+#import "CGFUsernameViewController.h"
+
+@implementation CGFAppDelegate
+
+@synthesize window;
+@synthesize managedObjectContext;
+@synthesize navController;
+
+- (void)dealloc
+{
+ [window release];
+ [managedObjectContext release];
+
+ [super dealloc];
+}
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
+{
+ [self setWindow:[[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease]];
+
+ CGFUsernameViewController *controller = [[CGFUsernameViewController alloc] initWithNibName:@"CGFUsernameView" bundle:nil];
+ [controller setManagedObjectContext:[self managedObjectContext]];
+
+ UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:controller];
+ [self setNavController:nav];
+ MCRelease(controller);
+ MCRelease(nav);
+
+ [[self window] addSubview:[[self navController] view]];
+
+ [[self window] makeKeyAndVisible];
+
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application
+{
+ [self saveContext];
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application
+{
+ [self saveContext];
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application
+{
+ [self saveContext];
+}
+
+- (void)saveContext
+{
+ NSError *error = nil;
+
+ if (![self managedObjectContext]) return;
+ if (![[self managedObjectContext] hasChanges]) return;
+
+ ZAssert([[self managedObjectContext] save:&error], @"Unresolved error %@, %@", error, [error userInfo]);
+}
+
+#pragma mark - Core Data stack
+
+- (NSManagedObjectContext *)managedObjectContext
+{
+ if (managedObjectContext) return managedObjectContext;
+
+ NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"FJImporter" withExtension:@"momd"];
+ NSManagedObjectModel *mom = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL];
+
+ NSURL *storeURL = [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] URLByAppendingPathComponent:@"FJImporter.sqlite"];
+
+ NSError *error = nil;
+ NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:mom];
+ MCRelease(mom);
+
+ ZAssert([psc addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error], @"Unresolved error %@, %@", error, [error userInfo]);
+
+ managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
+ [managedObjectContext setPersistentStoreCoordinator:psc];
+ MCRelease(psc);
+
+ return managedObjectContext;
+}
+
+@end
View
14 FJImporter/Classes/CGFTimelineViewController.h
@@ -0,0 +1,14 @@
+//
+// CGFTimelineViewController.h
+// FJImporter
+//
+// Created by Marcus Zarra on 11/3/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+
+@interface CGFTimelineViewController : UITableViewController
+
+@property (nonatomic, retain) NSManagedObject *user;
+@property (nonatomic, assign) NSManagedObjectContext *managedObjectContext;
+
+@end
View
125 FJImporter/Classes/CGFTimelineViewController.m
@@ -0,0 +1,125 @@
+//
+// CGFTimelineViewController.m
+// FJImporter
+//
+// Created by Marcus Zarra on 11/3/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+#import "CGFTimelineViewController.h"
+
+@interface CGFTimelineViewController() <NSFetchedResultsControllerDelegate>
+
+@property (nonatomic, retain) NSFetchedResultsController *fetchController;
+
+@end
+
+@implementation CGFTimelineViewController
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ [self setTitle:[[self user] valueForKey:@"name"]];
+
+ if ([self fetchController]) return;
+
+ NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Tweet"];
+ [request setPredicate:[NSPredicate predicateWithFormat:@"ANY timeline == %@", [self user]]];
+
+ NSSortDescriptor *sort = [[[NSSortDescriptor alloc] initWithKey:@"createdAt" ascending:NO] autorelease];
+ [request setSortDescriptors:[NSArray arrayWithObject:sort]];
+
+ NSFetchedResultsController *controller = [[NSFetchedResultsController alloc] initWithFetchRequest:request managedObjectContext:[self managedObjectContext] sectionNameKeyPath:nil cacheName:[[self user] valueForKey:@"name"]];
+ [controller setDelegate:self];
+
+ NSError *error = nil;
+ ZAssert([controller performFetch:&error], @"Error fetching tweets: %@", error);
+
+ [self setFetchController:controller];
+ MCRelease(controller);
+}
+
+#pragma mark - Table view data source
+
+- (void)configureCell:(id)cell atIndexPath:(NSIndexPath*)indexPath
+{
+ NSManagedObject *tweet = [[self fetchController] objectAtIndexPath:indexPath];
+
+ [[cell textLabel] setText:[tweet valueForKey:@"text"]];
+ [[cell detailTextLabel] setText:[tweet valueForKeyPath:@"author.name"]];
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+ return [[[[self fetchController] sections] objectAtIndex:section] numberOfObjects];
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ id cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
+
+ if (!cell) {
+ cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCellIdentifier] autorelease];
+ [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
+ }
+
+ [self configureCell:cell atIndexPath:indexPath];
+
+ return cell;
+}
+
+- (void)controllerWillChangeContent:(NSFetchedResultsController *)controller
+{
+ [[self tableView] beginUpdates];
+}
+
+- (void)controller:(NSFetchedResultsController *)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath *)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath *)newIndexPath
+{
+ switch(type) {
+ case NSFetchedResultsChangeInsert:
+ [[self tableView] insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
+ break;
+ case NSFetchedResultsChangeDelete:
+ [[self tableView] deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ break;
+ case NSFetchedResultsChangeUpdate:
+ [self configureCell:[[self tableView] cellForRowAtIndexPath:indexPath] atIndexPath:indexPath];
+ break;
+ case NSFetchedResultsChangeMove:
+ [[self tableView] deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
+ [[self tableView] insertRowsAtIndexPaths:[NSArray arrayWithObject:newIndexPath] withRowAnimation:UITableViewRowAnimationFade];
+ break;
+ }
+}
+
+- (void)controllerDidChangeContent:(NSFetchedResultsController *)controller
+{
+ [[self tableView] endUpdates];
+}
+
+@synthesize user;
+@synthesize managedObjectContext;
+@synthesize fetchController;
+
+@end
View
41 FJImporter/Classes/CGFURLDelegateOperation.h
@@ -0,0 +1,41 @@
+//
+// CGFURLDelegateOperation.h
+//
+// Created by Marcus Zarra on 10/28/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+@class YAJLParser;
+
+@interface CGFURLDelegateOperation : NSOperation
+
+@property (nonatomic, retain) NSURL *requestURL;
+@property (nonatomic, retain) YAJLParser *parser;
+@property (nonatomic, retain) NSHTTPURLResponse *response;
+
+@property (nonatomic, retain) NSManagedObject *user;
+@property (nonatomic, assign) NSManagedObjectContext *managedObjectContext;
+
+- (id)initWithRequestURL:(NSURL*)aURL andContext:(NSManagedObjectContext*)aContext;
+
+@end
View
232 FJImporter/Classes/CGFURLDelegateOperation.m
@@ -0,0 +1,232 @@
+//
+// CGFURLDelegateOperation.m
+//
+// Created by Marcus Zarra on 10/28/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+#import "CGFURLDelegateOperation.h"
+#import "ZDSStreamJSONParser.h"
+
+#import "YAJLParser.h"
+
+@interface CGFInternalParser : NSObject <YAJLParserDelegate>
+
+@property (nonatomic, retain) ZDSStreamJSONParser *child;
+@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
+@property (nonatomic, retain) NSManagedObject *currentTweet;
+@property (nonatomic, retain) NSManagedObject *user;
+
+@property (nonatomic, assign) YAJLParser *parser;
+
+@end
+
+@implementation CGFURLDelegateOperation
+
+@synthesize requestURL;
+@synthesize parser;
+@synthesize managedObjectContext;
+@synthesize response;
+@synthesize user;
+
+- (id)initWithRequestURL:(NSURL*)aURL andContext:(NSManagedObjectContext*)aContext;
+{
+ if (!(self = [super init])) return nil;
+
+ requestURL = [aURL retain];
+ managedObjectContext = aContext;
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ managedObjectContext = nil;
+
+ MCRelease(response);
+ MCRelease(requestURL);
+ MCRelease(parser);
+
+ [super dealloc];
+}
+
+- (void)main
+{
+ NSInteger yajlOptions = YAJLParserOptionsAllowComments;
+ YAJLParser *aParser = [[YAJLParser alloc] initWithParserOptions:yajlOptions];
+
+ NSManagedObjectContext *internalMOC = [[NSManagedObjectContext alloc] init];
+ [internalMOC setParentContext:[self managedObjectContext]];
+
+ CGFInternalParser *internalParser = [[CGFInternalParser alloc] init];
+ [internalParser setManagedObjectContext:internalMOC];
+ [internalParser setParser:aParser];
+ [internalParser setUser:[self user]];
+
+ [aParser setDelegate:internalParser];
+ [self setParser:aParser];
+ MCRelease(aParser);
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[self requestURL]];
+ [NSURLConnection connectionWithRequest:request delegate:self];
+
+ CFRunLoopRun();
+
+ NSError *error = nil;
+ ZAssert([internalMOC save:&error], @"Error saving %@\n%@", [error localizedDescription], [error userInfo]);
+ MCRelease(internalMOC);
+}
+
+#pragma mark -
+#pragma mark NSURLConnectionDelegate methods
+
+- (void)connection:(NSURLConnection*)connection didReceiveResponse:(NSHTTPURLResponse*)resp
+{
+ [self setResponse:resp];
+}
+
+- (void)connection:(NSURLConnection*)connection didReceiveData:(NSData*)newData
+{
+ YAJLParserStatus status = [[self parser] parse:newData];
+ if (status == YAJLParserStatusInsufficientData) return;
+ if (status == YAJLParserStatusOK) return;
+
+ NSError *error = [[self parser] parserError];
+ ALog(@"Data parsing has failed: %@", error);
+}
+
+- (void)connectionDidFinishLoading:(NSURLConnection*)connection
+{
+ CFRunLoopStop(CFRunLoopGetCurrent());
+}
+
+- (void)connection:(NSURLConnection*)connection didFailWithError:(NSError*)error
+{
+ ALog(@"Failure %@\n%@", [error localizedDescription], [error userInfo]);
+ CFRunLoopStop(CFRunLoopGetCurrent());
+}
+
+@end
+
+@implementation CGFInternalParser
+
+#pragma mark YAJLParserDelegate
+
+- (void)dealloc
+{
+ [self setChild:nil];
+ [self setManagedObjectContext:nil];
+ [self setCurrentTweet:nil];
+ [self setUser:nil];
+
+ [super dealloc];
+}
+
+- (void)merge
+{
+ if (![self currentTweet]) return;
+
+ NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"Tweet"];
+ [request setPredicate:[NSPredicate predicateWithFormat:@"identifer == %@", [[self currentTweet] valueForKey:@"identifier"]]];
+
+ NSError *error = nil;
+ NSArray *tweets = [[self managedObjectContext] executeFetchRequest:request error:&error];
+ ZAssert(!error || tweets, @"Error fetching: %@", error);
+
+ if ([tweets count] == 1) {
+ [[[self user] mutableSetValueForKey:@"timeline"] addObject:[self currentTweet]];
+ [[self managedObjectContext] performBlock:^{
+ NSError *error = nil;
+ ZAssert([[self managedObjectContext] save:&error], @"Failed to save: %@", error);
+ }];
+ return;
+ }
+
+ NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(id mo, NSDictionary *bindings) {
+ if ([mo isTemporaryID]) return NO;
+ return YES;
+ }];
+
+ NSManagedObject *masterTweet = [[tweets filteredArrayUsingPredicate:predicate] lastObject];
+ if (!masterTweet) {
+ masterTweet = [self currentTweet];
+ }
+
+ for (NSManagedObject *tweet in tweets) {
+ if (tweet == masterTweet) continue;
+ [[self managedObjectContext] deleteObject:tweet];
+ }
+
+ [[[self user] mutableSetValueForKey:@"timeline"] addObject:masterTweet];
+
+ [[self managedObjectContext] performBlock:^{
+ NSError *error = nil;
+ ZAssert([[self managedObjectContext] save:&error], @"Failed to save: %@", error);
+ }];
+}
+
+- (void)parserDidStartDictionary:(YAJLParser*)parser
+{
+ [self merge];
+
+ NSManagedObject *tweet = [NSEntityDescription insertNewObjectForEntityForName:@"Tweet" inManagedObjectContext:[self managedObjectContext]];
+ ZDSStreamJSONParser *streamParser = [[ZDSStreamJSONParser alloc] initWithManagedObjectContext:[self managedObjectContext]];
+ [streamParser setCurrentObject:tweet];
+ [streamParser setParent:self];
+ [self setChild:streamParser];
+ [parser setDelegate:streamParser];
+ [self setCurrentTweet:tweet];
+ MCRelease(streamParser);
+}
+
+- (void)parserDidEndDictionary:(YAJLParser*)parser
+{
+ ALog(@"Should not fire");
+}
+
+- (void)parserDidStartArray:(YAJLParser*)parser
+{
+}
+
+- (void)parserDidEndArray:(YAJLParser*)parser
+{
+}
+
+- (void)parser:(YAJLParser*)parser didMapKey:(NSString*)key
+{
+ ALog(@"Should not fire");
+}
+
+- (void)parser:(YAJLParser*)parser didAdd:(id)value
+{
+ ALog(@"Should not fire");
+}
+
+@synthesize user;
+@synthesize parser;
+@synthesize managedObjectContext;
+@synthesize currentTweet;
+@synthesize child;
+
+@end
View
277 FJImporter/Classes/CGFUsernameView.xib
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
+ <data>
+ <int key="IBDocument.SystemTarget">1280</int>
+ <string key="IBDocument.SystemVersion">11C57</string>
+ <string key="IBDocument.InterfaceBuilderVersion">1938</string>
+ <string key="IBDocument.AppKitVersion">1138.21</string>
+ <string key="IBDocument.HIToolboxVersion">567.00</string>
+ <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
+ <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="NS.object.0">933</string>
+ </object>
+ <array key="IBDocument.IntegratedClassDependencies">
+ <string>IBUIButton</string>
+ <string>IBUIImageView</string>
+ <string>IBUIView</string>
+ <string>IBUITextField</string>
+ <string>IBProxyObject</string>
+ </array>
+ <array key="IBDocument.PluginDependencies">
+ <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </array>
+ <object class="NSMutableDictionary" key="IBDocument.Metadata">
+ <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+ <integer value="1" key="NS.object.0"/>
+ </object>
+ <array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
+ <object class="IBProxyObject" id="372490531">
+ <string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBProxyObject" id="975951072">
+ <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIView" id="191373211">
+ <reference key="NSNextResponder"/>
+ <int key="NSvFlags">274</int>
+ <array class="NSMutableArray" key="NSSubviews">
+ <object class="IBUIImageView" id="575083758">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">256</int>
+ <string key="NSFrame">{{-7, 168}, {320, 200}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="232332251"/>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <int key="IBUIContentMode">1</int>
+ <bool key="IBUIMultipleTouchEnabled">YES</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <object class="NSCustomResource" key="IBUIImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">JustLogo.png</string>
+ </object>
+ </object>
+ <object class="IBUITextField" id="232332251">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{57, 50}, {193, 31}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="1032187336"/>
+ <string key="NSReuseIdentifierKey">_NS:304</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <bool key="IBUIClipsSubviews">YES</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <string key="IBUIText"/>
+ <int key="IBUIBorderStyle">3</int>
+ <object class="NSColor" key="IBUITextColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MAA</bytes>
+ <object class="NSColorSpace" key="NSCustomColorSpace" id="740449795">
+ <int key="NSID">2</int>
+ </object>
+ </object>
+ <bool key="IBUIAdjustsFontSizeToFit">YES</bool>
+ <float key="IBUIMinimumFontSize">17</float>
+ <object class="IBUITextInputTraits" key="IBUITextInputTraits">
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription">
+ <int key="type">1</int>
+ <double key="pointSize">14</double>
+ </object>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica</string>
+ <double key="NSSize">14</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ </object>
+ <object class="IBUIButton" id="1032187336">
+ <reference key="NSNextResponder" ref="191373211"/>
+ <int key="NSvFlags">292</int>
+ <string key="NSFrame">{{88, 101}, {130, 37}}</string>
+ <reference key="NSSuperview" ref="191373211"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
+ <string key="NSReuseIdentifierKey">_NS:225</string>
+ <bool key="IBUIOpaque">NO</bool>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <int key="IBUIContentHorizontalAlignment">0</int>
+ <int key="IBUIContentVerticalAlignment">0</int>
+ <int key="IBUIButtonType">1</int>
+ <string key="IBUINormalTitle">Show Timeline</string>
+ <object class="NSColor" key="IBUIHighlightedTitleColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleColor">
+ <int key="NSColorSpace">1</int>
+ <bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
+ </object>
+ <object class="NSColor" key="IBUINormalTitleShadowColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MC41AA</bytes>
+ </object>
+ <object class="IBUIFontDescription" key="IBUIFontDescription">
+ <int key="type">2</int>
+ <double key="pointSize">15</double>
+ </object>
+ <object class="NSFont" key="IBUIFont">
+ <string key="NSName">Helvetica-Bold</string>
+ <double key="NSSize">15</double>
+ <int key="NSfFlags">16</int>
+ </object>
+ </object>
+ </array>
+ <string key="NSFrame">{{0, 20}, {320, 460}}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView" ref="575083758"/>
+ <object class="NSColor" key="IBUIBackgroundColor">
+ <int key="NSColorSpace">3</int>
+ <bytes key="NSWhite">MQA</bytes>
+ <reference key="NSCustomColorSpace" ref="740449795"/>
+ </object>
+ <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
+ <string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ </object>
+ </array>
+ <object class="IBObjectContainer" key="IBDocument.Objects">
+ <array class="NSMutableArray" key="connectionRecords">
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">view</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="191373211"/>
+ </object>
+ <int key="connectionID">3</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchOutletConnection" key="connection">
+ <string key="label">usernameTextField</string>
+ <reference key="source" ref="372490531"/>
+ <reference key="destination" ref="232332251"/>
+ </object>
+ <int key="connectionID">7</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBCocoaTouchEventConnection" key="connection">
+ <string key="label">loadTimeline:</string>
+ <reference key="source" ref="1032187336"/>
+ <reference key="destination" ref="372490531"/>
+ <int key="IBEventType">7</int>
+ </object>
+ <int key="connectionID">8</int>
+ </object>
+ </array>
+ <object class="IBMutableOrderedSet" key="objectRecords">
+ <array key="orderedObjects">
+ <object class="IBObjectRecord">
+ <int key="objectID">0</int>
+ <array key="object" id="0"/>
+ <reference key="children" ref="1000"/>
+ <nil key="parent"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1</int>
+ <reference key="object" ref="191373211"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="232332251"/>
+ <reference ref="1032187336"/>
+ <reference ref="575083758"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-1</int>
+ <reference key="object" ref="372490531"/>
+ <reference key="parent" ref="0"/>
+ <string key="objectName">File's Owner</string>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">-2</int>
+ <reference key="object" ref="975951072"/>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">5</int>
+ <reference key="object" ref="232332251"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">6</int>
+ <reference key="object" ref="1032187336"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">9</int>
+ <reference key="object" ref="575083758"/>
+ <reference key="parent" ref="191373211"/>
+ </object>
+ </array>
+ </object>
+ <dictionary class="NSMutableDictionary" key="flattenedProperties">
+ <string key="-1.CustomClassName">CGFUsernameViewController</string>
+ <string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="-2.CustomClassName">UIResponder</string>
+ <string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ <string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
+ </dictionary>
+ <dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
+ <nil key="activeLocalization"/>
+ <dictionary class="NSMutableDictionary" key="localizations"/>
+ <nil key="sourceID"/>
+ <int key="maxID">9</int>
+ </object>
+ <object class="IBClassDescriber" key="IBDocument.Classes">
+ <array class="NSMutableArray" key="referencedPartialClassDescriptions">
+ <object class="IBPartialClassDescription">
+ <string key="className">CGFUsernameViewController</string>
+ <string key="superclassName">UIViewController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">loadTimeline:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="NSMutableDictionary" key="actionInfosByName">
+ <string key="NS.key.0">loadTimeline:</string>
+ <object class="IBActionInfo" key="NS.object.0">
+ <string key="name">loadTimeline:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <string key="NS.key.0">usernameTextField</string>
+ <string key="NS.object.0">UITextField</string>
+ </object>
+ <object class="NSMutableDictionary" key="toOneOutletInfosByName">
+ <string key="NS.key.0">usernameTextField</string>
+ <object class="IBToOneOutletInfo" key="NS.object.0">
+ <string key="name">usernameTextField</string>
+ <string key="candidateClassName">UITextField</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">./Classes/CGFUsernameViewController.h</string>
+ </object>
+ </object>
+ </array>
+ </object>
+ <int key="IBDocument.localizationMode">0</int>
+ <string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
+ <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
+ <int key="IBDocument.defaultPropertyAccessControl">3</int>
+ <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <string key="NS.key.0">JustLogo.png</string>
+ <string key="NS.object.0">{341, 339}</string>
+ </object>
+ <string key="IBCocoaTouchPluginVersion">933</string>
+ </data>
+</archive>
View
37 FJImporter/Classes/CGFUsernameViewController.h
@@ -0,0 +1,37 @@
+//
+// CGFUsernameViewController.h
+// FJImporter
+//
+// Created by Marcus Zarra on 11/3/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+
+@interface CGFUsernameViewController : UIViewController
+
+@property (nonatomic, assign) IBOutlet UITextField *usernameTextField;
+@property (nonatomic, assign) NSManagedObjectContext *managedObjectContext;
+
+- (IBAction)loadTimeline:(id)sender;
+
+@end
View
88 FJImporter/Classes/CGFUsernameViewController.m
@@ -0,0 +1,88 @@
+//
+// CGFUsernameViewController.m
+// FJImporter
+//
+// Created by Marcus Zarra on 11/3/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+#import "CGFUsernameViewController.h"
+#import "CGFURLDelegateOperation.h"
+#import "CGFTimelineViewController.h"
+
+#define urlBase @"https://api.twitter.com/1/statuses/user_timeline.json?screen_name=%@"
+
+@interface CGFUsernameViewController()
+
+@property (nonatomic, retain) NSOperationQueue *queue;
+
+@end
+
+@implementation CGFUsernameViewController
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ [self setTitle:@"Enter Username"];
+
+ if (![self queue]) {
+ NSOperationQueue *queue = [[NSOperationQueue alloc] init];
+ [self setQueue:queue];
+ MCRelease(queue);
+ }
+}
+
+- (IBAction)loadTimeline:(id)sender
+{
+ NSString *username = [[self usernameTextField] text];
+ NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:urlBase, username]];
+
+ CGFURLDelegateOperation *op = [[CGFURLDelegateOperation alloc] initWithRequestURL:url andContext:[self managedObjectContext]];
+ [[self queue] addOperation:op];
+ MCRelease(op);
+
+ NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"User"];
+ [request setPredicate:[NSPredicate predicateWithFormat:@"name == %@", username]];
+
+ NSError *error = nil;
+ NSManagedObject *user = [[[self managedObjectContext] executeFetchRequest:request error:&error] lastObject];
+ ZAssert(!error || user, @"Error fetching user: %@", error);
+
+ if (!user) {
+ user = [NSEntityDescription insertNewObjectForEntityForName:@"User" inManagedObjectContext:[self managedObjectContext]];
+ [user setValue:username forKey:@"name"];
+ }
+
+ CGFTimelineViewController *controller = [[CGFTimelineViewController alloc] initWithStyle:UITableViewStylePlain];
+ [controller setUser:user];
+ [controller setManagedObjectContext:[self managedObjectContext]];
+ [[self navigationController] pushViewController:controller animated:YES];
+ MCRelease(controller);
+}
+
+@synthesize queue;
+@synthesize usernameTextField;
+@synthesize managedObjectContext;
+
+@end
View
34 FJImporter/Classes/main.m
@@ -0,0 +1,34 @@
+//
+// main.m
+// FJImporter
+//
+// Created by Marcus Zarra on 10/28/11.
+// Copyright (c) 2011 Cocoa Is My Girlfriend. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+
+int main(int argc, char *argv[])
+{
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, @"CGFAppDelegate");
+ }
+}
View
379 FJImporter/FJImporter.xcodeproj/project.pbxproj
@@ -0,0 +1,379 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ B62AC0C0145B9771005ABE92 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B62AC0BF145B9771005ABE92 /* UIKit.framework */; };
+ B62AC0C2145B9771005ABE92 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B62AC0C1145B9771005ABE92 /* Foundation.framework */; };
+ B62AC0C4145B9771005ABE92 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B62AC0C3145B9771005ABE92 /* CoreGraphics.framework */; };
+ B62AC0C6145B9771005ABE92 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B62AC0C5145B9771005ABE92 /* CoreData.framework */; };
+ B62AC0CE145B9771005ABE92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B62AC0CD145B9771005ABE92 /* main.m */; };
+ B62AC0E7145B9842005ABE92 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = B62AC0E2145B9842005ABE92 /* InfoPlist.strings */; };
+ B62AC0F5145B9861005ABE92 /* CGFURLDelegateOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = B62AC0F1145B9861005ABE92 /* CGFURLDelegateOperation.m */; };
+ B658C244146307F600A7AED3 /* CGFUsernameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B658C242146307F600A7AED3 /* CGFUsernameViewController.m */; };
+ B658C245146307F600A7AED3 /* CGFUsernameView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B658C243146307F600A7AED3 /* CGFUsernameView.xib */; };
+ B658C24B14630AB100A7AED3 /* FJImporter.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = B658C24914630AB100A7AED3 /* FJImporter.xcdatamodeld */; };
+ B658C24E14630B8800A7AED3 /* JustLogo.png in Resources */ = {isa = PBXBuildFile; fileRef = B658C24D14630B8800A7AED3 /* JustLogo.png */; };
+ B658C251146311D900A7AED3 /* CGFTimelineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B658C250146311D900A7AED3 /* CGFTimelineViewController.m */; };
+ B6AEDED3145B98E300467F0B /* libYAJLiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B6AEDEC9145B98E300467F0B /* libYAJLiOS.a */; };
+ B6AEDED6145B992A00467F0B /* CGFAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B6AEDED5145B992A00467F0B /* CGFAppDelegate.m */; };
+ B6BD9DDD14635EAA008D4011 /* ZDSStreamJSONParser.m in Sources */ = {isa = PBXBuildFile; fileRef = B6BD9DDC14635EAA008D4011 /* ZDSStreamJSONParser.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ B62AC0BB145B9771005ABE92 /* FJImporter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FJImporter.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ B62AC0BF145B9771005ABE92 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ B62AC0C1145B9771005ABE92 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ B62AC0C3145B9771005ABE92 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ B62AC0C5145B9771005ABE92 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
+ B62AC0CD145B9771005ABE92 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ B62AC0E3145B9842005ABE92 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = InfoPlist.strings; sourceTree = "<group>"; };
+ B62AC0E9145B9854005ABE92 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ B62AC0EA145B9854005ABE92 /* Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
+ B62AC0F0145B9861005ABE92 /* CGFURLDelegateOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGFURLDelegateOperation.h; sourceTree = "<group>"; };
+ B62AC0F1145B9861005ABE92 /* CGFURLDelegateOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGFURLDelegateOperation.m; sourceTree = "<group>"; };
+ B658C241146307F600A7AED3 /* CGFUsernameViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGFUsernameViewController.h; sourceTree = "<group>"; };
+ B658C242146307F600A7AED3 /* CGFUsernameViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGFUsernameViewController.m; sourceTree = "<group>"; };
+ B658C243146307F600A7AED3 /* CGFUsernameView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CGFUsernameView.xib; sourceTree = "<group>"; };
+ B658C24A14630AB100A7AED3 /* FJImporter.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = FJImporter.xcdatamodel; sourceTree = "<group>"; };
+ B658C24D14630B8800A7AED3 /* JustLogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = JustLogo.png; sourceTree = "<group>"; };
+ B658C24F146311D900A7AED3 /* CGFTimelineViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGFTimelineViewController.h; sourceTree = "<group>"; };
+ B658C250146311D900A7AED3 /* CGFTimelineViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGFTimelineViewController.m; sourceTree = "<group>"; };
+ B6AEDEC9145B98E300467F0B /* libYAJLiOS.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libYAJLiOS.a; sourceTree = "<group>"; };
+ B6AEDECA145B98E300467F0B /* NSBundle+YAJL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+YAJL.h"; sourceTree = "<group>"; };
+ B6AEDECB145B98E300467F0B /* NSObject+YAJL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+YAJL.h"; sourceTree = "<group>"; };
+ B6AEDECC145B98E300467F0B /* yajl_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yajl_common.h; sourceTree = "<group>"; };
+ B6AEDECD145B98E300467F0B /* yajl_gen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yajl_gen.h; sourceTree = "<group>"; };
+ B6AEDECE145B98E300467F0B /* yajl_parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yajl_parse.h; sourceTree = "<group>"; };
+ B6AEDECF145B98E300467F0B /* YAJLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YAJLDocument.h; sourceTree = "<group>"; };
+ B6AEDED0145B98E300467F0B /* YAJLGen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YAJLGen.h; sourceTree = "<group>"; };
+ B6AEDED1145B98E300467F0B /* YAJLIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YAJLIOS.h; sourceTree = "<group>"; };
+ B6AEDED2145B98E300467F0B /* YAJLParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YAJLParser.h; sourceTree = "<group>"; };
+ B6AEDED4145B992A00467F0B /* CGFAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGFAppDelegate.h; sourceTree = "<group>"; };
+ B6AEDED5145B992A00467F0B /* CGFAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CGFAppDelegate.m; sourceTree = "<group>"; };
+ B6BD9DDB14635EAA008D4011 /* ZDSStreamJSONParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZDSStreamJSONParser.h; path = ../ZDSStreamJSONParser.h; sourceTree = "<group>"; };
+ B6BD9DDC14635EAA008D4011 /* ZDSStreamJSONParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ZDSStreamJSONParser.m; path = ../ZDSStreamJSONParser.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ B62AC0B8145B9771005ABE92 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B62AC0C0145B9771005ABE92 /* UIKit.framework in Frameworks */,
+ B62AC0C2145B9771005ABE92 /* Foundation.framework in Frameworks */,
+ B62AC0C4145B9771005ABE92 /* CoreGraphics.framework in Frameworks */,
+ B62AC0C6145B9771005ABE92 /* CoreData.framework in Frameworks */,
+ B6AEDED3145B98E300467F0B /* libYAJLiOS.a in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ B62AC0B0145B9771005ABE92 = {
+ isa = PBXGroup;
+ children = (
+ B6BD9DDA14635E93008D4011 /* Shared */,
+ B62AC0C7145B9771005ABE92 /* Classes */,
+ B62AC0E0145B9836005ABE92 /* Resources */,
+ B62AC0BE145B9771005ABE92 /* Frameworks */,
+ B62AC0BC145B9771005ABE92 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ B62AC0BC145B9771005ABE92 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ B62AC0BB145B9771005ABE92 /* FJImporter.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ B62AC0BE145B9771005ABE92 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ B62AC0BF145B9771005ABE92 /* UIKit.framework */,
+ B62AC0C1145B9771005ABE92 /* Foundation.framework */,
+ B62AC0C3145B9771005ABE92 /* CoreGraphics.framework */,
+ B62AC0C5145B9771005ABE92 /* CoreData.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ B62AC0C7145B9771005ABE92 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ B6AEDED4145B992A00467F0B /* CGFAppDelegate.h */,
+ B6AEDED5145B992A00467F0B /* CGFAppDelegate.m */,
+ B62AC0F0145B9861005ABE92 /* CGFURLDelegateOperation.h */,
+ B62AC0F1145B9861005ABE92 /* CGFURLDelegateOperation.m */,
+ B62AC0CD145B9771005ABE92 /* main.m */,
+ B658C241146307F600A7AED3 /* CGFUsernameViewController.h */,
+ B658C242146307F600A7AED3 /* CGFUsernameViewController.m */,
+ B658C243146307F600A7AED3 /* CGFUsernameView.xib */,
+ B658C24F146311D900A7AED3 /* CGFTimelineViewController.h */,
+ B658C250146311D900A7AED3 /* CGFTimelineViewController.m */,
+ );
+ path = Classes;
+ sourceTree = "<group>";
+ };
+ B62AC0E0145B9836005ABE92 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ B658C24C14630B8800A7AED3 /* Images */,
+ B658C24914630AB100A7AED3 /* FJImporter.xcdatamodeld */,
+ B6AEDEC8145B98E300467F0B /* YAJL-1.0.9 */,
+ B62AC0E9145B9854005ABE92 /* Info.plist */,
+ B62AC0EA145B9854005ABE92 /* Prefix.pch */,
+ B62AC0E1145B9842005ABE92 /* en.lproj */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ B62AC0E1145B9842005ABE92 /* en.lproj */ = {
+ isa = PBXGroup;
+ children = (
+ B62AC0E2145B9842005ABE92 /* InfoPlist.strings */,
+ );
+ path = en.lproj;
+ sourceTree = "<group>";
+ };
+ B658C24C14630B8800A7AED3 /* Images */ = {
+ isa = PBXGroup;
+ children = (
+ B658C24D14630B8800A7AED3 /* JustLogo.png */,
+ );
+ path = Images;
+ sourceTree = "<group>";
+ };
+ B6AEDEC8145B98E300467F0B /* YAJL-1.0.9 */ = {
+ isa = PBXGroup;
+ children = (
+ B6AEDEC9145B98E300467F0B /* libYAJLiOS.a */,
+ B6AEDECA145B98E300467F0B /* NSBundle+YAJL.h */,
+ B6AEDECB145B98E300467F0B /* NSObject+YAJL.h */,
+ B6AEDECC145B98E300467F0B /* yajl_common.h */,
+ B6AEDECD145B98E300467F0B /* yajl_gen.h */,
+ B6AEDECE145B98E300467F0B /* yajl_parse.h */,
+ B6AEDECF145B98E300467F0B /* YAJLDocument.h */,
+ B6AEDED0145B98E300467F0B /* YAJLGen.h */,
+ B6AEDED1145B98E300467F0B /* YAJLIOS.h */,
+ B6AEDED2145B98E300467F0B /* YAJLParser.h */,
+ );
+ path = "YAJL-1.0.9";
+ sourceTree = "<group>";
+ };
+ B6BD9DDA14635E93008D4011 /* Shared */ = {
+ isa = PBXGroup;
+ children = (
+ B6BD9DDB14635EAA008D4011 /* ZDSStreamJSONParser.h */,
+ B6BD9DDC14635EAA008D4011 /* ZDSStreamJSONParser.m */,
+ );
+ name = Shared;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ B62AC0BA145B9771005ABE92 /* FJImporter */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = B62AC0D8145B9771005ABE92 /* Build configuration list for PBXNativeTarget "FJImporter" */;
+ buildPhases = (
+ B62AC0B7145B9771005ABE92 /* Sources */,
+ B62AC0B8145B9771005ABE92 /* Frameworks */,
+ B62AC0B9145B9771005ABE92 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = FJImporter;
+ productName = FJImporter;
+ productReference = B62AC0BB145B9771005ABE92 /* FJImporter.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ B62AC0B2145B9771005ABE92 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0420;
+ ORGANIZATIONNAME = "Cocoa Is My Girlfriend";
+ };
+ buildConfigurationList = B62AC0B5145B9771005ABE92 /* Build configuration list for PBXProject "FJImporter" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = B62AC0B0145B9771005ABE92;
+ productRefGroup = B62AC0BC145B9771005ABE92 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ B62AC0BA145B9771005ABE92 /* FJImporter */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ B62AC0B9145B9771005ABE92 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B62AC0E7145B9842005ABE92 /* InfoPlist.strings in Resources */,
+ B658C245146307F600A7AED3 /* CGFUsernameView.xib in Resources */,
+ B658C24E14630B8800A7AED3 /* JustLogo.png in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ B62AC0B7145B9771005ABE92 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B62AC0CE145B9771005ABE92 /* main.m in Sources */,
+ B62AC0F5145B9861005ABE92 /* CGFURLDelegateOperation.m in Sources */,
+ B6AEDED6145B992A00467F0B /* CGFAppDelegate.m in Sources */,
+ B658C244146307F600A7AED3 /* CGFUsernameViewController.m in Sources */,
+ B658C24B14630AB100A7AED3 /* FJImporter.xcdatamodeld in Sources */,
+ B658C251146311D900A7AED3 /* CGFTimelineViewController.m in Sources */,
+ B6BD9DDD14635EAA008D4011 /* ZDSStreamJSONParser.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ B62AC0E2145B9842005ABE92 /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ B62AC0E3145B9842005ABE92 /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ B62AC0D6145B9771005ABE92 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ B62AC0D7145B9771005ABE92 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 5.0;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ SDKROOT = iphoneos;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ B62AC0D9145B9771005ABE92 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/YAJL-1.0.9\"",
+ );
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Debug;
+ };
+ B62AC0DA145B9771005ABE92 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = Prefix.pch;
+ INFOPLIST_FILE = Info.plist;
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"$(SRCROOT)/YAJL-1.0.9\"",
+ );
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = app;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ B62AC0B5145B9771005ABE92 /* Build configuration list for PBXProject "FJImporter" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ B62AC0D6145B9771005ABE92 /* Debug */,
+ B62AC0D7145B9771005ABE92 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ B62AC0D8145B9771005ABE92 /* Build configuration list for PBXNativeTarget "FJImporter" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ B62AC0D9145B9771005ABE92 /* Debug */,
+ B62AC0DA145B9771005ABE92 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+
+/* Begin XCVersionGroup section */
+ B658C24914630AB100A7AED3 /* FJImporter.xcdatamodeld */ = {
+ isa = XCVersionGroup;
+ children = (
+ B658C24A14630AB100A7AED3 /* FJImporter.xcdatamodel */,
+ );
+ currentVersion = B658C24A14630AB100A7AED3 /* FJImporter.xcdatamodel */;
+ name = FJImporter.xcdatamodeld;
+ path = Models/FJImporter.xcdatamodeld;
+ sourceTree = "<group>";
+ versionGroupType = wrapper.xcdatamodel;
+ };
+/* End XCVersionGroup section */
+ };
+ rootObject = B62AC0B2145B9771005ABE92 /* Project object */;
+}
View
BIN FJImporter/Images/JustLogo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
40 FJImporter/Info.plist
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFiles</key>
+ <array/>
+ <key>CFBundleIdentifier</key>
+ <string>com.cimgf.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+</dict>
+</plist>
View
8 FJImporter/Models/FJImporter.xcdatamodeld/.xccurrentversion
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>_XCCurrentVersionName</key>
+ <string>FJImporter.xcdatamodel</string>
+</dict>
+</plist>
View
25 FJImporter/Models/FJImporter.xcdatamodeld/FJImporter.xcdatamodel/contents
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<model name="" userDefinedModelVersionIdentifier="" type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="872" systemVersion="11C57" minimumToolsVersion="Automatic" macOSVersion="Automatic" iOSVersion="Automatic">
+ <entity name="Tweet" syncable="YES">
+ <attribute name="createdAt" optional="YES" attributeType="Date" syncable="YES"/>
+ <attribute name="identifier" optional="YES" attributeType="String" syncable="YES"/>
+ <attribute name="text" optional="YES" attributeType="String" syncable="YES"/>
+ <relationship name="author" optional="YES" minCount="1" maxCount="1" deletionRule="Nullify" destinationEntity="User" inverseName="tweets" inverseEntity="User" syncable="YES"/>
+ <relationship name="timeline" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="User" inverseName="timeline" inverseEntity="User" syncable="YES"/>
+ <userInfo>
+ <entry key="created_at" value="createdAt"/>
+ <entry key="id_str" value="identifier"/>
+ <entry key="user" value="author"/>
+ </userInfo>
+ </entity>
+ <entity name="User" syncable="YES">
+ <attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
+ <attribute name="twitterID" optional="YES" attributeType="String" syncable="YES"/>
+ <relationship name="timeline" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="Tweet" inverseName="timeline" inverseEntity="Tweet" syncable="YES"/>
+ <relationship name="tweets" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="Tweet" inverseName="author" inverseEntity="Tweet" syncable="YES"/>
+ </entity>
+ <elements>
+ <element name="Tweet" positionX="421" positionY="-27" width="128" height="120"/>
+ <element name="User" positionX="-18" positionY="63" width="128" height="105"/>
+ </elements>
+</model>
View
36 FJImporter/Prefix.pch
@@ -0,0 +1,36 @@
+//
+// Prefix header for all source files of the 'FJImporter' target in the 'FJImporter' project
+//
+
+#ifdef DEBUG
+ #define MCRelease(x) [x release]
+ #define DLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
+ #define ALog(...) {NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__]);[[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__];}
+#else
+ #define MCRelease(x) [x release], x = nil
+ #define DLog(...) do { } while (0)
+ #ifndef NS_BLOCK_ASSERTIONS
+ #define NS_BLOCK_ASSERTIONS
+ #endif
+ #define ALog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
+#endif
+
+#define ZAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0)
+
+#define ISRETINADISPLAY (([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) ? [[UIScreen mainScreen] scale] > 1.0 : NO)
+
+#define degreesToRadians(x) (M_PI * x / 180.0)
+
+#import <Availability.h>
+
+#ifndef __IPHONE_3_0
+#warning "This project uses features only available in iOS SDK 3.0 and later."
+#endif
+
+#ifdef __OBJC__
+ #import <UIKit/UIKit.h>
+ #import <Foundation/Foundation.h>
+ #import <CoreData/CoreData.h>
+#endif
+
+#define kCellIdentifier @"kCellIdentifier"
View
50 FJImporter/YAJL-1.0.9/NSBundle+YAJL.h
@@ -0,0 +1,50 @@
+//
+// NSBundle+YAJL.h
+// YAJL
+//
+// Created by Gabriel Handford on 7/23/09.
+// Copyright 2009. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#import "YAJLParser.h"
+
+@interface NSBundle (YAJL)
+
+/*!
+ Load JSON from bundle.
+ Throws an YAJLParserException on parse error.
+ @param resource Resource name with extension, for example, file.json
+ */
+- (id)yajl_JSONFromResource:(NSString *)resource;
+
+/*!
+ Load JSON from bundle.
+ @param resource Resource name with extension, for example, file.json
+ @param options Parser options
+ @param error Out error
+ @result JSON value (NSArray, NSDictionary) or nil if errored
+ */
+- (id)yajl_JSONFromResource:(NSString *)resource options:(YAJLParserOptions)options error:(NSError **)error;
+
+@end
View
118 FJImporter/YAJL-1.0.9/NSObject+YAJL.h
@@ -0,0 +1,118 @@
+//
+// NSObject+YAJL.h
+// YAJL
+//
+// Created by Gabriel Handford on 7/23/09.
+// Copyright 2009. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#import "YAJLGen.h"
+#import "YAJLParser.h"
+
+@interface NSObject (YAJL)
+
+#pragma mark Gen
+
+/*!
+ Create JSON string from object.
+ Supported objects include: NSArray, NSDictionary, NSNumber, NSString, NSNull
+ To override JSON value to encode (or support custom objects), implement (id)JSON; See YAJLCoding in YAJLGen.h
+ Otherwise throws YAJLGenInvalidObjectException.
+ @result JSON String
+ */
+- (NSString *)yajl_JSONString;
+
+/*!
+ Create JSON string from object.
+ Supported objects include: NSArray, NSDictionary, NSNumber, NSString, NSNull
+ To override JSON value to encode (or support custom objects), implement (id)JSON; See YAJLCoding in YAJLGen.h
+ Otherwise throws YAJLGenInvalidObjectException.
+ @param options
+ @param indentString
+ @result JSON String
+ */
+- (NSString *)yajl_JSONStringWithOptions:(YAJLGenOptions)options indentString:(NSString *)indentString;
+
+
+#pragma mark Parsing
+
+/*!
+ Parse JSON (NSString or NSData or dataUsingEncoding:).
+ @result JSON object
+ @throws YAJLParserException If a parse error occured
+ @throws YAJLParsingUnsupportedException If not NSData or doesn't respond to dataUsingEncoding:
+
+ @code
+ NSString *JSONString = @"{'foo':['bar', true]}";
+ id JSONValue = [JSONString yajl_JSON];
+
+ NSData *JSONData = ...;
+ id JSONValue = [JSONData yajl_JSON];
+ @endcode
+ */
+- (id)yajl_JSON;
+
+/*!
+ Parse JSON (NSString or NSData or dataUsingEncoding:) with out error.
+
+ If an error occurs, the returned object will be the current state of the object when
+ the error occurred.
+
+ @param error Error to set if we failed to parse
+ @result JSON object
+ @throws YAJLParserException If a parse error occured
+ @throws YAJLParsingUnsupportedException If not NSData or doesn't respond to dataUsingEncoding:
+
+ @code
+ NSString *JSONString = @"{'foo':['bar', true]}";
+ NSError *error = nil;
+ [JSONString yajl_JSON:error];
+ if (error) ...;
+ @endcode
+ */
+- (id)yajl_JSON:(NSError **)error;
+
+/*!
+ Parse JSON (NSString or NSData or dataUsingEncoding:) with options and out error.
+
+ If an error occurs, the returned object will be the current state of the object when
+ the error occurred.
+
+ @param options Options (see YAJLParserOptions)
+ @param error Error to set if we failed to parse
+ @result JSON object
+ @throws YAJLParserException If a parse error occured
+ @throws YAJLParsingUnsupportedException If not NSData or doesn't respond to dataUsingEncoding:
+
+ @code
+ NSString *JSONString = @"{'foo':['bar', true]} // comment";
+ NSError *error = nil;
+ [JSONString yajl_JSONWithOptions:YAJLParserOptionsAllowComments error:error];
+ if (error) ...;
+ @endcode
+ */
+- (id)yajl_JSONWithOptions:(YAJLParserOptions)options error:(NSError **)error;
+
+@end
+
View
98 FJImporter/YAJL-1.0.9/YAJLDocument.h
@@ -0,0 +1,98 @@
+//
+// YAJLDecoder.h
+// YAJL
+//
+// Created by Gabriel Handford on 3/1/09.
+// Copyright 2009. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+#include "YAJLParser.h"
+
+typedef enum {
+ YAJLDecoderCurrentTypeNone,
+ YAJLDecoderCurrentTypeArray,
+ YAJLDecoderCurrentTypeDict
+} YAJLDecoderCurrentType;
+
+extern NSInteger YAJLDocumentStackCapacity;
+
+@class YAJLDocument;
+
+@protocol YAJLDocumentDelegate <NSObject>
+@optional
+- (void)document:(YAJLDocument *)document didAddDictionary:(NSDictionary *)dict;
+- (void)document:(YAJLDocument *)document didAddArray:(NSArray *)array;
+- (void)document:(YAJLDocument *)document didAddObject:(id)object toArray:(NSArray *)array;
+- (void)document:(YAJLDocument *)document didSetObject:(id)object forKey:(id)key inDictionary:(NSDictionary *)dict;
+@end
+
+@interface YAJLDocument : NSObject <YAJLParserDelegate> {
+
+ id root_; // NSArray or NSDictionary
+ YAJLParser *parser_;
+
+ // TODO(gabe): This should be __weak
+ id<YAJLDocumentDelegate> delegate_;
+
+ __weak NSMutableDictionary *dict_; // weak; if map in progress, points to the current map
+ __weak NSMutableArray *array_; // weak; If array in progress, points the current array
+ __weak NSString *key_; // weak; If map in progress, points to current key
+
+ NSMutableArray *stack_;
+ NSMutableArray *keyStack_;
+
+ YAJLDecoderCurrentType currentType_;
+
+ YAJLParserStatus parserStatus_;
+
+}
+
+@property (readonly, nonatomic) id root; //! Root element
+@property (readonly, nonatomic) YAJLParserStatus parserStatus;
+@property (assign, nonatomic) id<YAJLDocumentDelegate> delegate;
+
+/*!
+ Create document from data.
+ @param data Data to parse
+ @param parserOptions Parse options
+ @param error Error to set on failure
+ */
+- (id)initWithData:(NSData *)data parserOptions:(YAJLParserOptions)parserOptions error:(NSError **)error;
+
+/*!
+ Create empty document with parser options.
+ @param parserOptions Parse options
+ */
+- (id)initWithParserOptions:(YAJLParserOptions)parserOptions;
+
+/*!
+ Parse data.
+ @param data Data to parse
+ @param error Error to set on failure
+ @result Parser status
+ */
+- (YAJLParserStatus)parse:(NSData *)data error:(NSError **)error;
+
+@end
View
104 FJImporter/YAJL-1.0.9/YAJLGen.h
@@ -0,0 +1,104 @@
+//
+// YAJLGen.h
+// YAJL
+//
+// Created by Gabriel Handford on 7/19/09.
+// Copyright 2009. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#include "yajl_gen.h"
+
+extern NSString *const YAJLGenInvalidObjectException;
+
+/*!
+ @enum Generate options
+ @constant YAJLGenOptionsBeautify
+ */
+enum {
+ YAJLGenOptionsNone = 0,
+ YAJLGenOptionsBeautify = 1 << 0,
+ YAJLGenOptionsIgnoreUnknownTypes = 1 << 1, // Ignore unknown types (will use null value)
+ YAJLGenOptionsIncludeUnsupportedTypes = 1 << 2, // Handle non-JSON types (including NSDate, NSData, NSURL)
+};
+typedef NSUInteger YAJLGenOptions;
+
+/*!
+ YAJL JSON string generator.
+ Supports the following types:
+ - NSArray
+ - NSDictionary
+ - NSString
+ - NSNumber
+ - NSNull
+
+ We also support the following types (if using YAJLGenOptionsIncludeUnsupportedTypes option),
+ by converting to JSON supported types:
+ - NSDate -> number representing number of milliseconds since (1970) epoch
+ - NSData -> Base64 encoded string
+ - NSURL -> URL (absolute) string
+ */
+@interface YAJLGen : NSObject {
+ yajl_gen gen_;
+
+ YAJLGenOptions genOptions_;
+}
+
+- (id)initWithGenOptions:(YAJLGenOptions)genOptions indentString:(NSString *)indentString;
+
+- (void)object:(id)obj;
+
+- (void)null;
+
+- (void)bool:(BOOL)b;
+
+- (void)number:(NSNumber *)number;
+
+- (void)string:(NSString *)s;
+
+- (void)startDictionary;
+- (void)endDictionary;
+
+- (void)startArray;
+
+- (void)endArray;
+
+- (void)clear;
+
+- (NSString *)buffer;
+
+@end
+
+
+/*!
+ Custom objects can support manual JSON encoding.
+ */
+@protocol YAJLCoding <NSObject>
+
+/*!
+ Provide custom and/or encodable object to parse to JSON string.
+ @result Object encodable as JSON such as NSDictionary, NSArray, etc
+ */
+- (id)JSON;
+
+@end
View
34 FJImporter/YAJL-1.0.9/YAJLIOS.h
@@ -0,0 +1,34 @@
+//
+// YAJL.h
+// YAJL
+//
+// Created by Gabriel Handford on 7/23/09.
+// Copyright 2009. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#import "YAJLParser.h"
+#import "YAJLDocument.h"
+#import "YAJLGen.h"
+#import "NSObject+YAJL.h"
+#import "NSBundle+YAJL.h"
View
129 FJImporter/YAJL-1.0.9/YAJLParser.h
@@ -0,0 +1,129 @@
+//
+// YAJLParser.h
+// YAJL
+//
+// Created by Gabriel Handford on 6/14/09.
+// Copyright 2009. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person
+// obtaining a copy of this software and associated documentation
+// files (the "Software"), to deal in the Software without
+// restriction, including without limitation the rights to use,
+// copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following
+// conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+// OTHER DEALINGS IN THE SOFTWARE.
+//
+
+
+#include "yajl_parse.h"
+
+
+extern NSString *const YAJLErrorDomain;
+extern NSString *const YAJLParserException;
+extern NSString *const YAJLParsingUnsupportedException;
+
+extern NSString *const YAJLParserValueKey; // Key in NSError userInfo for value we errored on
+
+#ifdef DEBUG
+#define YAJLDebug(...) NSLog(__VA_ARGS__)
+#else
+#define YAJLDebug(...) do {} while(0)
+#endif
+
+typedef enum {
+ YAJLParserErrorCodeAllocError = -1000,
+ YAJLParserErrorCodeDoubleOverflow = -1001,
+ YAJLParserErrorCodeIntegerOverflow = -1002
+} YAJLParserErrorCode;
+
+/*!
+ @enum Parser options
+ @constant YAJLParserOptionsAllowComments Javascript style comments will be allowed in the input (both /&asterisk; &asterisk;/ and //)
+ @constant YAJLParserOptionsCheckUTF8 Invalid UTF8 strings will cause a parse error
+ */
+enum {
+ YAJLParserOptionsNone = 0,
+ YAJLParserOptionsAllowComments = 1 << 0, // Allows comments in JSON
+ YAJLParserOptionsCheckUTF8 = 1 << 1, // If YES will verify UTF-8
+ YAJLParserOptionsStrictPrecision = 1 << 2, // If YES will force strict precision and return integer overflow error
+};
+typedef NSUInteger YAJLParserOptions;
+
+enum {
+ YAJLParserStatusNone = 0,
+ YAJLParserStatusOK = 1,
+ YAJLParserStatusInsufficientData = 2,
+ YAJLParserStatusError = 3
+};
+typedef NSUInteger YAJLParserStatus;
+
+
+@class YAJLParser;
+
+
+@protocol YAJLParserDelegate <NSObject>
+
+- (void)parserDidStartDictionary:(YAJLParser *)parser;
+- (void)parserDidEndDictionary:(YAJLParser *)parser;
+
+- (void)parserDidStartArray:(YAJLParser *)parser;
+- (void)parserDidEndArray:(YAJLParser *)parser;
+
+- (void)parser:(YAJLParser *)parser didMapKey:(NSString *)key;
+
+/*!
+ Did add value.
+ @param parser Sender
+ @param value Value of type NSNull, NSString or NSNumber
+ */
+- (void)parser:(YAJLParser *)parser didAdd:(id)value;
+
+@end
+
+
+@interface YAJLParser : NSObject {
+
+ yajl_handle handle_;
+
+ __weak id <YAJLParserDelegate> delegate_; // weak
+
+ YAJLParserOptions parserOptions_;
+
+ NSError *parserError_;
+}
+
+@property (assign, nonatomic) __weak id <YAJLParserDelegate> delegate;
+@property (readonly, retain, nonatomic) NSError *parserError;
+@property (readonly, nonatomic) YAJLParserOptions parserOptions;
+
+/*!
+ Create parser with data and options.
+ @param parserOptions
+ */
+- (id)initWithParserOptions:(YAJLParserOptions)parserOptions;
+
+/*!
+ Parse data.
+
+ If streaming, you can call parse multiple times as long as
+ previous calls return YAJLParserStatusInsufficientData.
+
+ @param data
+ @result See YAJLParserStatus
+ */
+- (YAJLParserStatus)parse:(NSData *)data;
+
+@end
View
BIN FJImporter/YAJL-1.0.9/libYAJLiOS.a
Binary file not shown.
View
85 FJImporter/YAJL-1.0.9/yajl_common.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2010, Lloyd Hilaiel.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. Neither the name of Lloyd Hilaiel nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __YAJL_COMMON_H__
+#define __YAJL_COMMON_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define YAJL_MAX_DEPTH 128
+
+/* msft dll export gunk. To build a DLL on windows, you
+ * must define WIN32, YAJL_SHARED, and YAJL_BUILD. To use a shared
+ * DLL, you must define YAJL_SHARED and WIN32 */
+#if defined(WIN32) && defined(YAJL_SHARED)
+# ifdef YAJL_BUILD
+# define YAJL_API __declspec(dllexport)
+# else
+# define YAJL_API __declspec(dllimport)
+# endif
+#else
+# define YAJL_API
+#endif
+
+/** pointer to a malloc function, supporting client overriding memory
+ * allocation routines */
+typedef void * (*yajl_malloc_func)(void *ctx, unsigned int sz);
+
+/** pointer to a free function, supporting client overriding memory
+ * allocation routines */
+typedef void (*yajl_free_func)(void *ctx, void * ptr);
+
+/** pointer to a realloc function which can resize an allocation. */
+typedef void * (*yajl_realloc_func)(void *ctx, void * ptr, unsigned int sz);
+
+/** A structure which can be passed to yajl_*_alloc routines to allow the
+ * client to specify memory allocation functions to be used. */
+typedef struct
+{
+ /** pointer to a function that can allocate uninitialized memory */
+ yajl_malloc_func malloc;
+ /** pointer to a function that can resize memory allocations */
+ yajl_realloc_func realloc;
+ /** pointer to a function that can free memory allocated using
+ * reallocFunction or mallocFunction */
+ yajl_free_func free;
+ /** a context pointer that will be passed to above allocation routines */
+ void * ctx;
+} yajl_alloc_funcs;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
View
159 FJImporter/YAJL-1.0.9/yajl_gen.h
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2010, Lloyd Hilaiel.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. Neither the name of Lloyd Hilaiel nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file yajl_gen.h
+ * Interface to YAJL's JSON generation facilities.
+ */
+
+#include "yajl_common.h"
+
+#ifndef __YAJL_GEN_H__
+#define __YAJL_GEN_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ /** generator status codes */
+ typedef enum {
+ /** no error */
+ yajl_gen_status_ok = 0,
+ /** at a point where a map key is generated, a function other than
+ * yajl_gen_string was called */
+ yajl_gen_keys_must_be_strings,
+ /** YAJL's maximum generation depth was exceeded. see
+ * YAJL_MAX_DEPTH */
+ yajl_max_depth_exceeded,
+ /** A generator function (yajl_gen_XXX) was called while in an error
+ * state */
+ yajl_gen_in_error_state,
+ /** A complete JSON document has been generated */
+ yajl_gen_generation_complete,
+ /** yajl_gen_double was passed an invalid floating point value
+ * (infinity or NaN). */
+ yajl_gen_invalid_number,
+ /** A print callback was passed in, so there is no internal
+ * buffer to get from */
+ yajl_gen_no_buf
+ } yajl_gen_status;
+
+ /** an opaque handle to a generator */
+ typedef struct yajl_gen_t * yajl_gen;
+
+ /** a callback used for "printing" the results. */
+ typedef void (*yajl_print_t)(void * ctx,
+ const char * str,
+ unsigned int len);
+
+ /** configuration structure for the generator */
+ typedef struct {
+ /** generate indented (beautiful) output */
+ unsigned int beautify;
+ /** an opportunity to define an indent string. such as \\t or
+ * some number of spaces. default is four spaces ' '. This
+ * member is only relevant when beautify is true */
+ const char * indentString;
+ } yajl_gen_config;
+
+ /** allocate a generator handle
+ * \param config a pointer to a structure containing parameters which
+ * configure the behavior of the json generator
+ * \param allocFuncs an optional pointer to a structure which allows
+ * the client to overide the memory allocation
+ * used by yajl. May be NULL, in which case
+ * malloc/free/realloc will be used.
+ *
+ * \returns an allocated handle on success, NULL on failure (bad params)
+ */
+ YAJL_API yajl_gen yajl_gen_alloc(const yajl_gen_config * config,
+ const yajl_alloc_funcs * allocFuncs);
+
+ /** allocate a generator handle that will print to the specified
+ * callback rather than storing the results in an internal buffer.
+ * \param callback a pointer to a printer function. May be NULL
+ * in which case, the results will be store in an
+ * internal buffer.
+ * \param config a pointer to a structure containing parameters
+ * which configure the behavior of the json
+ * generator.
+ * \param allocFuncs an optional pointer to a structure which allows
+ * the client to overide the memory allocation
+ * used by yajl. May be NULL, in which case
+ * malloc/free/realloc will be used.
+ * \param ctx a context pointer that will be passed to the
+ * printer callback.
+ *
+ * \returns an allocated handle on success, NULL on failure (bad params)
+ */
+ YAJL_API yajl_gen yajl_gen_alloc2(const yajl_print_t callback,
+ const yajl_gen_config * config,
+ const yajl_alloc_funcs * allocFuncs,
+ void * ctx);
+
+ /** free a generator handle */
+ YAJL_API void yajl_gen_free(yajl_gen handle);
+
+ YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long int number);
+ /** generate a floating point number. number may not be infinity or
+ * NaN, as these have no representation in JSON. In these cases the
+ * generator will return 'yajl_gen_invalid_number' */
+ YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number);
+ YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand,
+ const char * num,
+ unsigned int len);
+ YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand,
+ const unsigned char * str,
+ unsigned int len);
+ YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand);
+ YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean);
+ YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand);
+ YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand);
+ YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand);
+ YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand);
+
+ /** access the null terminated generator buffer. If incrementally
+ * outputing JSON, one should call yajl_gen_clear to clear the
+ * buffer. This allows stream generation. */
+ YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand,
+ const unsigned char ** buf,
+ unsigned int * len);
+
+ /** clear yajl's output buffer, but maintain all internal generation
+ * state. This function will not "reset" the generator state, and is
+ * intended to enable incremental JSON outputing. */
+ YAJL_API void yajl_gen_clear(yajl_gen hand);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
View
193 FJImporter/YAJL-1.0.9/yajl_parse.h
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2010, Lloyd Hilaiel.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. Neither the name of Lloyd Hilaiel nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,