Skip to content

Commit 2a9c7d4

Browse files
committed
Added Decorator Pattern Example
1 parent 88f4418 commit 2a9c7d4

File tree

24 files changed

+821
-0
lines changed

24 files changed

+821
-0
lines changed
Lines changed: 336 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,336 @@
1+
// !$*UTF8*$!
2+
{
3+
archiveVersion = 1;
4+
classes = {
5+
};
6+
objectVersion = 46;
7+
objects = {
8+
9+
/* Begin PBXBuildFile section */
10+
53B09E081C0E96E100B058A5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E071C0E96E100B058A5 /* main.m */; };
11+
53B09E3B1C0EA9F600B058A5 /* DDuckBokE.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E191C0E970200B058A5 /* DDuckBokE.m */; };
12+
53B09E3C1C0EA9F600B058A5 /* Basic.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E101C0E970200B058A5 /* Basic.m */; };
13+
53B09E3D1C0EA9F600B058A5 /* Carbonara.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E121C0E970200B058A5 /* Carbonara.m */; };
14+
53B09E3E1C0EA9F600B058A5 /* Curry.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E141C0E970200B058A5 /* Curry.m */; };
15+
53B09E3F1C0EA9F600B058A5 /* JJaJang.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E161C0E970200B058A5 /* JJaJang.m */; };
16+
53B09E401C0EA9F600B058A5 /* SariDecorator.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E251C0E970200B058A5 /* SariDecorator.m */; };
17+
53B09E411C0EA9F600B058A5 /* Mandoo.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E341C0E97D700B058A5 /* Mandoo.m */; };
18+
53B09E421C0EA9F600B058A5 /* Odeng.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E361C0E97D700B058A5 /* Odeng.m */; };
19+
53B09E431C0EA9F600B058A5 /* Ramyun.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E381C0E97D700B058A5 /* Ramyun.m */; };
20+
53B09E441C0EA9F600B058A5 /* Vegetable.m in Sources */ = {isa = PBXBuildFile; fileRef = 53B09E3A1C0E97D700B058A5 /* Vegetable.m */; };
21+
/* End PBXBuildFile section */
22+
23+
/* Begin PBXCopyFilesBuildPhase section */
24+
53B09E021C0E96E100B058A5 /* CopyFiles */ = {
25+
isa = PBXCopyFilesBuildPhase;
26+
buildActionMask = 2147483647;
27+
dstPath = /usr/share/man/man1/;
28+
dstSubfolderSpec = 0;
29+
files = (
30+
);
31+
runOnlyForDeploymentPostprocessing = 1;
32+
};
33+
/* End PBXCopyFilesBuildPhase section */
34+
35+
/* Begin PBXFileReference section */
36+
53B09E041C0E96E100B058A5 /* Decorator */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = Decorator; sourceTree = BUILT_PRODUCTS_DIR; };
37+
53B09E071C0E96E100B058A5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
38+
53B09E0F1C0E970200B058A5 /* Basic.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Basic.h; sourceTree = "<group>"; };
39+
53B09E101C0E970200B058A5 /* Basic.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Basic.m; sourceTree = "<group>"; };
40+
53B09E111C0E970200B058A5 /* Carbonara.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Carbonara.h; sourceTree = "<group>"; };
41+
53B09E121C0E970200B058A5 /* Carbonara.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Carbonara.m; sourceTree = "<group>"; };
42+
53B09E131C0E970200B058A5 /* Curry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Curry.h; sourceTree = "<group>"; };
43+
53B09E141C0E970200B058A5 /* Curry.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Curry.m; sourceTree = "<group>"; };
44+
53B09E151C0E970200B058A5 /* JJaJang.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JJaJang.h; sourceTree = "<group>"; };
45+
53B09E161C0E970200B058A5 /* JJaJang.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JJaJang.m; sourceTree = "<group>"; };
46+
53B09E181C0E970200B058A5 /* DDuckBokE.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDuckBokE.h; sourceTree = "<group>"; };
47+
53B09E191C0E970200B058A5 /* DDuckBokE.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDuckBokE.m; sourceTree = "<group>"; };
48+
53B09E241C0E970200B058A5 /* SariDecorator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SariDecorator.h; sourceTree = "<group>"; };
49+
53B09E251C0E970200B058A5 /* SariDecorator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SariDecorator.m; sourceTree = "<group>"; };
50+
53B09E331C0E97D700B058A5 /* Mandoo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Mandoo.h; sourceTree = "<group>"; };
51+
53B09E341C0E97D700B058A5 /* Mandoo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Mandoo.m; sourceTree = "<group>"; };
52+
53B09E351C0E97D700B058A5 /* Odeng.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Odeng.h; sourceTree = "<group>"; };
53+
53B09E361C0E97D700B058A5 /* Odeng.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Odeng.m; sourceTree = "<group>"; };
54+
53B09E371C0E97D700B058A5 /* Ramyun.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Ramyun.h; sourceTree = "<group>"; };
55+
53B09E381C0E97D700B058A5 /* Ramyun.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Ramyun.m; sourceTree = "<group>"; };
56+
53B09E391C0E97D700B058A5 /* Vegetable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Vegetable.h; sourceTree = "<group>"; };
57+
53B09E3A1C0E97D700B058A5 /* Vegetable.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Vegetable.m; sourceTree = "<group>"; };
58+
/* End PBXFileReference section */
59+
60+
/* Begin PBXFrameworksBuildPhase section */
61+
53B09E011C0E96E100B058A5 /* Frameworks */ = {
62+
isa = PBXFrameworksBuildPhase;
63+
buildActionMask = 2147483647;
64+
files = (
65+
);
66+
runOnlyForDeploymentPostprocessing = 0;
67+
};
68+
/* End PBXFrameworksBuildPhase section */
69+
70+
/* Begin PBXGroup section */
71+
53B09DFB1C0E96E100B058A5 = {
72+
isa = PBXGroup;
73+
children = (
74+
53B09E061C0E96E100B058A5 /* Decorator */,
75+
53B09E051C0E96E100B058A5 /* Products */,
76+
);
77+
sourceTree = "<group>";
78+
};
79+
53B09E051C0E96E100B058A5 /* Products */ = {
80+
isa = PBXGroup;
81+
children = (
82+
53B09E041C0E96E100B058A5 /* Decorator */,
83+
);
84+
name = Products;
85+
sourceTree = "<group>";
86+
};
87+
53B09E061C0E96E100B058A5 /* Decorator */ = {
88+
isa = PBXGroup;
89+
children = (
90+
53B09E171C0E970200B058A5 /* BaseClass */,
91+
53B09E0E1C0E970200B058A5 /* SubClass */,
92+
53B09E1A1C0E970200B058A5 /* Decorator */,
93+
53B09E321C0E97D700B058A5 /* Decorator SubClass */,
94+
53B09E071C0E96E100B058A5 /* main.m */,
95+
);
96+
path = Decorator;
97+
sourceTree = "<group>";
98+
};
99+
53B09E0E1C0E970200B058A5 /* SubClass */ = {
100+
isa = PBXGroup;
101+
children = (
102+
53B09E0F1C0E970200B058A5 /* Basic.h */,
103+
53B09E101C0E970200B058A5 /* Basic.m */,
104+
53B09E111C0E970200B058A5 /* Carbonara.h */,
105+
53B09E121C0E970200B058A5 /* Carbonara.m */,
106+
53B09E131C0E970200B058A5 /* Curry.h */,
107+
53B09E141C0E970200B058A5 /* Curry.m */,
108+
53B09E151C0E970200B058A5 /* JJaJang.h */,
109+
53B09E161C0E970200B058A5 /* JJaJang.m */,
110+
);
111+
path = SubClass;
112+
sourceTree = "<group>";
113+
};
114+
53B09E171C0E970200B058A5 /* BaseClass */ = {
115+
isa = PBXGroup;
116+
children = (
117+
53B09E181C0E970200B058A5 /* DDuckBokE.h */,
118+
53B09E191C0E970200B058A5 /* DDuckBokE.m */,
119+
);
120+
path = BaseClass;
121+
sourceTree = "<group>";
122+
};
123+
53B09E1A1C0E970200B058A5 /* Decorator */ = {
124+
isa = PBXGroup;
125+
children = (
126+
53B09E241C0E970200B058A5 /* SariDecorator.h */,
127+
53B09E251C0E970200B058A5 /* SariDecorator.m */,
128+
);
129+
path = Decorator;
130+
sourceTree = "<group>";
131+
};
132+
53B09E321C0E97D700B058A5 /* Decorator SubClass */ = {
133+
isa = PBXGroup;
134+
children = (
135+
53B09E331C0E97D700B058A5 /* Mandoo.h */,
136+
53B09E341C0E97D700B058A5 /* Mandoo.m */,
137+
53B09E351C0E97D700B058A5 /* Odeng.h */,
138+
53B09E361C0E97D700B058A5 /* Odeng.m */,
139+
53B09E371C0E97D700B058A5 /* Ramyun.h */,
140+
53B09E381C0E97D700B058A5 /* Ramyun.m */,
141+
53B09E391C0E97D700B058A5 /* Vegetable.h */,
142+
53B09E3A1C0E97D700B058A5 /* Vegetable.m */,
143+
);
144+
path = "Decorator SubClass";
145+
sourceTree = "<group>";
146+
};
147+
/* End PBXGroup section */
148+
149+
/* Begin PBXNativeTarget section */
150+
53B09E031C0E96E100B058A5 /* Decorator */ = {
151+
isa = PBXNativeTarget;
152+
buildConfigurationList = 53B09E0B1C0E96E100B058A5 /* Build configuration list for PBXNativeTarget "Decorator" */;
153+
buildPhases = (
154+
53B09E001C0E96E100B058A5 /* Sources */,
155+
53B09E011C0E96E100B058A5 /* Frameworks */,
156+
53B09E021C0E96E100B058A5 /* CopyFiles */,
157+
);
158+
buildRules = (
159+
);
160+
dependencies = (
161+
);
162+
name = Decorator;
163+
productName = Decorator;
164+
productReference = 53B09E041C0E96E100B058A5 /* Decorator */;
165+
productType = "com.apple.product-type.tool";
166+
};
167+
/* End PBXNativeTarget section */
168+
169+
/* Begin PBXProject section */
170+
53B09DFC1C0E96E100B058A5 /* Project object */ = {
171+
isa = PBXProject;
172+
attributes = {
173+
LastUpgradeCheck = 0710;
174+
ORGANIZATIONNAME = "Jusung Kye";
175+
TargetAttributes = {
176+
53B09E031C0E96E100B058A5 = {
177+
CreatedOnToolsVersion = 7.1.1;
178+
};
179+
};
180+
};
181+
buildConfigurationList = 53B09DFF1C0E96E100B058A5 /* Build configuration list for PBXProject "Decorator" */;
182+
compatibilityVersion = "Xcode 3.2";
183+
developmentRegion = English;
184+
hasScannedForEncodings = 0;
185+
knownRegions = (
186+
en,
187+
);
188+
mainGroup = 53B09DFB1C0E96E100B058A5;
189+
productRefGroup = 53B09E051C0E96E100B058A5 /* Products */;
190+
projectDirPath = "";
191+
projectRoot = "";
192+
targets = (
193+
53B09E031C0E96E100B058A5 /* Decorator */,
194+
);
195+
};
196+
/* End PBXProject section */
197+
198+
/* Begin PBXSourcesBuildPhase section */
199+
53B09E001C0E96E100B058A5 /* Sources */ = {
200+
isa = PBXSourcesBuildPhase;
201+
buildActionMask = 2147483647;
202+
files = (
203+
53B09E3B1C0EA9F600B058A5 /* DDuckBokE.m in Sources */,
204+
53B09E3C1C0EA9F600B058A5 /* Basic.m in Sources */,
205+
53B09E3D1C0EA9F600B058A5 /* Carbonara.m in Sources */,
206+
53B09E3E1C0EA9F600B058A5 /* Curry.m in Sources */,
207+
53B09E3F1C0EA9F600B058A5 /* JJaJang.m in Sources */,
208+
53B09E401C0EA9F600B058A5 /* SariDecorator.m in Sources */,
209+
53B09E411C0EA9F600B058A5 /* Mandoo.m in Sources */,
210+
53B09E421C0EA9F600B058A5 /* Odeng.m in Sources */,
211+
53B09E431C0EA9F600B058A5 /* Ramyun.m in Sources */,
212+
53B09E441C0EA9F600B058A5 /* Vegetable.m in Sources */,
213+
53B09E081C0E96E100B058A5 /* main.m in Sources */,
214+
);
215+
runOnlyForDeploymentPostprocessing = 0;
216+
};
217+
/* End PBXSourcesBuildPhase section */
218+
219+
/* Begin XCBuildConfiguration section */
220+
53B09E091C0E96E100B058A5 /* Debug */ = {
221+
isa = XCBuildConfiguration;
222+
buildSettings = {
223+
ALWAYS_SEARCH_USER_PATHS = NO;
224+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
225+
CLANG_CXX_LIBRARY = "libc++";
226+
CLANG_ENABLE_MODULES = YES;
227+
CLANG_ENABLE_OBJC_ARC = YES;
228+
CLANG_WARN_BOOL_CONVERSION = YES;
229+
CLANG_WARN_CONSTANT_CONVERSION = YES;
230+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
231+
CLANG_WARN_EMPTY_BODY = YES;
232+
CLANG_WARN_ENUM_CONVERSION = YES;
233+
CLANG_WARN_INT_CONVERSION = YES;
234+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
235+
CLANG_WARN_UNREACHABLE_CODE = YES;
236+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
237+
CODE_SIGN_IDENTITY = "-";
238+
COPY_PHASE_STRIP = NO;
239+
DEBUG_INFORMATION_FORMAT = dwarf;
240+
ENABLE_STRICT_OBJC_MSGSEND = YES;
241+
ENABLE_TESTABILITY = YES;
242+
GCC_C_LANGUAGE_STANDARD = gnu99;
243+
GCC_DYNAMIC_NO_PIC = NO;
244+
GCC_NO_COMMON_BLOCKS = YES;
245+
GCC_OPTIMIZATION_LEVEL = 0;
246+
GCC_PREPROCESSOR_DEFINITIONS = (
247+
"DEBUG=1",
248+
"$(inherited)",
249+
);
250+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
251+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
252+
GCC_WARN_UNDECLARED_SELECTOR = YES;
253+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
254+
GCC_WARN_UNUSED_FUNCTION = YES;
255+
GCC_WARN_UNUSED_VARIABLE = YES;
256+
MACOSX_DEPLOYMENT_TARGET = 10.11;
257+
MTL_ENABLE_DEBUG_INFO = YES;
258+
ONLY_ACTIVE_ARCH = YES;
259+
SDKROOT = macosx;
260+
};
261+
name = Debug;
262+
};
263+
53B09E0A1C0E96E100B058A5 /* Release */ = {
264+
isa = XCBuildConfiguration;
265+
buildSettings = {
266+
ALWAYS_SEARCH_USER_PATHS = NO;
267+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
268+
CLANG_CXX_LIBRARY = "libc++";
269+
CLANG_ENABLE_MODULES = YES;
270+
CLANG_ENABLE_OBJC_ARC = YES;
271+
CLANG_WARN_BOOL_CONVERSION = YES;
272+
CLANG_WARN_CONSTANT_CONVERSION = YES;
273+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
274+
CLANG_WARN_EMPTY_BODY = YES;
275+
CLANG_WARN_ENUM_CONVERSION = YES;
276+
CLANG_WARN_INT_CONVERSION = YES;
277+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
278+
CLANG_WARN_UNREACHABLE_CODE = YES;
279+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
280+
CODE_SIGN_IDENTITY = "-";
281+
COPY_PHASE_STRIP = NO;
282+
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
283+
ENABLE_NS_ASSERTIONS = NO;
284+
ENABLE_STRICT_OBJC_MSGSEND = YES;
285+
GCC_C_LANGUAGE_STANDARD = gnu99;
286+
GCC_NO_COMMON_BLOCKS = YES;
287+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
288+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
289+
GCC_WARN_UNDECLARED_SELECTOR = YES;
290+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
291+
GCC_WARN_UNUSED_FUNCTION = YES;
292+
GCC_WARN_UNUSED_VARIABLE = YES;
293+
MACOSX_DEPLOYMENT_TARGET = 10.11;
294+
MTL_ENABLE_DEBUG_INFO = NO;
295+
SDKROOT = macosx;
296+
};
297+
name = Release;
298+
};
299+
53B09E0C1C0E96E100B058A5 /* Debug */ = {
300+
isa = XCBuildConfiguration;
301+
buildSettings = {
302+
PRODUCT_NAME = "$(TARGET_NAME)";
303+
};
304+
name = Debug;
305+
};
306+
53B09E0D1C0E96E100B058A5 /* Release */ = {
307+
isa = XCBuildConfiguration;
308+
buildSettings = {
309+
PRODUCT_NAME = "$(TARGET_NAME)";
310+
};
311+
name = Release;
312+
};
313+
/* End XCBuildConfiguration section */
314+
315+
/* Begin XCConfigurationList section */
316+
53B09DFF1C0E96E100B058A5 /* Build configuration list for PBXProject "Decorator" */ = {
317+
isa = XCConfigurationList;
318+
buildConfigurations = (
319+
53B09E091C0E96E100B058A5 /* Debug */,
320+
53B09E0A1C0E96E100B058A5 /* Release */,
321+
);
322+
defaultConfigurationIsVisible = 0;
323+
defaultConfigurationName = Release;
324+
};
325+
53B09E0B1C0E96E100B058A5 /* Build configuration list for PBXNativeTarget "Decorator" */ = {
326+
isa = XCConfigurationList;
327+
buildConfigurations = (
328+
53B09E0C1C0E96E100B058A5 /* Debug */,
329+
53B09E0D1C0E96E100B058A5 /* Release */,
330+
);
331+
defaultConfigurationIsVisible = 0;
332+
};
333+
/* End XCConfigurationList section */
334+
};
335+
rootObject = 53B09DFC1C0E96E100B058A5 /* Project object */;
336+
}

03-Decorator/Decorator/Decorator.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// DDuckBokE.h
3+
// Decorator
4+
//
5+
// Created by Jusung Kye on 12/2/15.
6+
// Copyright © 2015 Jusung Kye. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface DDuckBokE : NSObject {
12+
NSString *_description;
13+
}
14+
15+
- (NSString *)getDescription;
16+
- (double)cost;
17+
18+
@end
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// DDuckBokE.m
3+
// Decorator
4+
//
5+
// Created by Jusung Kye on 12/2/15.
6+
// Copyright © 2015 Jusung Kye. All rights reserved.
7+
//
8+
9+
#import "DDuckBokE.h"
10+
11+
@implementation DDuckBokE
12+
13+
- (instancetype)init {
14+
self = [super init];
15+
16+
if (self) {
17+
_description = @"Unkown DDuckBokE";
18+
}
19+
20+
return self;
21+
}
22+
23+
- (NSString *)getDescription {
24+
return _description;
25+
}
26+
27+
- (double)cost {
28+
NSAssert(NO, @"This is an abstract method so should be overridden.");
29+
return 0;
30+
}
31+
32+
33+
@end

0 commit comments

Comments
 (0)