Skip to content

Commit 89cf6ca

Browse files
author
Chaitanya Gupta
committed
Add utils.m and move NSPrintf() there.
1 parent 6a91f1d commit 89cf6ca

File tree

4 files changed

+38
-10
lines changed

4 files changed

+38
-10
lines changed

XCDataModelPrinter.xcodeproj/project.pbxproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
549A79D1156E2F560030310A /* utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 549A79D0156E2F560030310A /* utils.m */; };
1011
54CAE68E155E54D500C956CD /* MOMPrinter.m in Sources */ = {isa = PBXBuildFile; fileRef = 54CAE68D155E54D400C956CD /* MOMPrinter.m */; };
1112
54F505ED1550FC8F00D4A631 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 54F505EC1550FC8F00D4A631 /* Foundation.framework */; };
1213
54F505F01550FC8F00D4A631 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 54F505EF1550FC8F00D4A631 /* main.m */; };
@@ -27,6 +28,8 @@
2728
/* End PBXCopyFilesBuildPhase section */
2829

2930
/* Begin PBXFileReference section */
31+
549A79CF156E2F560030310A /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
32+
549A79D0156E2F560030310A /* utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = utils.m; sourceTree = "<group>"; };
3033
54CAE68C155E54D400C956CD /* MOMPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MOMPrinter.h; sourceTree = "<group>"; };
3134
54CAE68D155E54D400C956CD /* MOMPrinter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MOMPrinter.m; sourceTree = "<group>"; };
3235
54F505E81550FC8F00D4A631 /* XCDataModelPrinter */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = XCDataModelPrinter; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -83,9 +86,11 @@
8386
children = (
8487
54F5060C1551234400D4A631 /* NSData_Base64 */,
8588
54F505EF1550FC8F00D4A631 /* main.m */,
86-
54F505F11550FC8F00D4A631 /* Supporting Files */,
8789
54CAE68C155E54D400C956CD /* MOMPrinter.h */,
8890
54CAE68D155E54D400C956CD /* MOMPrinter.m */,
91+
54F505F11550FC8F00D4A631 /* Supporting Files */,
92+
549A79CF156E2F560030310A /* utils.h */,
93+
549A79D0156E2F560030310A /* utils.m */,
8994
);
9095
path = src;
9196
sourceTree = "<group>";
@@ -160,6 +165,7 @@
160165
54F505F01550FC8F00D4A631 /* main.m in Sources */,
161166
54F5060F1551234400D4A631 /* NSData+Base64.m in Sources */,
162167
54CAE68E155E54D500C956CD /* MOMPrinter.m in Sources */,
168+
549A79D1156E2F560030310A /* utils.m in Sources */,
163169
);
164170
runOnlyForDeploymentPostprocessing = 0;
165171
};

src/MOMPrinter.m

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,10 @@
99
#import "MOMPrinter.h"
1010
#import <CoreData/CoreData.h>
1111
#import "NSData+Base64.h"
12-
12+
#import "utils.h"
1313

1414
@implementation MOMPrinter
1515

16-
void NSPrintf(NSString *fmt, ...) {
17-
va_list args;
18-
va_start(args, fmt);
19-
NSString *outStr = [[[NSString alloc] initWithFormat:fmt arguments:args] autorelease];
20-
printf("%s", [outStr UTF8String]);
21-
va_end(args);
22-
}
23-
2416
NSString *commonFlagsStringForProperty(NSPropertyDescription *property) {
2517
char ochar = [property isOptional] ? 'O' : ' ';
2618
char tchar = [property isTransient] ? 'T' : ' ';

src/utils.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// utils.h
3+
// XCDataModelPrinter
4+
//
5+
// Created by Chaitanya Gupta on 24/05/12.
6+
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
12+
void NSPrintf(NSString *fmt, ...);

src/utils.m

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// utils.m
3+
// XCDataModelPrinter
4+
//
5+
// Created by Chaitanya Gupta on 24/05/12.
6+
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
7+
//
8+
9+
#import "utils.h"
10+
11+
12+
void NSPrintf(NSString *fmt, ...) {
13+
va_list args;
14+
va_start(args, fmt);
15+
NSString *outStr = [[[NSString alloc] initWithFormat:fmt arguments:args] autorelease];
16+
printf("%s", [outStr UTF8String]);
17+
va_end(args);
18+
}

0 commit comments

Comments
 (0)