Skip to content

Commit 22ded41

Browse files
committed
Merge branch 'development-xc6'
DDGPreferences v1.2.0 (003)
2 parents e95c5c1 + 6797403 commit 22ded41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+826
-1591
lines changed

DDGMacros/DDGMacros.h

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// DDG Library
44
//
55
// Created by Andrew Donoho on 2009/05/20.
6-
// Copyright 2009-2012 Donoho Design Group, L.L.C. All rights reserved.
6+
// Copyright 2009-2014 Donoho Design Group, L.L.C. All rights reserved.
77
//
88

99
/*
@@ -12,7 +12,7 @@
1212
personalizations.
1313
<http://www.opensource.org/licenses/bsd-license.php>
1414
15-
Copyright (C) 2009-2012 Donoho Design Group, LLC. All Rights Reserved.
15+
Copyright (C) 2009-2014 Donoho Design Group, LLC. All Rights Reserved.
1616
1717
Redistribution and use in source and binary forms, with or without
1818
modification, are permitted provided that the following conditions are
@@ -43,6 +43,8 @@
4343
4444
*/
4545

46+
@import UIKit;
47+
4648
// Miscellaneous Constants
4749
extern NSString *const kEmptyString;
4850
extern NSString *const kOKButton;
@@ -53,15 +55,22 @@ extern NSString *const kTrue;
5355
extern NSString *const kFalse;
5456
extern const NSTimeInterval kDefaultDuration;
5557

58+
@interface DDGMacros : NSObject
59+
60+
+ (void) logAllNotifications;
61+
62+
@end
63+
64+
#if TARGET_OS_IPHONE
65+
static inline BOOL iPadIdiom(void) { return UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad; };
66+
#endif
5667
//
5768
// Use the below line in your project settings to turn on DEBUG.
5869
// GCC_PREPROCESSOR_DEFINITIONS == DEBUG=1
5970
//
6071
// And put the following in whichever class you need to log:
6172
// #define CLASS_DEBUG 1
6273
// #import "DDGMacros.h"
63-
//
64-
6574
//
6675
// Log the function name and line number using DDGTrace().
6776
// void DDGTrace(void);
@@ -86,6 +95,19 @@ void _DDGDesc(const char *name, int line, id object);
8695
#define DDGDesc(object)
8796
#endif
8897

98+
//
99+
// Log the description, function name and line number.
100+
// This is the same as DDGDesc with the exception that it is always
101+
// available in every class during DEBUG.
102+
// void DDGError(NSError *error);
103+
//
104+
105+
#ifdef DEBUG
106+
#define DDGError(error) (_DDGDesc(__PRETTY_FUNCTION__, __LINE__, (error)))
107+
#else
108+
#define DDGError(error)
109+
#endif
110+
89111
//
90112
// DDGLog() is a parameter identical substitute for NSLog() which also
91113
// logs the function name and line number.
@@ -99,22 +121,6 @@ void _DDGLog(const char *name, int line, NSString *format, ...);
99121
#define DDGLog(format, ...)
100122
#endif
101123

102-
void _logSubviews(const char *name, int line, UIView *parent);
103-
#if (defined DEBUG && defined CLASS_DEBUG)
104-
#define logSubviews(view) (_logSubviews(__PRETTY_FUNCTION__, __LINE__, (view)))
105-
#else
106-
#define logSubviews(view)
107-
#endif
108-
109-
110-
NSUInteger _countSubviews(const char *name, int line, UIView *parent);
111-
#if (defined DEBUG && defined CLASS_DEBUG)
112-
#define countSubviews(view) (_countSubviews(__PRETTY_FUNCTION__, __LINE__, (view)))
113-
#else
114-
#define countSubviews(view)
115-
#endif
116-
117-
118124
// Debugger trap. Set a breakpoint on the implementation.
119125
void _DDGDebugger(const char *name, int line);
120126
#if (defined DEBUG && defined CLASS_DEBUG)

DDGMacros/DDGMacros.m

Lines changed: 65 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// DDG Library
44
//
55
// Created by Andrew Donoho on 2009/05/23.
6-
// Copyright 2009-2012 Donoho Design Group, L.L.C. All rights reserved.
6+
// Copyright 2009-2014 Donoho Design Group, L.L.C. All rights reserved.
77
//
88

99
/*
@@ -12,7 +12,7 @@
1212
personalizations.
1313
<http://www.opensource.org/licenses/bsd-license.php>
1414
15-
Copyright (C) 2009-2012 Donoho Design Group, LLC. All Rights Reserved.
15+
Copyright (C) 2009-2014 Donoho Design Group, LLC. All Rights Reserved.
1616
1717
Redistribution and use in source and binary forms, with or without
1818
modification, are permitted provided that the following conditions are
@@ -43,8 +43,6 @@
4343
4444
*/
4545

46-
#import <Foundation/Foundation.h>
47-
4846
#import "DDGMacros.h"
4947

5048
#ifdef TESTFLIGHT
@@ -67,6 +65,30 @@
6765
NSString *const kFalse = @"false";
6866
const NSTimeInterval kDefaultDuration = 0.25;
6967

68+
@implementation DDGMacros
69+
70+
#define kLog (@selector(log:))
71+
+ (void) log: (NSNotification *) notification {
72+
73+
NSLog(@"Notification Name: %@;\n\tObject: %@;\n\tUserInfo: %@.",
74+
notification.name, notification.object, notification.userInfo);
75+
76+
} // +log:
77+
78+
79+
+ (void) logAllNotifications {
80+
81+
NSNotificationCenter *nc = NSNotificationCenter.defaultCenter;
82+
83+
[nc removeObserver: self];
84+
85+
[nc addObserver: self selector: kLog name: nil object: nil];
86+
87+
} // +logAllNotifications
88+
89+
@end
90+
91+
7092
void _DDGTrace(const char *name, int line) {
7193

7294
NSLog(@"%s (%d)", name, line);
@@ -80,10 +102,7 @@ void _DDGDesc(const char *name, int line, id object) {
80102

81103
NSLog(@"%s (%d)\nDescription: %@", name, line, object);
82104
}
83-
else {
84-
85-
NSLog(@"%s (%d)", name, line);
86-
}
105+
else { NSLog(@"%s (%d)", name, line); }
87106

88107
} // _DDGDesc()
89108

@@ -117,68 +136,6 @@ void _DDGLog(const char *name, int line, NSString *format, ...) {
117136
} // _DDGLog()
118137

119138

120-
void _logViews(UIView *parent);
121-
void _logViews(UIView *parent) {
122-
123-
NSLog(@"\n\tParent Class: %@; Subviews: %d\n---------",
124-
NSStringFromClass(parent.class), parent.subviews.count);
125-
126-
for (UIView *v in parent.subviews) {
127-
128-
NSLog(@"\n\tClass: %@\n\tFrame: %@\n\tBounds: %@",
129-
NSStringFromClass( v.class),
130-
NSStringFromCGRect(v.frame),
131-
NSStringFromCGRect(v.bounds));
132-
133-
_logViews(v); // Print the subviews.
134-
}
135-
136-
} // _logViews()
137-
138-
139-
void _logSubviews(const char *name, int line, UIView *parent) {
140-
141-
NSLog(@"%s (%d)\n", name, line);
142-
if (parent) {
143-
144-
_logViews(parent);
145-
}
146-
147-
} // _logSubviews()
148-
149-
150-
NSUInteger _countViews(UIView *parent);
151-
NSUInteger _countViews(UIView *parent) {
152-
153-
if (parent.subviews.count) {
154-
155-
NSUInteger count = 0;
156-
157-
for (UIView *v in parent.subviews) {
158-
159-
count += _countViews(v);
160-
}
161-
return count;
162-
}
163-
else {
164-
165-
return 1;
166-
}
167-
168-
} // countViews_()
169-
170-
171-
NSUInteger _countSubviews(const char *name, int line, UIView *parent) {
172-
173-
if (parent) {
174-
175-
return _countViews(parent);
176-
}
177-
return 0;
178-
179-
} // _countSubviews()
180-
181-
182139
void _DDGDebugger(const char *name, int line) {
183140

184141
NSLog(@"%s (%d)", name, line);
@@ -190,28 +147,28 @@ uint8_t htoc(char h) {
190147

191148
switch (h) {
192149

193-
case '0': return 0x0; break;
194-
case '1': return 0x1; break;
195-
case '2': return 0x2; break;
196-
case '3': return 0x3; break;
197-
case '4': return 0x4; break;
198-
case '5': return 0x5; break;
199-
case '6': return 0x6; break;
200-
case '7': return 0x7; break;
201-
case '8': return 0x8; break;
202-
case '9': return 0x9; break;
203-
case 'a': return 0xa; break;
204-
case 'b': return 0xb; break;
205-
case 'c': return 0xc; break;
206-
case 'd': return 0xd; break;
207-
case 'e': return 0xe; break;
208-
case 'f': return 0xf; break;
209-
case 'A': return 0xa; break;
210-
case 'B': return 0xb; break;
211-
case 'C': return 0xc; break;
212-
case 'D': return 0xd; break;
213-
case 'E': return 0xe; break;
214-
case 'F': return 0xf; break;
150+
case '0': return 0x0;
151+
case '1': return 0x1;
152+
case '2': return 0x2;
153+
case '3': return 0x3;
154+
case '4': return 0x4;
155+
case '5': return 0x5;
156+
case '6': return 0x6;
157+
case '7': return 0x7;
158+
case '8': return 0x8;
159+
case '9': return 0x9;
160+
case 'a': return 0xa;
161+
case 'b': return 0xb;
162+
case 'c': return 0xc;
163+
case 'd': return 0xd;
164+
case 'e': return 0xe;
165+
case 'f': return 0xf;
166+
case 'A': return 0xa;
167+
case 'B': return 0xb;
168+
case 'C': return 0xc;
169+
case 'D': return 0xd;
170+
case 'E': return 0xe;
171+
case 'F': return 0xf;
215172
default: return 0xff;
216173
}
217174

@@ -222,22 +179,22 @@ char ctoh(uint8_t c) {
222179

223180
switch (c) {
224181

225-
case 0x0: return '0'; break;
226-
case 0x1: return '1'; break;
227-
case 0x2: return '2'; break;
228-
case 0x3: return '3'; break;
229-
case 0x4: return '4'; break;
230-
case 0x5: return '5'; break;
231-
case 0x6: return '6'; break;
232-
case 0x7: return '7'; break;
233-
case 0x8: return '8'; break;
234-
case 0x9: return '9'; break;
235-
case 0xa: return 'a'; break;
236-
case 0xb: return 'b'; break;
237-
case 0xc: return 'c'; break;
238-
case 0xd: return 'd'; break;
239-
case 0xe: return 'e'; break;
240-
case 0xf: return 'f'; break;
182+
case 0x0: return '0';
183+
case 0x1: return '1';
184+
case 0x2: return '2';
185+
case 0x3: return '3';
186+
case 0x4: return '4';
187+
case 0x5: return '5';
188+
case 0x6: return '6';
189+
case 0x7: return '7';
190+
case 0x8: return '8';
191+
case 0x9: return '9';
192+
case 0xa: return 'a';
193+
case 0xb: return 'b';
194+
case 0xc: return 'c';
195+
case 0xd: return 'd';
196+
case 0xe: return 'e';
197+
case 0xf: return 'f';
241198
default: return 0xff;
242199
}
243200

DDGPreferences/DDGCloudPreferences.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// DDGPreferences
44
//
55
// Created by Andrew Donoho on 2012/10/19.
6-
// Copyright (c) 2012 Donoho Design Group, L.L.C. All rights reserved.
6+
// Copyright (c) 2012-2014 Donoho Design Group, L.L.C. All rights reserved.
77
//
88

99
/*
@@ -43,13 +43,13 @@
4343
4444
*/
4545

46-
#import <Foundation/Foundation.h>
46+
@import Foundation;
4747

4848
@class DDGPreferences;
4949

5050
@interface DDGCloudPreferences : NSObject
5151

52-
- (DDGCloudPreferences *) initWithPreferences: (DDGPreferences *) preferences;
52+
- (instancetype) initWithPreferences: (DDGPreferences *) preferences;
5353

5454
- (void) readCloud;
5555
- (void) writeCloud;

0 commit comments

Comments
 (0)