Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
561ea58
取消强制小写规范
ilikeido Jan 30, 2013
5559b2d
修正DBbug
ilikeido Jan 30, 2013
8c2ee8f
fix for StaticLibrary's header files when it been used in ARC
gelosie Jan 29, 2013
351c2ba
Update StaticLibrary/StaticLibrary.xcodeproj/project.pbxproj
Yulong Jan 30, 2013
88524bf
fix UIGridCell bug
ilikeido Jan 30, 2013
6486de8
reset
ilikeido Jan 30, 2013
e643fc8
fix
ilikeido Jan 30, 2013
078377a
Revert "取消强制小写规范"
ilikeido Jan 30, 2013
fcf6333
Revert "Revert "取消强制小写规范""
ilikeido Jan 30, 2013
c06af5d
Revert "reset"
ilikeido Jan 30, 2013
aada24f
Revert "Revert "reset""
ilikeido Jan 30, 2013
b76d6ba
Revert "Revert "Revert "reset"""
ilikeido Jan 30, 2013
3a25627
Revert "Revert "Revert "Revert "reset""""
ilikeido Jan 30, 2013
7d0ad53
Revert "Revert "Revert "Revert "Revert "reset"""""
ilikeido Jan 30, 2013
4fbdc11
reset old
ilikeido Jan 30, 2013
1fe44e6
添加__BOOL方法
ilikeido Jan 31, 2013
dbc890a
添加两个数据快捷方法
ilikeido Jan 31, 2013
9e73ab3
UIStack add groupBard property
ilikeido Jan 31, 2013
c351657
fix bug
ilikeido Jan 31, 2013
d221141
post请求新增带参数方法
ilikeido Feb 1, 2013
81fd39c
新增BeeUIPickerView类
ilikeido Feb 1, 2013
26cd026
添加是否iphone5标识
ilikeido Feb 5, 2013
ec62320
修正在有baseInsets情况下表格和搜索框位置的bug
ilikeido Feb 5, 2013
d2f7904
添加左右LIKE方法
ilikeido Feb 6, 2013
a7d8b79
添加左右LIKE方法
ilikeido Feb 6, 2013
a23c6ff
添加NSDictionary转化为NSObject的方法,支持属性为自定义类型
ilikeido Feb 6, 2013
f6d56e8
添加iphone5判断
ilikeido Feb 6, 2013
b71ad6d
添加NSDictionary转NSObject方法,支持自定义类型
ilikeido Feb 6, 2013
d820a45
添加__BOOL方法
ilikeido Feb 6, 2013
dd99082
BeeMessage 中post方式添加参数
ilikeido Feb 6, 2013
696ef8c
添加两个即时返回数据并后台保存数据库的操作方法
ilikeido Feb 6, 2013
626ce62
添加BeeDatabase中添加左右like方法
ilikeido Feb 6, 2013
434d8a9
添加Bee_UIPickerView.h支持
ilikeido Feb 6, 2013
83e1fe0
修正BeeUITableBoard在设置间距时位置错误的bug
ilikeido Feb 6, 2013
93eca45
UIStack添加父UIStackGroup的实例
ilikeido Feb 6, 2013
9e16e20
为NSDictionary+BeeExtension 中NSDictionary 2 NSObject 方法添加引用文件
ilikeido Feb 6, 2013
d71c954
修改设置对齐方式时无效的bug
ilikeido Feb 7, 2013
fcd9412
因为考虑到UIFloaBoard中的情况,回归到原来版本,在动态高度时建议在[_cellLayout layoutInBound:self…
ilikeido Feb 7, 2013
0ec23dd
修改一处可能发生的内存泄漏
ilikeido Feb 7, 2013
8473f2a
BeeRequestQueue添加文件下载操作
ilikeido Feb 7, 2013
8578714
NSObject(BeeRequestResponder)扩展文件下载操作
ilikeido Feb 7, 2013
73ec4c6
修改命名规范
ilikeido Feb 7, 2013
08f49e8
修改命名规范
ilikeido Feb 7, 2013
9aa0331
添加3.5寸屏幕判断
ilikeido Feb 7, 2013
a7d8198
去除recordsWithDictionaryArray和recordsAsynSaveWithArray方法,考虑线程安全部同,相同实现…
ilikeido Feb 7, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions BeeFramework/Core/Foundation/Bee_SystemInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#define IOS5_OR_LATER ( [[[UIDevice currentDevice] systemVersion] compare:@"5.0"] != NSOrderedAscending )
#define IOS4_OR_LATER ( [[[UIDevice currentDevice] systemVersion] compare:@"4.0"] != NSOrderedAscending )
#define IOS3_OR_LATER ( [[[UIDevice currentDevice] systemVersion] compare:@"3.0"] != NSOrderedAscending )
#define IS_SCREEN_4_INCH ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define IS_SCREEN_35_INCH ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define UI_MAX_HEIGHT [UIScreen mainScreen].bounds.size.height
#define UI_MAX_WIDTH [UIScreen mainScreen].bounds.size.width

@interface BeeSystemInfo : NSObject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,12 @@ typedef NSDictionary * (^NSDictionaryAppendBlock)( NSString * key, id value );
- (NSMutableDictionary *)mutableDictAtPath:(NSString *)path;
- (NSMutableDictionary *)mutableDictAtPath:(NSString *)path otherwise:(NSMutableDictionary *)other;

-(id)convertForClass:(Class)clazz;


@end


#pragma mark -

@interface NSMutableDictionary(BeeExtension)
Expand Down
63 changes: 63 additions & 0 deletions BeeFramework/Core/Foundation/Extension/NSDictionary+BeeExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@

#import "Bee_Precompile.h"
#import "NSDictionary+BeeExtension.h"
#import "Bee_Runtime.h"
#import "NSObject+BeeTypeConversion.h"

#include <objc/runtime.h>

Expand Down Expand Up @@ -277,8 +279,69 @@ - (NSMutableDictionary *)mutableDictAtPath:(NSString *)path otherwise:(NSMutable
return obj ? obj : other;
}

-(id)convertForClass:(Class)clazz{
id object = [[clazz alloc] init];

NSUInteger propertyCount = 0;
objc_property_t * properties = class_copyPropertyList( clazz, &propertyCount );

for ( NSUInteger i = 0; i < propertyCount; i++ )
{
const char * name = property_getName(properties[i]);
NSString * propertyName = [NSString stringWithCString:name encoding:NSUTF8StringEncoding];
const char * attr = property_getAttributes(properties[i]);
NSUInteger type = [BeeTypeEncoding typeOf:attr];

NSObject * tempvalue = [self objectForKey:propertyName];

NSObject *value = nil;
if (tempvalue) {
if ( BeeTypeEncoding.NSNUMBER == type )
{
value = [tempvalue asNSNumber];
}
else if ( BeeTypeEncoding.NSSTRING == type )
{
value = [tempvalue asNSString];
}
else if ( BeeTypeEncoding.NSDATE == type )
{
value = [tempvalue asNSDate];
}
else if ( BeeTypeEncoding.NSARRAY == type )
{
if ([tempvalue isKindOfClass:[NSArray class]]) {
value = tempvalue;
}
}
else if ( BeeTypeEncoding.NSDICTIONARY == type )
{
if ([tempvalue isKindOfClass:[NSDictionary class]]) {
value = tempvalue;
}
}
else if ( BeeTypeEncoding.OBJECT == type )
{
NSString *className = [BeeTypeEncoding classNameOf:attr];
if ([tempvalue isKindOfClass:NSClassFromString(className)]) {
value = tempvalue;
}else if ([tempvalue isKindOfClass:[NSDictionary class]]) {
value = [(NSDictionary *)tempvalue convertForClass:NSClassFromString(className)];
}

}

}

[object setValue:value forKey:propertyName];
}
free( properties );
return [object autorelease];
}

@end


#pragma mark -

@implementation NSMutableDictionary(BeeExtension)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define __UINT( __x ) [NSNumber numberWithUnsignedInt:(NSUInteger)__x]
#define __FLOAT( __x ) [NSNumber numberWithFloat:(float)__x]
#define __DOUBLE( __x ) [NSNumber numberWithDouble:(double)__x]

#define __BOOL( __x ) [NSNumber numberWithBool:(BOOL)__x]
#pragma mark -

@interface NSNumber(BeeExtension)
Expand Down
3 changes: 3 additions & 0 deletions BeeFramework/Core/Network/Bee_RequestQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@

+ (BeeRequest *)GET:(NSString *)url;
+ (BeeRequest *)POST:(NSString *)url;
+ (BeeRequest *)POST:(NSString *)url postdata:(NSDictionary *)postdata;

- (BeeRequest *)FILE:(NSString *)url savepath:(NSString *)savepath allowResume:(BOOL)allowResume sync:(BOOL)sync;

+ (BOOL)requesting:(NSString *)url;
+ (BOOL)requesting:(NSString *)url byResponder:(id)responder;
Expand Down
90 changes: 88 additions & 2 deletions BeeFramework/Core/Network/Bee_RequestQueue.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ - (BOOL)checkResourceBroken:(NSString *)url;

- (BeeRequest *)GET:(NSString *)url sync:(BOOL)sync;
- (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync;
- (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync postdata:(NSDictionary *)postdata;

- (void)cancelRequest:(BeeRequest *)request;
- (void)cancelRequestByResponder:(id)responder;
Expand Down Expand Up @@ -204,6 +205,76 @@ + (BeeRequest *)GET:(NSString *)url
return [[BeeRequestQueue sharedInstance] GET:url sync:NO];
}

+ (BeeRequest *)FILE:(NSString *)url savepath:(NSString *)savepath allowResume:(BOOL)allowResume sync:(BOOL)sync{
return [[BeeRequestQueue sharedInstance] FILE:url savepath:savepath allowResume:allowResume sync:sync];
}

- (BeeRequest *)FILE:(NSString *)url savepath:(NSString *)savepath allowResume:(BOOL)allowResume sync:(BOOL)sync {
if ( NO == _online )
return nil;

if ( [self checkResourceBroken:url] )
{
return nil;
}

BeeRequest * request = nil;
if ( NO == sync && _merge )
{
for ( BeeRequest * req in _requests )
{
if ( [req.url.absoluteString isEqualToString:url] )
{
return req;
}
}
}

#if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__
CC( @"GET %@\n", url );
#endif // #if defined(__BEE_DEVELOPMENT__) && __BEE_DEVELOPMENT__

request = [[BeeRequest alloc] initWithURL:[NSURL URLWithString:url]];
[request setDelegate:self];
[request setDownloadProgressDelegate:self];
[request setShowAccurateProgress:YES];
[request setDownloadDestinationPath:savepath];
[request setAllowResumeForFileDownloads:YES];
[request setNumberOfTimesToRetryOnTimeout:4];
#if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
[request setShouldContinueWhenAppEntersBackground:YES];
#endif // #if TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0
[request setThreadPriority:0.5];
[request setQueuePriority:NSOperationQueuePriorityLow];

[_requests addObject:request];

if ( self.whenCreate )
{
self.whenCreate( request );
}
if ( sync )
{
[request startSynchronous];
}
else
{
if ( _delay )
{
[request performSelector:@selector(startAsynchronous)
withObject:nil
afterDelay:_delay];
}
else
{
[request startAsynchronous];
}
}
return [request autorelease];
}



- (BeeRequest *)GET:(NSString *)url sync:(BOOL)sync
{
if ( NO == _online )
Expand Down Expand Up @@ -280,7 +351,16 @@ + (BeeRequest *)POST:(NSString *)url
return [[BeeRequestQueue sharedInstance] POST:url sync:NO];
}

- (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync
+ (BeeRequest *)POST:(NSString *)url postdata:(NSDictionary *)postdata
{
return [[BeeRequestQueue sharedInstance] POST:url sync:NO postdata:postdata];
}

- (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync{
return [self POST:url sync:sync postdata:nil];
}

- (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync postdata:(NSDictionary *)postdata
{
if ( NO == _online )
return nil;
Expand All @@ -294,7 +374,7 @@ - (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync
request = [[BeeRequest alloc] initWithURL:[NSURL URLWithString:url]];
request.timeOutSeconds = DEFAULT_POST_TIMEOUT;
request.requestMethod = @"POST";
request.postFormat = ASIMultipartFormDataPostFormat; // ASIRawPostFormat;
//request.postFormat = ASIMultipartFormDataPostFormat; // ASIRawPostFormat;
[request setDelegate:self];
[request setDownloadProgressDelegate:self];
[request setUploadProgressDelegate:self];
Expand All @@ -305,6 +385,12 @@ - (BeeRequest *)POST:(NSString *)url sync:(BOOL)sync

[request setThreadPriority:1.0];
[request setQueuePriority:NSOperationQueuePriorityHigh];

if (postdata && [postdata count]>0) {
for (NSString * key in postdata.allKeys) {
[request addPostValue:[postdata objectForKey:key] forKey:key];
}
}

[_requests addObject:request];

Expand Down
2 changes: 2 additions & 0 deletions BeeFramework/Core/Network/Extension/NSObject+BeeRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@

- (BeeRequest *)HTTP_GET:(NSString *)url;
- (BeeRequest *)HTTP_POST:(NSString *)url;
- (BeeRequest *)HTTP_POST:(NSString *)url postdata:(NSDictionary *)postdata;
- (BeeRequest *)FILE:(NSString *)url savepath:(NSString *)savepath allowResume:(BOOL)allowResume sync:(BOOL)sync;

- (BOOL)isRequestResponder;
- (BOOL)requestingURL;
Expand Down
14 changes: 14 additions & 0 deletions BeeFramework/Core/Network/Extension/NSObject+BeeRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ - (BeeRequest *)HTTP_POST:(NSString *)url
return req;
}

- (BeeRequest *)HTTP_POST:(NSString *)url postdata:(NSDictionary *)postdata
{
BeeRequest * req = [BeeRequestQueue POST:url postdata:postdata];
[req addResponder:self];
return req;
}


- (BeeRequest *)FILE:(NSString *)url savepath:(NSString *)savepath allowResume:(BOOL)allowResume sync:(BOOL)sync{
BeeRequest * req = [BeeRequestQueue FILE:url savepath:savepath allowResume:allowResume sync:sync];
[req addResponder:self];
return req;
}

- (BOOL)isRequestResponder
{
if ( [self respondsToSelector:@selector(handleRequest:)] )
Expand Down
10 changes: 10 additions & 0 deletions BeeFramework/Core/Storage/Bee_Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,16 @@ typedef BOOL (^BeeDatabaseBoolBlock)( void );
@property (nonatomic, readonly) BeeDatabaseBlockN OR_LIKE;
@property (nonatomic, readonly) BeeDatabaseBlockN OR_NOT_LIKE;

@property (nonatomic, readonly) BeeDatabaseBlockN LIKE_BEFORE;
@property (nonatomic, readonly) BeeDatabaseBlockN NOT_LIKE_BEFORE;
@property (nonatomic, readonly) BeeDatabaseBlockN OR_LIKE_BEFORE;
@property (nonatomic, readonly) BeeDatabaseBlockN OR_NOT_LIKE_BEFORE;

@property (nonatomic, readonly) BeeDatabaseBlockN LIKE_AFTER;
@property (nonatomic, readonly) BeeDatabaseBlockN NOT_LIKE_AFTER;
@property (nonatomic, readonly) BeeDatabaseBlockN OR_LIKE_AFTER;
@property (nonatomic, readonly) BeeDatabaseBlockN OR_NOT_LIKE_AFTER;

@property (nonatomic, readonly) BeeDatabaseBlockN GROUP_BY;

@property (nonatomic, readonly) BeeDatabaseBlockN HAVING;
Expand Down
Loading