SlideShare una empresa de Scribd logo
1 de 60
Descargar para leer sin conexión
discon
iPhone
Taro Matsuzawa aka btm (@smellman)
       at sumaben kanto #11
1981


•
1988


•
1989


•
1991


•   BL
1997


•
    •   Windows 95 OSR2

    •   MMX Pentium 200Mhz
1999

•
•   English Speaking Society (E.S.S.)

•
2000
•
•
•   Mozilla Party JP 1.0   (   OSS    )

•
•
•               Linux

•
•             E.S.S.
2001

•
•
•
•   Tokyo Linux Entertainment Community(TLEC)

•   WEB
2002
•
•
•                  VB      (      )

•   Mozilla Party 3.0 JP

•
•
•
2003
•
•
•
•   Mozilla Party JP 4.0

•
•                  1000    40
2004
•              (5   )

•
•
•
    •
•       ○
2005

•   C Magazine 2005/10           2   Firefox
      Piro                 C++



•
2006


•
    •
•
2007
•   Software Design 2007/04 Firefox   (   )

•
•     ○○

•
•
•
2008

•
•   KBMJ

•          Firefox 3 Hacks (   )

•
•
2009

•
•
•   Software Design   Firefox      2009.11   2010.04



•   OSS EC
2010


•   iPhone           In App Purchase   2

•
•            (   )
2011


•       (   )

•
    •
•       iPhone

•
    •   iPhone

    •            GUI



    •
    •
•
    •          iPhone



    •

    •
    •   IMAP

    •
IMAP?
IMAP
•
•   i.softbank.jp

    •
    •
    •
    •
•
•
•   SSL

•
•
    •       ...

    •
    •   (         )
•   Pantomime    Mac OS X/GNUStep
         LGPL2

    •     2007

    •
    •                               ...

    •
    •
LGPL2 iPhone
•   LGPL2                   (ex.    cocos2d-iphone   )

    •
•
•
    •                          OK

    •
    •
    •                   (

    •       Σ( д lll)
Pantomime

•   Objective-C             IMAP/POP/SMTP

    •               Mac OS X      GNUStep

•
•                  2007 / 2 / 5

    •             discon              (ry
1
•
    •   Mac OS X 10.2



•
    •   NSDebug

•
    •
2
•   GNUStep

    •
•   SMTP

    •                     (



•   iOS

    •         Apple

    •         Apple
•
    •   NSString cString

    •   NSFileManager fileAttributesAtPath:traverseLink:

•                      xcode

•
NSFileManager
fileAttributesAtPath:traverseLink:
attributesOfItemAtPath:error:


- attributes = [[NSFileManager defaultManager] fileAttributesAtPath: thePath traverseLink: NO];
+ NSError *error = nil;
+ attributes = [[NSFileManager defaultManager] attributesOfItemAtPath: thePath error: &error];
•   Pantomime       openssl



    •   openssl-xcode         openssl
                  iPhone

        •   https://github.com/sjlombardo/openssl-xcode

•                             libcrypt.a                  libssl.a
                                    orz
•   libssl.a                openssl-xcode

    •   https://github.com/smellman/openssl-xcode

    •
•   libssl.a   libcrypt.a
GNUStep

•   GNUStep



    •                #ifdef MACOSX
              (iOS        )

•   GNUStep    Mac OS X                                        Mac OS
    X

•                                    OK (Search and Destroy)
-#ifdef MACOSX
 #include <Pantomime/CWMacOSXGlue.h>
-#endif


 Mac OS X
-#ifdef MACOSX
   #include <CoreFoundation/CFString.h>
   #include <CoreFoundation/CFStringEncodingExt.h>
  -#else
  -#include <GNUstepBase/GSCategories.h>
  -#endif

else                    GNUStep
iOS

•   iOS

    •
•
    •
        •
        •
NSHost


•                          [[NSHost currentHost] name]

    •
        •   gethostname

        •           NSString
gethostname
+    char s[65];
+    memset(s, 0, sizeof(s));
+    gethostname(s, sizeof(s)-1);
+    NSString *hostName = [NSString stringWithCString:s encoding:NSUTF8StringEncoding];
    aMailFile = [NSString stringWithFormat: @"%@:%@", [NSString stringWithFormat: @"%d.%d%d%d.%@",
                                               time(NULL),
                                               getpid(),
                                               rand(),
                                               [_cacheManager count],
-                                               [[NSHost currentHost] name]],
+                                                hostName],
                   ((id)theFlags ? (id)[theFlags maildirString] : (id)@"2,")];
NSCalendarDate



•   iOS             Mac OS X   Legacy API



•   Pantomime

    •
NSCalendarDate

•   NSCalendarDate

    •   NSDate

•   descriptionWithCalendarFormat

    •   NSDateFormatter

•
    •   NSCalendar NSDateCompoments

•   timeIntervalSince1970

    •   NSDate
-    NSCalendarDate *aCalendarDate;
+     NSCalendar *calendar = [NSCalendar currentCalendar];
+   NSDate *aCurrentDate = [[NSData alloc] init];
     int days;


-
     // We get the days interval between our two dates
     aCalendarDate = [NSCalendarDate calendarDate];
                                                             w
-    [aCalendarDate years: NULL
-               months: NULL
-               days: &days
-               hours: NULL
-               minutes: NULL
-               seconds: NULL
-               sinceDate: aDate];
-
+   NSDateComponents *comps;
+   NSUInteger flags = NSDayCalendarUnit;
+   comps = [calendar components:flags
+                  fromDate:aDate
+                    toDate:aCurrentDate
+                   options:0];
+   days = (int) [comps day];
NSMapTable


•   NSMapTable
    typedef struct _NSMapTable NSMapTable;


    •   Mac OS X 10.0   10.4

•
    •                          int

•   NSMapTable                               iOS
•   NSCreateMapTable

    •   NSCreateMapTable(NSObjectMapKeyCallBacks,
        NSObjectMapValueCallBacks, 128);

•                          Map
    NSMutableDictionary
NSMutableDictionary
//
- NSMapTable *_table;
+ NSMutableDictionary *_table;

//
- _table = NSCreateMapTable(NSObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 128);
+ _table = [[NSMutableDictionary alloc] initWithCapacity:128];

//
-     NSMapInsert(_table, aUID, aDate);
+    [_table setObject:aDate forKey:aUID];
int


•   NSCreateMapTable int

    •   NSCreateMapTable(NSIntMapKeyCallBacks,
        NSObjectMapValueCallBacks, 128);

•   NSMutableDictionary

    •   |←    |             (^o^ )
•                   Map

•   Java                  (Generic)

    •   Generic

        •
            •   std::map

                •    C++ !!!!!!
C++ iPhone

•   iPhone        C++

•            Objective-C

•   Objective-C++

    •   (    д)     (   д   )   (д    )

•
    •
    •                                C++   Objective-C++   ...
Objective-C++                           Map (1)
    #ifndef _Pantomime_H_StdMapIntWrapper
    #define _Pantomime_H_StdMapIntWrapper

    #import <Foundation/Foundation.h>

    #ifdef __cplusplus
    #include <map>
    @interface StdMapIntWrapper : NSObject {
    @private
        std::map<int, int> *wrapper_map;
    }
    #else
    @interface StdMapIntWrapper : NSObject {
    @private
        void *wrapper_map;
    }
    #endif

    - (int) valueForKey:(int)aKey;
    - (void) setValue:(int)aValue forKey:(int)aKey;
    - (void) removeValueForKey:(int)aKey;

    @end

    #endif // _Pantomime_H_StdMapIntWrapper
Objective-C++                                   Map (2)
#import <Pantomime/StdMapIntWrapper.h>           - (void) removeValueForKey:(int)aKey
                                                 {
                                                     std::map<int, int>::iterator it;
@implementation StdMapIntWrapper                     it = (* wrapper_map).find(aKey);
                                                     if (it != (* wrapper_map).end())
- (id) init                                          {
{                                                        (* wrapper_map).erase(it);
    self = [super init];                             }
    if (self)                                    }
    {
        wrapper_map = new std::map<int, int>;    - (void) dealloc
    }                                            {
    return self;                                     wrapper_map = NULL;
}                                                    [super dealloc];
                                                 }
- (int) valueForKey:(int)aKey
{                                                @end
    return (* wrapper_map)[aKey];
}

- (void) setValue:(int)aValue forKey:(int)aKey
{
    (* wrapper_map)[aKey] = aValue;
}
//include
+#include <Pantomime/StdMapIntWrapper.h>

//
-static NSMapTable *fd_to_cfsocket;
+static StdMapIntWrapper *fd_to_cfsocket;

//
- fd_to_cfsocket = NSCreateMapTable(NSIntMapKeyCallBacks, NSIntMapValueCallBacks, 16);
+ fd_to_cfsocket = [[StdMapIntWrapper alloc] init];

//
- NSMapInsert(fd_to_cfsocket, (void *)[_connection fd], (void *)_socket);
+ [fd_to_cfsocket setValue:(void *)_socket forKey:(void *)[_connection fd]];

//
- socket = (CFSocketRef)NSMapGet(fd_to_cfsocket, (void*)fd);
+ socket = (CFSocketRef)[fd_to_cfsocket valueForKey:(void*)fd];
: Modified UTF-7



•   Pantomime   Modified UTF-7

    •
•
- (NSString *) modifiedUTF7String
{
    NSString *str = self;
    unichar c;
    uint index = 0;
    BOOL nowBase64 = NO;
    NSMutableString *toBase64String = [[NSMutableString alloc] initWithString:@""];
    NSMutableString *result = [[NSMutableString alloc] initWithString:@""];
    for (; index < [str length]; index++){
        c = [str characterAtIndex:index];
        if ((0x20 <= c && c <= 0x7e)) {
            if (nowBase64) {
                NSString *base64edstr = [self getUTF7Parts:toBase64String];
                 toBase64String = [[NSMutableString alloc] initWithString:@""];
                 [result appendString:base64edstr];
                 [result appendString:@"-"];
                 nowBase64 = NO;
            }
            if (c == 0x26) {
                 [result appendString:@"&-"];
            } else {
                 [result appendString:[NSString stringWithCharacters:&c length:1]];
            }
        } else {
            if (!nowBase64) {
                 nowBase64 = YES;
                 [result appendString:@"&"];
            }
            [toBase64String appendString:[NSString stringWithCharacters:&c length:1]];
        }
    }
    if (nowBase64) {
        NSString *base64edstr = [self getUTF7Parts:toBase64String];
        [result appendString:base64edstr];
        [result appendString:@"-"];
        nowBase64 = NO;
    }
    return result;
}
•   Mac OS X

•   Apple

•
    •   Objective-C++
URL


•   Pantomime

    •   http://www.collaboration-world.com/pantomime

•   Pantomime iOS fork

    •   https://github.com/smellman/Pantomime
(   )

Más contenido relacionado

La actualidad más candente

Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)Mark Baker
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemSages
 
Do we need Unsafe in Java?
Do we need Unsafe in Java?Do we need Unsafe in Java?
Do we need Unsafe in Java?Andrei Pangin
 
sizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may mattersizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may matterDawid Weiss
 
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, ItalyPHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, ItalyPatrick Allaert
 
ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーSatoshi Asano
 
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181Mahmoud Samir Fayed
 
Leveraging Hadoop for Legacy Systems
Leveraging Hadoop for Legacy SystemsLeveraging Hadoop for Legacy Systems
Leveraging Hadoop for Legacy SystemsMathias Herberts
 
Aplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & JetpackAplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & JetpackNelson Glauber Leal
 
The Ring programming language version 1.3 book - Part 87 of 88
The Ring programming language version 1.3 book - Part 87 of 88The Ring programming language version 1.3 book - Part 87 of 88
The Ring programming language version 1.3 book - Part 87 of 88Mahmoud Samir Fayed
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseSages
 
.NET Multithreading and File I/O
.NET Multithreading and File I/O.NET Multithreading and File I/O
.NET Multithreading and File I/OJussi Pohjolainen
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopSages
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181Mahmoud Samir Fayed
 
Gpu programming with java
Gpu programming with javaGpu programming with java
Gpu programming with javaGary Sieling
 
Letswift19-clean-architecture
Letswift19-clean-architectureLetswift19-clean-architecture
Letswift19-clean-architectureJung Kim
 
Rubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for RubyRubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for RubyPrasun Anand
 
[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기NAVER D2
 

La actualidad más candente (20)

Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)Php data structures – beyond spl (online version)
Php data structures – beyond spl (online version)
 
The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84The Ring programming language version 1.2 book - Part 79 of 84
The Ring programming language version 1.2 book - Part 79 of 84
 
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data EcosystemWprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
Wprowadzenie do technologii Big Data / Intro to Big Data Ecosystem
 
Do we need Unsafe in Java?
Do we need Unsafe in Java?Do we need Unsafe in Java?
Do we need Unsafe in Java?
 
sizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may mattersizeof(Object): how much memory objects take on JVMs and when this may matter
sizeof(Object): how much memory objects take on JVMs and when this may matter
 
Realm to Json & Royal
Realm to Json & RoyalRealm to Json & Royal
Realm to Json & Royal
 
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, ItalyPHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy
PHP data structures (and the impact of php 7 on them), phpDay Verona 2015, Italy
 
ARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマーARCでめちゃモテiOSプログラマー
ARCでめちゃモテiOSプログラマー
 
The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181The Ring programming language version 1.5.2 book - Part 10 of 181
The Ring programming language version 1.5.2 book - Part 10 of 181
 
Leveraging Hadoop for Legacy Systems
Leveraging Hadoop for Legacy SystemsLeveraging Hadoop for Legacy Systems
Leveraging Hadoop for Legacy Systems
 
Aplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & JetpackAplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & Jetpack
 
The Ring programming language version 1.3 book - Part 87 of 88
The Ring programming language version 1.3 book - Part 87 of 88The Ring programming language version 1.3 book - Part 87 of 88
The Ring programming language version 1.3 book - Part 87 of 88
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
.NET Multithreading and File I/O
.NET Multithreading and File I/O.NET Multithreading and File I/O
.NET Multithreading and File I/O
 
Wprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache HadoopWprowadzenie do technologi Big Data i Apache Hadoop
Wprowadzenie do technologi Big Data i Apache Hadoop
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181
 
Gpu programming with java
Gpu programming with javaGpu programming with java
Gpu programming with java
 
Letswift19-clean-architecture
Letswift19-clean-architectureLetswift19-clean-architecture
Letswift19-clean-architecture
 
Rubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for RubyRubyconfindia2018 - GPU accelerated libraries for Ruby
Rubyconfindia2018 - GPU accelerated libraries for Ruby
 
[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기[131]해커의 관점에서 바라보기
[131]해커의 관점에서 바라보기
 

Destacado

Defnydd trydan Ysgol y Frenni
Defnydd trydan Ysgol y FrenniDefnydd trydan Ysgol y Frenni
Defnydd trydan Ysgol y FrenniMrs Serena Davies
 
Method Shelters : Another Way to Resolve Class Extension Conflicts
Method Shelters : Another Way to Resolve Class Extension Conflicts Method Shelters : Another Way to Resolve Class Extension Conflicts
Method Shelters : Another Way to Resolve Class Extension Conflicts S Akai
 
RubyistのためのObjective-C入門
RubyistのためのObjective-C入門RubyistのためのObjective-C入門
RubyistのためのObjective-C入門S Akai
 
よくわかるオンドゥル語
よくわかるオンドゥル語よくわかるオンドゥル語
よくわかるオンドゥル語S Akai
 
Romafs
RomafsRomafs
RomafsS Akai
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone developmentVonbo
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C SurvivesS Akai
 
Présentation gnireenigne
Présentation   gnireenignePrésentation   gnireenigne
Présentation gnireenigneCocoaHeads.fr
 

Destacado (9)

Defnydd trydan Ysgol y Frenni
Defnydd trydan Ysgol y FrenniDefnydd trydan Ysgol y Frenni
Defnydd trydan Ysgol y Frenni
 
Tales@tdc
Tales@tdcTales@tdc
Tales@tdc
 
Method Shelters : Another Way to Resolve Class Extension Conflicts
Method Shelters : Another Way to Resolve Class Extension Conflicts Method Shelters : Another Way to Resolve Class Extension Conflicts
Method Shelters : Another Way to Resolve Class Extension Conflicts
 
RubyistのためのObjective-C入門
RubyistのためのObjective-C入門RubyistのためのObjective-C入門
RubyistのためのObjective-C入門
 
よくわかるオンドゥル語
よくわかるオンドゥル語よくわかるオンドゥル語
よくわかるオンドゥル語
 
Romafs
RomafsRomafs
Romafs
 
Beginning to iPhone development
Beginning to iPhone developmentBeginning to iPhone development
Beginning to iPhone development
 
Objective-C Survives
Objective-C SurvivesObjective-C Survives
Objective-C Survives
 
Présentation gnireenigne
Présentation   gnireenignePrésentation   gnireenigne
Présentation gnireenigne
 

Similar a スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた

オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)Ryousei Takano
 
Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to pythonActiveState
 
Happy Go Programming
Happy Go ProgrammingHappy Go Programming
Happy Go ProgrammingLin Yo-An
 
React Native Evening
React Native EveningReact Native Evening
React Native EveningTroy Miles
 
JavaScript in 2015
JavaScript in 2015JavaScript in 2015
JavaScript in 2015Igor Laborie
 
iPhone Development Intro
iPhone Development IntroiPhone Development Intro
iPhone Development IntroLuis Azevedo
 
Parallel Computing in R
Parallel Computing in RParallel Computing in R
Parallel Computing in Rmickey24
 
シェル芸でライフハック(特論)
シェル芸でライフハック(特論)シェル芸でライフハック(特論)
シェル芸でライフハック(特論)Yuki Shimazaki
 
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」techtalkdwango
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical StuffPetr Dvorak
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoMatt Stine
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot CampTroy Miles
 
NSC #2 - Challenge Solution
NSC #2 - Challenge SolutionNSC #2 - Challenge Solution
NSC #2 - Challenge SolutionNoSuchCon
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!Daniel Cousineau
 
ぐだ生 Java入門第三回(文字コードの話)(Keynote版)
ぐだ生 Java入門第三回(文字コードの話)(Keynote版)ぐだ生 Java入門第三回(文字コードの話)(Keynote版)
ぐだ生 Java入門第三回(文字コードの話)(Keynote版)Makoto Yamazaki
 

Similar a スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた (20)

Angular2 for Beginners
Angular2 for BeginnersAngular2 for Beginners
Angular2 for Beginners
 
オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)
 
Migrating from matlab to python
Migrating from matlab to pythonMigrating from matlab to python
Migrating from matlab to python
 
Happy Go Programming
Happy Go ProgrammingHappy Go Programming
Happy Go Programming
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
 
JavaScript in 2015
JavaScript in 2015JavaScript in 2015
JavaScript in 2015
 
iPhone Development Intro
iPhone Development IntroiPhone Development Intro
iPhone Development Intro
 
Parallel Computing in R
Parallel Computing in RParallel Computing in R
Parallel Computing in R
 
シェル芸でライフハック(特論)
シェル芸でライフハック(特論)シェル芸でライフハック(特論)
シェル芸でライフハック(特論)
 
TypeScript
TypeScriptTypeScript
TypeScript
 
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
みゆっき☆Think#4 「こんどはiPhoneに触ってみるよ!」
 
iOS 2 - The practical Stuff
iOS 2 - The practical StuffiOS 2 - The practical Stuff
iOS 2 - The practical Stuff
 
Golang
GolangGolang
Golang
 
A Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to GoA Recovering Java Developer Learns to Go
A Recovering Java Developer Learns to Go
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
 
Metaprogramming
MetaprogrammingMetaprogramming
Metaprogramming
 
NSC #2 - Challenge Solution
NSC #2 - Challenge SolutionNSC #2 - Challenge Solution
NSC #2 - Challenge Solution
 
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
 
ECMA5 and ES6 Promises
ECMA5 and ES6 PromisesECMA5 and ES6 Promises
ECMA5 and ES6 Promises
 
ぐだ生 Java入門第三回(文字コードの話)(Keynote版)
ぐだ生 Java入門第三回(文字コードの話)(Keynote版)ぐだ生 Java入門第三回(文字コードの話)(Keynote版)
ぐだ生 Java入門第三回(文字コードの話)(Keynote版)
 

Más de Taro Matsuzawa

地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2
地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2
地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2Taro Matsuzawa
 
Couchbase hackaton pomo
Couchbase hackaton pomoCouchbase hackaton pomo
Couchbase hackaton pomoTaro Matsuzawa
 
11月のささみ: pgRoutingって何?
11月のささみ: pgRoutingって何?11月のささみ: pgRoutingって何?
11月のささみ: pgRoutingって何?Taro Matsuzawa
 
OSMを使ったスマホ&Web開発入門
OSMを使ったスマホ&Web開発入門OSMを使ったスマホ&Web開発入門
OSMを使ったスマホ&Web開発入門Taro Matsuzawa
 
ゆるふわLinux-HA 〜PostgreSQL編〜
ゆるふわLinux-HA 〜PostgreSQL編〜ゆるふわLinux-HA 〜PostgreSQL編〜
ゆるふわLinux-HA 〜PostgreSQL編〜Taro Matsuzawa
 
AFNetworking使ってみた
AFNetworking使ってみたAFNetworking使ってみた
AFNetworking使ってみたTaro Matsuzawa
 
スマホ開発者も使えるWireshark
スマホ開発者も使えるWiresharkスマホ開発者も使えるWireshark
スマホ開発者も使えるWiresharkTaro Matsuzawa
 
来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall
来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall
来年のLLeventのお知らせ @ OSC2011 Tokyo/FallTaro Matsuzawa
 
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化Taro Matsuzawa
 
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござる
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござるベトナムにRoRを教えに行ったら大変なお土産をもらったでござる
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござるTaro Matsuzawa
 
デバッガを使おう@ブラウザ勉強会#1
デバッガを使おう@ブラウザ勉強会#1デバッガを使おう@ブラウザ勉強会#1
デバッガを使おう@ブラウザ勉強会#1Taro Matsuzawa
 
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser WorkshopTaro Matsuzawa
 
Mozilla コアハッカー育成計画(PDF)
Mozilla コアハッカー育成計画(PDF)Mozilla コアハッカー育成計画(PDF)
Mozilla コアハッカー育成計画(PDF)Taro Matsuzawa
 
Mozilla コアハッカー育成計画
Mozilla コアハッカー育成計画Mozilla コアハッカー育成計画
Mozilla コアハッカー育成計画Taro Matsuzawa
 

Más de Taro Matsuzawa (16)

タイルの話
タイルの話タイルの話
タイルの話
 
地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2
地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2
地球地図を利用した地図タイルの作成 - FOSS4G TOKYO 2014 全体セッション2
 
Couchbase hackaton pomo
Couchbase hackaton pomoCouchbase hackaton pomo
Couchbase hackaton pomo
 
11月のささみ: pgRoutingって何?
11月のささみ: pgRoutingって何?11月のささみ: pgRoutingって何?
11月のささみ: pgRoutingって何?
 
OSMを使ったスマホ&Web開発入門
OSMを使ったスマホ&Web開発入門OSMを使ったスマホ&Web開発入門
OSMを使ったスマホ&Web開発入門
 
ゆるふわLinux-HA 〜PostgreSQL編〜
ゆるふわLinux-HA 〜PostgreSQL編〜ゆるふわLinux-HA 〜PostgreSQL編〜
ゆるふわLinux-HA 〜PostgreSQL編〜
 
AFNetworking使ってみた
AFNetworking使ってみたAFNetworking使ってみた
AFNetworking使ってみた
 
スマホ開発者も使えるWireshark
スマホ開発者も使えるWiresharkスマホ開発者も使えるWireshark
スマホ開発者も使えるWireshark
 
来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall
来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall
来年のLLeventのお知らせ @ OSC2011 Tokyo/Fall
 
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
スマートフォン勉強会@関東 #11 LT 5分で語る SQLite暗号化
 
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござる
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござるベトナムにRoRを教えに行ったら大変なお土産をもらったでござる
ベトナムにRoRを教えに行ったら大変なお土産をもらったでござる
 
デバッガを使おう@ブラウザ勉強会#1
デバッガを使おう@ブラウザ勉強会#1デバッガを使おう@ブラウザ勉強会#1
デバッガを使おう@ブラウザ勉強会#1
 
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop
(元)コミュニティメンバーから見たMozilla / Firefoxの歴史と展望@Browser Workshop
 
デコメを送る
デコメを送るデコメを送る
デコメを送る
 
Mozilla コアハッカー育成計画(PDF)
Mozilla コアハッカー育成計画(PDF)Mozilla コアハッカー育成計画(PDF)
Mozilla コアハッカー育成計画(PDF)
 
Mozilla コアハッカー育成計画
Mozilla コアハッカー育成計画Mozilla コアハッカー育成計画
Mozilla コアハッカー育成計画
 

Último

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterMateoGardella
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...KokoStevan
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 

Último (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 

スマートフォン勉強会@関東 #11 どう考えてもdisconなものをiPhoneに移植してみた

  • 1. discon iPhone Taro Matsuzawa aka btm (@smellman) at sumaben kanto #11
  • 2.
  • 6. 1991 • BL
  • 7. 1997 • • Windows 95 OSR2 • MMX Pentium 200Mhz
  • 8. 1999 • • English Speaking Society (E.S.S.) •
  • 9. 2000 • • • Mozilla Party JP 1.0 ( OSS ) • • • Linux • • E.S.S.
  • 10. 2001 • • • • Tokyo Linux Entertainment Community(TLEC) • WEB
  • 11. 2002 • • • VB ( ) • Mozilla Party 3.0 JP • • •
  • 12. 2003 • • • • Mozilla Party JP 4.0 • • 1000 40
  • 13. 2004 • (5 ) • • • • • ○
  • 14. 2005 • C Magazine 2005/10 2 Firefox Piro C++ •
  • 15. 2006 • • •
  • 16. 2007 • Software Design 2007/04 Firefox ( ) • • ○○ • • •
  • 17. 2008 • • KBMJ • Firefox 3 Hacks ( ) • •
  • 18. 2009 • • • Software Design Firefox 2009.11 2010.04 • OSS EC
  • 19. 2010 • iPhone In App Purchase 2 • • ( )
  • 20. 2011 • ( ) • •
  • 21. iPhone • • iPhone • GUI • •
  • 22. • iPhone • • • IMAP •
  • 23. IMAP?
  • 24. IMAP • • i.softbank.jp • • • •
  • 25. • • • SSL •
  • 26. • ... • • ( )
  • 27. Pantomime Mac OS X/GNUStep LGPL2 • 2007 • • ... • •
  • 28. LGPL2 iPhone • LGPL2 (ex. cocos2d-iphone ) • • • • OK • • • ( • Σ( д lll)
  • 29.
  • 30. Pantomime • Objective-C IMAP/POP/SMTP • Mac OS X GNUStep • • 2007 / 2 / 5 • discon (ry
  • 31. 1 • • Mac OS X 10.2 • • NSDebug • •
  • 32. 2 • GNUStep • • SMTP • ( • iOS • Apple • Apple
  • 33. • NSString cString • NSFileManager fileAttributesAtPath:traverseLink: • xcode •
  • 35. attributesOfItemAtPath:error: - attributes = [[NSFileManager defaultManager] fileAttributesAtPath: thePath traverseLink: NO]; + NSError *error = nil; + attributes = [[NSFileManager defaultManager] attributesOfItemAtPath: thePath error: &error];
  • 36. Pantomime openssl • openssl-xcode openssl iPhone • https://github.com/sjlombardo/openssl-xcode • libcrypt.a libssl.a orz
  • 37. libssl.a openssl-xcode • https://github.com/smellman/openssl-xcode • • libssl.a libcrypt.a
  • 38. GNUStep • GNUStep • #ifdef MACOSX (iOS ) • GNUStep Mac OS X Mac OS X • OK (Search and Destroy)
  • 39. -#ifdef MACOSX #include <Pantomime/CWMacOSXGlue.h> -#endif Mac OS X
  • 40. -#ifdef MACOSX #include <CoreFoundation/CFString.h> #include <CoreFoundation/CFStringEncodingExt.h> -#else -#include <GNUstepBase/GSCategories.h> -#endif else GNUStep
  • 41. iOS • iOS • • • • •
  • 42. NSHost • [[NSHost currentHost] name] • • gethostname • NSString
  • 43. gethostname + char s[65]; + memset(s, 0, sizeof(s)); + gethostname(s, sizeof(s)-1); + NSString *hostName = [NSString stringWithCString:s encoding:NSUTF8StringEncoding]; aMailFile = [NSString stringWithFormat: @"%@:%@", [NSString stringWithFormat: @"%d.%d%d%d.%@", time(NULL), getpid(), rand(), [_cacheManager count], - [[NSHost currentHost] name]], + hostName], ((id)theFlags ? (id)[theFlags maildirString] : (id)@"2,")];
  • 44. NSCalendarDate • iOS Mac OS X Legacy API • Pantomime •
  • 45. NSCalendarDate • NSCalendarDate • NSDate • descriptionWithCalendarFormat • NSDateFormatter • • NSCalendar NSDateCompoments • timeIntervalSince1970 • NSDate
  • 46. - NSCalendarDate *aCalendarDate; + NSCalendar *calendar = [NSCalendar currentCalendar]; + NSDate *aCurrentDate = [[NSData alloc] init]; int days; - // We get the days interval between our two dates aCalendarDate = [NSCalendarDate calendarDate]; w - [aCalendarDate years: NULL - months: NULL - days: &days - hours: NULL - minutes: NULL - seconds: NULL - sinceDate: aDate]; - + NSDateComponents *comps; + NSUInteger flags = NSDayCalendarUnit; + comps = [calendar components:flags + fromDate:aDate + toDate:aCurrentDate + options:0]; + days = (int) [comps day];
  • 47. NSMapTable • NSMapTable typedef struct _NSMapTable NSMapTable; • Mac OS X 10.0 10.4 • • int • NSMapTable iOS
  • 48. NSCreateMapTable • NSCreateMapTable(NSObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 128); • Map NSMutableDictionary
  • 49. NSMutableDictionary // - NSMapTable *_table; + NSMutableDictionary *_table; // - _table = NSCreateMapTable(NSObjectMapKeyCallBacks, NSObjectMapValueCallBacks, 128); + _table = [[NSMutableDictionary alloc] initWithCapacity:128]; // - NSMapInsert(_table, aUID, aDate); + [_table setObject:aDate forKey:aUID];
  • 50. int • NSCreateMapTable int • NSCreateMapTable(NSIntMapKeyCallBacks, NSObjectMapValueCallBacks, 128); • NSMutableDictionary • |← | (^o^ )
  • 51. Map • Java (Generic) • Generic • • std::map • C++ !!!!!!
  • 52. C++ iPhone • iPhone C++ • Objective-C • Objective-C++ • ( д) ( д ) (д ) • • • C++ Objective-C++ ...
  • 53. Objective-C++ Map (1) #ifndef _Pantomime_H_StdMapIntWrapper #define _Pantomime_H_StdMapIntWrapper #import <Foundation/Foundation.h> #ifdef __cplusplus #include <map> @interface StdMapIntWrapper : NSObject { @private std::map<int, int> *wrapper_map; } #else @interface StdMapIntWrapper : NSObject { @private void *wrapper_map; } #endif - (int) valueForKey:(int)aKey; - (void) setValue:(int)aValue forKey:(int)aKey; - (void) removeValueForKey:(int)aKey; @end #endif // _Pantomime_H_StdMapIntWrapper
  • 54. Objective-C++ Map (2) #import <Pantomime/StdMapIntWrapper.h> - (void) removeValueForKey:(int)aKey { std::map<int, int>::iterator it; @implementation StdMapIntWrapper it = (* wrapper_map).find(aKey); if (it != (* wrapper_map).end()) - (id) init { { (* wrapper_map).erase(it); self = [super init]; } if (self) } { wrapper_map = new std::map<int, int>; - (void) dealloc } { return self; wrapper_map = NULL; } [super dealloc]; } - (int) valueForKey:(int)aKey { @end return (* wrapper_map)[aKey]; } - (void) setValue:(int)aValue forKey:(int)aKey { (* wrapper_map)[aKey] = aValue; }
  • 55. //include +#include <Pantomime/StdMapIntWrapper.h> // -static NSMapTable *fd_to_cfsocket; +static StdMapIntWrapper *fd_to_cfsocket; // - fd_to_cfsocket = NSCreateMapTable(NSIntMapKeyCallBacks, NSIntMapValueCallBacks, 16); + fd_to_cfsocket = [[StdMapIntWrapper alloc] init]; // - NSMapInsert(fd_to_cfsocket, (void *)[_connection fd], (void *)_socket); + [fd_to_cfsocket setValue:(void *)_socket forKey:(void *)[_connection fd]]; // - socket = (CFSocketRef)NSMapGet(fd_to_cfsocket, (void*)fd); + socket = (CFSocketRef)[fd_to_cfsocket valueForKey:(void*)fd];
  • 56. : Modified UTF-7 • Pantomime Modified UTF-7 • •
  • 57. - (NSString *) modifiedUTF7String { NSString *str = self; unichar c; uint index = 0; BOOL nowBase64 = NO; NSMutableString *toBase64String = [[NSMutableString alloc] initWithString:@""]; NSMutableString *result = [[NSMutableString alloc] initWithString:@""]; for (; index < [str length]; index++){ c = [str characterAtIndex:index]; if ((0x20 <= c && c <= 0x7e)) { if (nowBase64) { NSString *base64edstr = [self getUTF7Parts:toBase64String]; toBase64String = [[NSMutableString alloc] initWithString:@""]; [result appendString:base64edstr]; [result appendString:@"-"]; nowBase64 = NO; } if (c == 0x26) { [result appendString:@"&-"]; } else { [result appendString:[NSString stringWithCharacters:&c length:1]]; } } else { if (!nowBase64) { nowBase64 = YES; [result appendString:@"&"]; } [toBase64String appendString:[NSString stringWithCharacters:&c length:1]]; } } if (nowBase64) { NSString *base64edstr = [self getUTF7Parts:toBase64String]; [result appendString:base64edstr]; [result appendString:@"-"]; nowBase64 = NO; } return result; }
  • 58. Mac OS X • Apple • • Objective-C++
  • 59. URL • Pantomime • http://www.collaboration-world.com/pantomime • Pantomime iOS fork • https://github.com/smellman/Pantomime
  • 60. ( )