-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLKInclude.pch
More file actions
21 lines (16 loc) · 962 Bytes
/
LKInclude.pch
File metadata and controls
21 lines (16 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//
// LKInclude.h
// LKKit
//
// Created by Scott Little on 20/09/2011.
// Copyright 2011 Little Known Software. All rights reserved.
//
#ifdef DEBUG
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__]
#else
#define ALog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__])
#endif
// Assertion that will simply log in Production code
#define LKAssert(condition, ...) do { if (!(condition)) { ALog(__VA_ARGS__); }} while(0)
// Simple way to test most objects for emptyness
static inline BOOL IsEmpty(id thing) { return thing == nil || ([thing respondsToSelector:@selector(length)] && [(NSData *)thing length] == 0) || ([thing respondsToSelector:@selector(count)] && [(NSArray *)thing count] == 0); }