Permalink
Browse files

formatter

  • Loading branch information...
1 parent 68e5bdf commit 625d56f62abb74faf7619009e941a52ab9d72a76 @youknowone youknowone committed Apr 13, 2014
@@ -19,7 +19,7 @@
@property(nonatomic, readonly) CIMInputManager *sharedInputManager;
/*!
@brief 합성기 생성
-
+
입력 소스 별로 사용할 합성기를 만들어 반환한다.
*/
- (CIMComposer *)composerWithServer:(IMKServer *)server client:(id)client;
@@ -28,7 +28,7 @@ typedef enum {
CIMInputTextProcessResultNotProcessedAndNeedsCancel = -1,
CIMInputTextProcessResultNotProcessed = 0,
CIMInputTextProcessResultProcessed = 1,
-} CIMInputTextProcessResult;
+} CIMInputTextProcessResult;
/*!
@protocol
@@ -9,8 +9,8 @@
#include "CIMComposer.h"
@implementation CIMComposer
-@synthesize delegate=_delegate;
-@synthesize inputMode=_inputMode;
+@synthesize delegate = _delegate;
+@synthesize inputMode = _inputMode;
- (void)dealloc {
self.delegate = nil;
@@ -32,16 +32,24 @@ FOUNDATION_EXTERN NSString *kCIMRomanModeByEscapeKey;
FOUNDATION_EXTERN NSString *kCIMZeroWidthSpaceForLayoutExchange;
FOUNDATION_EXTERN NSString *kCIMZeroWidthSpaceForBlankComposedString;
-
-#define defCIMConfigurationItem(NAME, TYPE) struct NAME { NSString *name; TYPE *pConfiguration; TYPE defaultValue; }
+#define defCIMConfigurationItem(NAME, TYPE) \
+ struct NAME { \
+ NSString *name; \
+ TYPE *pConfiguration; \
+ TYPE defaultValue; \
+ }
defCIMConfigurationItem(CIMConfigurationStringItem, NSString *);
defCIMConfigurationItem(CIMConfigurationIntegerItem, NSInteger);
defCIMConfigurationItem(CIMConfigurationBoolItem, BOOL);
#undef defCIMConfigurationItem
-#define CIMConfigurationSetObjectForField(CONF, OBJ, FIELD) { [CONF->FIELD autorelease]; CONF->FIELD = [OBJ retain]; }
+#define CIMConfigurationSetObjectForField(CONF, OBJ, FIELD) \
+ { \
+ [CONF->FIELD autorelease]; \
+ CONF->FIELD = [OBJ retain]; \
+ }
@class CIMConfiguration;
@@ -51,14 +59,14 @@ extern CIMConfiguration *CIMDefaultUserConfiguration;
@brief NSUserDefaults 에 설정을 저장하고 가져온다.
*/
@interface CIMConfiguration : NSObject {
-@private
+ @private
NSMutableDictionary *pFieldKeys;
struct CIMConfigurationStringItem stringItems[CIMConfigurationStringItemCount];
struct CIMConfigurationIntegerItem integerItems[CIMConfigurationIntegerItemCount];
struct CIMConfigurationBoolItem boolItems[CIMConfigurationBoolItemCount];
NSMutableDictionary *originConfigurations;
NSUserDefaults *userDefaults;
-@public
+ @public
NSString *lastHangulInputMode;
NSInteger inputModeExchangeKeyModifier, inputModeExchangeKeyCode;
NSInteger inputModeHanjaKeyModifier, inputModeHanjaKeyCode;
@@ -9,27 +9,26 @@
#import "CIMConfiguration.h"
#import "HangulComposer.h"
-NSString * kCIMLastHangulInputMode = @"CIMLastHangulInputMode";
-
-NSString * kCIMInputModeExchangeKeyModifier = @"CIMInputModeExchangeKeyModifier";
-NSString * kCIMInputModeExchangeKeyCode = @"CIMInputModeExchangeKeyCode";
-NSString * kCIMInputModeHanjaKeyModifier = @"CIMInputModeHanjaKeyModifier";
-NSString * kCIMInputModeHanjaKeyCode = @"CIMInputModeHanjaKeyCode";
-NSString * kCIMOptionKeyBehavior = @"CIMHangulOptionKeyBehavior";
-NSString * kCIMHangulCombinationModeComposing = @"CIMHangulCombinationModeComposing";
-NSString * kCIMHangulCombinationModeCommiting = @"CIMHangulCombinationModeCommiting";
-
-NSString * kCIMSharedInputManager = @"CIMSharedInputManager";
-NSString * kCIMAutosaveDefaultInputMode = @"CIMAutosaveDefaultInputMode";
-NSString * kCIMRomanModeByEscapeKey = @"CIMRomanModeByEscapeKey";
-NSString * kCIMZeroWidthSpaceForLayoutExchange = @"CIMZeroWidthSpaceForLayoutExchange";
-NSString * kCIMZeroWidthSpaceForBlankComposedString = @"CIMZeroWidthSpaceForBlankComposedString";
-
+NSString *kCIMLastHangulInputMode = @"CIMLastHangulInputMode";
+
+NSString *kCIMInputModeExchangeKeyModifier = @"CIMInputModeExchangeKeyModifier";
+NSString *kCIMInputModeExchangeKeyCode = @"CIMInputModeExchangeKeyCode";
+NSString *kCIMInputModeHanjaKeyModifier = @"CIMInputModeHanjaKeyModifier";
+NSString *kCIMInputModeHanjaKeyCode = @"CIMInputModeHanjaKeyCode";
+NSString *kCIMOptionKeyBehavior = @"CIMHangulOptionKeyBehavior";
+NSString *kCIMHangulCombinationModeComposing = @"CIMHangulCombinationModeComposing";
+NSString *kCIMHangulCombinationModeCommiting = @"CIMHangulCombinationModeCommiting";
+
+NSString *kCIMSharedInputManager = @"CIMSharedInputManager";
+NSString *kCIMAutosaveDefaultInputMode = @"CIMAutosaveDefaultInputMode";
+NSString *kCIMRomanModeByEscapeKey = @"CIMRomanModeByEscapeKey";
+NSString *kCIMZeroWidthSpaceForLayoutExchange = @"CIMZeroWidthSpaceForLayoutExchange";
+NSString *kCIMZeroWidthSpaceForBlankComposedString = @"CIMZeroWidthSpaceForBlankComposedString";
CIMConfiguration *CIMDefaultUserConfiguration;
@implementation CIMConfiguration
-@synthesize userDefaults;
+@synthesize userDefaults;
+ (void)initialize {
[super initialize];
@@ -44,11 +43,11 @@ - (id)initWithUserDefaults:(NSUserDefaults *)aUserDefaults {
self = [super init];
if (self != nil) {
self->pFieldKeys = [[NSMutableDictionary alloc] init];
-
+
struct CIMConfigurationStringItem tempStringItems[CIMConfigurationStringItemCount] = {
{ kCIMLastHangulInputMode, &self->lastHangulInputMode, nil },
};
- for (NSInteger i = 0; i < CIMConfigurationStringItemCount; i++ ) {
+ for (NSInteger i = 0; i < CIMConfigurationStringItemCount; i++) {
struct CIMConfigurationStringItem *item = &tempStringItems[i];
self->stringItems[i] = tempStringItems[i];
self->pFieldKeys[@((unsigned long)item->pConfiguration)] = item->name;
@@ -60,10 +59,12 @@ - (id)initWithUserDefaults:(NSUserDefaults *)aUserDefaults {
{ kCIMInputModeHanjaKeyModifier, &self->inputModeHanjaKeyModifier, NSAlternateKeyMask },
{ kCIMInputModeHanjaKeyCode, &self->inputModeHanjaKeyCode, 0x24 },
{ kCIMOptionKeyBehavior, &self->optionKeyBehavior, 0 },
- { kCIMHangulCombinationModeComposing, &self->hangulCombinationModeComposing, (NSInteger)HangulCharacterCombinationWithoutFiller },
- { kCIMHangulCombinationModeCommiting, &self->hangulCombinationModeCommiting, (NSInteger)HangulCharacterCombinationWithoutFiller },
+ { kCIMHangulCombinationModeComposing, &self->hangulCombinationModeComposing,
+ (NSInteger)HangulCharacterCombinationWithoutFiller },
+ { kCIMHangulCombinationModeCommiting, &self->hangulCombinationModeCommiting,
+ (NSInteger)HangulCharacterCombinationWithoutFiller },
};
- for (NSInteger i = 0; i < CIMConfigurationIntegerItemCount; i++ ) {
+ for (NSInteger i = 0; i < CIMConfigurationIntegerItemCount; i++) {
self->integerItems[i] = tempIntegerItems[i];
}
struct CIMConfigurationBoolItem tempBoolItems[CIMConfigurationBoolItemCount] = {
@@ -73,7 +74,7 @@ - (id)initWithUserDefaults:(NSUserDefaults *)aUserDefaults {
{ kCIMZeroWidthSpaceForBlankComposedString, &self->zeroWidthSpaceForBlankComposedString, NO },
{ kCIMZeroWidthSpaceForLayoutExchange, &self->zeroWidthSpaceForLayoutExchange, NO },
};
- for (NSInteger i = 0; i < CIMConfigurationBoolItemCount; i++ ) {
+ for (NSInteger i = 0; i < CIMConfigurationBoolItemCount; i++) {
self->boolItems[i] = tempBoolItems[i];
}
self->originConfigurations = [[NSMutableDictionary alloc] init];
@@ -97,13 +98,16 @@ - (void)setUserDefaults:(NSUserDefaults *)aUserDefaults {
}
- (void)loadAllConfigurations {
- if (self->userDefaults == nil) return;
+ if (self->userDefaults == nil)
+ return;
[self->userDefaults synchronize];
- for (int i = 0; i < CIMConfigurationStringItemCount; i++ ) {
+ for (int i = 0; i < CIMConfigurationStringItemCount; i++) {
struct CIMConfigurationStringItem item = self->stringItems[i];
id object = [self->userDefaults objectForKey:item.name];
dlog(TRUE, @"** CIMConfiguration -loadAllConfigurations count: %d / object: %@", i, object);
- if (object == nil) { object = item.defaultValue; }
+ if (object == nil) {
+ object = item.defaultValue;
+ }
[*item.pConfiguration autorelease];
*item.pConfiguration = [object retain];
if (object != nil) {
@@ -112,13 +116,13 @@ - (void)loadAllConfigurations {
[self->originConfigurations removeObjectForKey:item.name];
}
}
- for (NSInteger i = 0; i < CIMConfigurationIntegerItemCount; i++ ) {
+ for (NSInteger i = 0; i < CIMConfigurationIntegerItemCount; i++) {
struct CIMConfigurationIntegerItem item = self->integerItems[i];
id object = [self->userDefaults objectForKey:item.name];
*item.pConfiguration = object != nil ? [object integerValue] : item.defaultValue;
self->originConfigurations[item.name] = @(*item.pConfiguration);
}
- for (NSInteger i = 0; i < CIMConfigurationBoolItemCount; i++ ) {
+ for (NSInteger i = 0; i < CIMConfigurationBoolItemCount; i++) {
struct CIMConfigurationBoolItem item = self->boolItems[i];
id object = [self->userDefaults objectForKey:item.name];
*item.pConfiguration = object != nil ? [object boolValue] : item.defaultValue;
@@ -127,7 +131,8 @@ - (void)loadAllConfigurations {
}
- (void)saveAllConfigurations {
- if (self->userDefaults == nil) return;
+ if (self->userDefaults == nil)
+ return;
for (int i = 0; i < CIMConfigurationStringItemCount; i++) {
struct CIMConfigurationStringItem item = self->stringItems[i];
NSString *value = *item.pConfiguration;
@@ -12,12 +12,12 @@
/*!
@brief 입력기에 들어온 입력의 처리를 적절히 분배한다.
-
+
입력기에서 외부입력을 처리하여 우선순위에 따라 입력을 순서대로 전달한다.
아직 합성기로 전달하는 역할만 하고 있다.
*/
@interface CIMInputHandler : NSObject<CIMInputTextDelegate> {
-@private
+ @private
CIMInputManager *manager;
}
@@ -25,17 +25,26 @@ - (IBAction)checkRecentVersion:(id)sender {
if ([recent isEqualToString:current]) {
NSString *fmt = @"현재 사용하고 있는 구름 입력기 %@ 는 최신 버전입니다.";
- NSAlert *alert = [NSAlert alertWithMessageText:@"구름 입력기 업데이트 확인" defaultButton:@"확인" alternateButton:nil otherButton:nil informativeTextWithFormat:fmt, current];
+ NSAlert *alert = [NSAlert alertWithMessageText:@"구름 입력기 업데이트 확인"
+ defaultButton:@"확인"
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:fmt, current];
[alert beginSheetModalForWindow:nil modalDelegate:nil didEndSelector:nil contextInfo:NULL];
} else {
- NSString *fmt = @"현재 사용하고 있는 구름 입력기는 %@ 이고 최신 버전은 %@ 입니다. 업데이트는 로그아웃하거나 재부팅해야 적용됩니다.";
+ NSString *fmt = @"현재 사용하고 있는 구름 입력기는 %@ 이고 최신 버전은 %@ 입니다. 업데이트는 로그아웃하거나 "
+ "재부팅해야 적용됩니다.";
if (note.length) {
fmt = [fmt stringByAppendingFormat:@" 업데이트 요약은 '%@' 입니다.", note];
}
if (download.length == 0) {
fmt = [fmt stringByAppendingString:@" 곧 업데이트 링크가 준비될 예정입니다."];
}
- NSAlert *alert = [NSAlert alertWithMessageText:@"구름 입력기 업데이트 확인" defaultButton:@"확인" alternateButton:nil otherButton:nil informativeTextWithFormat:fmt, current, recent];
+ NSAlert *alert = [NSAlert alertWithMessageText:@"구름 입력기 업데이트 확인"
+ defaultButton:@"확인"
+ alternateButton:nil
+ otherButton:nil
+ informativeTextWithFormat:fmt, current, recent];
[alert beginSheetModalForWindow:nil modalDelegate:nil didEndSelector:nil contextInfo:NULL];
if (download.length > 0) {
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:download]];
@@ -8,8 +8,8 @@
#import "CIMApplicationDelegate.h"
-@interface GureumAppDelegate : NSObject <NSApplicationDelegate, CIMApplicationDelegate> {
-@private
+@interface GureumAppDelegate : NSObject<NSApplicationDelegate, CIMApplicationDelegate> {
+ @private
CIMInputManager *sharedInputManager;
IBOutlet NSMenu *menu;
}
@@ -33,11 +33,11 @@ FOUNDATION_EXTERN NSString *kGureumInputSourceIdentifierHan3_2012Loose;
@class HanjaComposer;
/*!
@brief 구름 입력기의 합성기
-
+
입력 모드에 따라 libhangul을 이용하여 문자를 합성해 준다.
*/
@interface GureumComposer : CIMComposer {
-@private
+ @private
CIMBaseComposer *romanComposer;
HangulComposer *hangulComposer;
HanjaComposer *hanjaComposer;
@@ -10,7 +10,6 @@
#import <Hangul/HGHanja.h>
#import "CIMComposer.h"
-
typedef enum {
// 채움 문자는 모두 지우고 결합해 표현한다.
HangulCharacterCombinationWithoutFiller = 0,
@@ -25,7 +24,6 @@ typedef enum {
} HangulCharacterCombinationMode;
#define HangulCharacterCombinationModeCount 5
-
@class HGInputContext;
/*!
@@ -56,7 +54,6 @@ typedef enum {
@end
-
@interface HanjaComposer : CIMComposer {
HGHanjaList *_hanjaCandidates;
NSMutableString *bufferedString;
View
@@ -0,0 +1,50 @@
+---
+# BasedOnStyle: LLVM
+AccessModifierOffset: -2
+ConstructorInitializerIndentWidth: 4
+AlignEscapedNewlinesLeft: false
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortFunctionsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakTemplateDeclarations: false
+AlwaysBreakBeforeMultilineStrings: true
+BreakBeforeBinaryOperators: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BinPackParameters: true
+ColumnLimit: 120
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+DerivePointerBinding: false
+ExperimentalAutoDetectBinPacking: false
+IndentCaseLabels: true
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: All
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 60
+PenaltyBreakString: 1000
+PenaltyBreakFirstLessLess: 120
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerBindsToType: false
+SpacesBeforeTrailingComments: 1
+Cpp11BracedListStyle: false
+Standard: Cpp11
+IndentWidth: 4
+TabWidth: 4
+UseTab: Never
+BreakBeforeBraces: Attach
+IndentFunctionDeclarationAfterType: false
+SpacesInParentheses: false
+SpacesInAngles: false
+SpaceInEmptyParentheses: false
+SpacesInContainerLiterals: false
+SpacesInCStyleCastParentheses: false
+SpaceAfterControlStatementKeyword: true
+SpaceBeforeAssignmentOperators: true
+ContinuationIndentWidth: 4
+...
+

0 comments on commit 625d56f

Please sign in to comment.