Coding Style vereinheitlicht
authorMarkus Bröker<broeker.markus@googlemail.com>
Tue, 28 Mar 2017 19:36:06 +0200
changeset 1 58bbaa38119e
parent 0 c344b61ddaf6
child 2 fd23014eaa85
Coding Style vereinheitlicht
PDFViewer/appdelegate/AppDelegate.h
PDFViewer/appdelegate/AppDelegate.m
PDFViewer/pdfviewer/PDFViewer.h
PDFViewer/pdfviewer/PDFViewer.m
PDFViewer/viewcontroller/ViewController.h
PDFViewer/viewcontroller/ViewController.m
--- a/PDFViewer/appdelegate/AppDelegate.h
+++ b/PDFViewer/appdelegate/AppDelegate.h
@@ -10,6 +10,4 @@
 
 @interface AppDelegate : NSObject <NSApplicationDelegate>
 
-
 @end
-
--- a/PDFViewer/appdelegate/AppDelegate.m
+++ b/PDFViewer/appdelegate/AppDelegate.m
@@ -15,15 +15,16 @@
 @implementation AppDelegate
 
 - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
-    // Insert code here to initialize your application
+  // Insert code here to initialize your application
 }
 
 - (void)applicationWillTerminate:(NSNotification *)aNotification {
-    // Insert code here to tear down your application
+  // Insert code here to tear down your application
 }
 
-- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
-    return TRUE;
+- (BOOL)applicationShouldTerminateAfterLastWindowClosed:
+    (NSApplication *)sender {
+  return TRUE;
 }
 
 @end
--- a/PDFViewer/pdfviewer/PDFViewer.h
+++ b/PDFViewer/pdfviewer/PDFViewer.h
@@ -8,10 +8,10 @@
 
 #import <Quartz/Quartz.h>
 @interface PDFViewer : PDFView {
-    NSSpeechSynthesizer *synthesizer;
+  NSSpeechSynthesizer *synthesizer;
 }
 
--(NSMutableString*) getTexts;
--(void) speak: (NSMutableString*) texts;
--(void) stopSpeaking;
+- (NSMutableString *)getTexts;
+- (void)speak:(NSMutableString *)texts;
+- (void)stopSpeaking;
 @end
--- a/PDFViewer/pdfviewer/PDFViewer.m
+++ b/PDFViewer/pdfviewer/PDFViewer.m
@@ -10,49 +10,50 @@
 
 @implementation PDFViewer
 
--(void) awakeFromNib {
-    synthesizer = [[NSSpeechSynthesizer alloc] initWithVoice:[NSSpeechSynthesizer defaultVoice]];
+- (void)awakeFromNib {
+  synthesizer = [[NSSpeechSynthesizer alloc] initWithVoice:[NSSpeechSynthesizer defaultVoice]];
 }
 
--(NSMutableString*) getTexts {
-    NSMutableString *strings = [[NSMutableString alloc] init];
-    NSUInteger nOps = [[self document] pageCount];
-    
-    [strings appendString: [NSString stringWithFormat: @"Genosse Parteisekretär, das Dokument hat %lu Seiten", nOps]];
-    
-    for (int pages = 0; pages < nOps; pages++) {
-        PDFPage *page = [[self document] pageAtIndex: pages];
-        [strings appendString: [self replaceString: [page string]]];
-    }
-    
-    return strings;
+- (NSMutableString *)getTexts {
+  NSMutableString *strings = [[NSMutableString alloc] init];
+  NSUInteger nOps = [[self document] pageCount];
+
+  [strings appendString:[NSString stringWithFormat:@"Genosse Parteisekretär, das Dokument hat %lu Seiten", nOps]];
+
+  for (int pages = 0; pages < nOps; pages++) {
+    PDFPage *page = [[self document] pageAtIndex:pages];
+    [strings appendString:[self replaceString:[page string]]];
+  }
+
+  return strings;
 }
 
--(void) speak: (NSMutableString*) texts {
-    // Die Audioausgabe muss immer gestoppt werden, bevor Sie erneut gestartet werden darf!
-    [self stopSpeaking];
-    
-    [synthesizer startSpeakingString:texts];    
-}
+- (void)speak:(NSMutableString *)texts {
+  // Die Audioausgabe muss immer gestoppt werden, bevor Sie erneut gestartet
+  // werden darf!
+  [self stopSpeaking];
 
--(void) stopSpeaking {
-    if ([synthesizer isSpeaking]) {
-        [synthesizer stopSpeaking];
-    }
+  [synthesizer startSpeakingString:texts];
 }
 
--(NSString*) replaceString: (NSString*) inputStr {
-    NSDictionary *replacements = @{
-       @"SED": @"S.E.D.",
-       @"DDR": @"D.D.R.",
-       @" IM ": @" I.M. ",
-    };
-    
-    for (id key in replacements) {
-        inputStr = [inputStr stringByReplacingOccurrencesOfString:key withString: replacements[key]];
-    }
-    
-    return inputStr;
+- (void)stopSpeaking {
+  if ([synthesizer isSpeaking]) {
+    [synthesizer stopSpeaking];
+  }
+}
+
+- (NSString *)replaceString:(NSString *)inputStr {
+  NSDictionary *replacements = @{
+    @"SED" : @"S.E.D.",
+    @"DDR" : @"D.D.R.",
+    @" IM " : @" I.M. ",
+  };
+
+  for (id key in replacements) {
+    inputStr = [inputStr stringByReplacingOccurrencesOfString:key withString:replacements[key]];
+  }
+
+  return inputStr;
 }
 
 @end
--- a/PDFViewer/viewcontroller/ViewController.h
+++ b/PDFViewer/viewcontroller/ViewController.h
@@ -6,9 +6,9 @@
 //  Copyright © 2017 Markus Bröker. All rights reserved.
 //
 
+#import "PDFViewer.h"
 #import <Cocoa/Cocoa.h>
-#import "PDFViewer.h"
 
 @interface ViewController : NSViewController
-@property (weak) IBOutlet PDFViewer *pdfViewer;
+@property(weak) IBOutlet PDFViewer *pdfViewer;
 @end
--- a/PDFViewer/viewcontroller/ViewController.m
+++ b/PDFViewer/viewcontroller/ViewController.m
@@ -13,26 +13,26 @@
 @synthesize pdfViewer = _pdfViewer;
 
 - (void)viewDidLoad {
-    [super viewDidLoad];
-    
-    NSString *str = @"https://derinistihbarat.files.wordpress.com/2012/08/die-doktorarbeit-von-stasi-koko-chef-alexander-schalck-golodtkowski.pdf";
-    
-    NSURL *url = [NSURL URLWithString:str];
-    
-    PDFDocument *doc = [[PDFDocument alloc] initWithURL:url];    
-    [_pdfViewer setDocument: doc];
+  [super viewDidLoad];
+
+  NSString *str = @"https://derinistihbarat.files.wordpress.com/2012/08/die-doktorarbeit-von-stasi-koko-chef-alexander-schalck-golodtkowski.pdf";
+
+  NSURL *url = [NSURL URLWithString:str];
+
+  PDFDocument *doc = [[PDFDocument alloc] initWithURL:url];
+  [_pdfViewer setDocument:doc];
 }
 
-- (void) viewDidAppear {
-    [_pdfViewer speak: [_pdfViewer getTexts]];
+- (void)viewDidAppear {
+  [_pdfViewer speak:[_pdfViewer getTexts]];
 }
 
--(void) viewDidDisappear {
-    [_pdfViewer stopSpeaking];
+- (void)viewDidDisappear {
+  [_pdfViewer stopSpeaking];
 }
 
 - (void)setRepresentedObject:(id)representedObject {
-    [super setRepresentedObject:representedObject];
+  [super setRepresentedObject:representedObject];
 }
 
 @end