Skip to content
Browse files

Update for iPhone 5

  • Loading branch information...
1 parent 9b4eb78 commit 683e9aa16fca39a507d27e6588efa0d6e326f23b @kishikawakatsumi committed Jan 16, 2013
Showing with 579 additions and 11,608 deletions.
  1. BIN Album.png
  2. BIN Camera.png
  3. +0 −152 Classes/Base64.cpp
  4. +0 −53 Classes/Base64.h
  5. +0 −31 Classes/Base64EncDec.h
  6. +0 −219 Classes/Base64EncDec.m
  7. +0 −47 Classes/CDataScanner.h
  8. +0 −249 Classes/CDataScanner.m
  9. +0 −16 Classes/CDataScanner_Extensions.h
  10. +0 −59 Classes/CDataScanner_Extensions.m
  11. +0 −38 Classes/CJSONDeserializer.h
  12. +0 −63 Classes/CJSONDeserializer.m
  13. +0 −22 Classes/CJSONScanner.h
  14. +0 −515 Classes/CJSONScanner.m
  15. +0 −24 Classes/CJSONSerializer.h
  16. +0 −163 Classes/CJSONSerializer.m
  17. +2 −2 Classes/CocoaCryptoHashing.m
  18. +7 −2 Classes/CommentCell.m
  19. +0 −7 Classes/Debug.h
  20. +4 −2 Classes/Diary.m
  21. +7 −2 Classes/DiaryCell.m
  22. +0 −10 Classes/DiaryCellController.h
  23. +0 −21 Classes/DiaryCellController.m
  24. +7 −1 Classes/DiaryFeedParser.m
  25. +0 −15 Classes/DiaryListCell.h
  26. +0 −91 Classes/DiaryListCell.m
  27. +0 −19 Classes/DiaryListCellSelectedBackgroundView.h
  28. +0 −24 Classes/DiaryListCellSelectedBackgroundView.m
  29. +4 −3 Classes/DiaryListViewController.m
  30. +0 −7 Classes/DiaryNextCell.h
  31. +0 −50 Classes/DiaryNextCell.m
  32. +0 −10 Classes/DiaryNextCellController.h
  33. +0 −20 Classes/DiaryNextCellController.m
  34. +0 −19 Classes/DiaryNextCellSelectedBackgroundView.h
  35. +0 −24 Classes/DiaryNextCellSelectedBackgroundView.m
  36. +0 −9 Classes/DiaryTitleCell.h
  37. +0 −17 Classes/DiaryTitleCell.m
  38. +0 −10 Classes/DiaryTitleCellController.h
  39. +0 −27 Classes/DiaryTitleCellController.m
  40. +8 −1 Classes/DiaryUploader.m
  41. +0 −2 Classes/DiaryViewController.h
  42. +5 −21 Classes/DiaryViewController.m
  43. +10 −2 Classes/EntryCell.m
  44. +0 −19 Classes/EntryCellSelectedBackgroundView.h
  45. +0 −24 Classes/EntryCellSelectedBackgroundView.m
  46. +0 −22 Classes/FeedParser.h
  47. +0 −235 Classes/FeedParser.m
  48. +12 −7 Classes/FotolifeUploader.m
  49. +0 −22 Classes/HUDMessageView.h
  50. +0 −81 Classes/HUDMessageView.m
  51. +2 −1 Classes/HatenaAtomPub.m
  52. +1 −1 Classes/HatenaAtomPubResponseParser.h
  53. +5 −4 Classes/HatenaAtomPubResponseParser.m
  54. +9 −2 Classes/HatenaRSSParser.m
  55. +8 −2 Classes/HatenaSyntaxCell.m
  56. +0 −26 Classes/HatenaSyntaxSheetController.h
  57. +0 −267 Classes/HatenaSyntaxSheetController.m
  58. +2 −1 Classes/HatenaSyntaxViewController.m
  59. +2 −4 Classes/HatenaTouchAppDelegate.m
  60. +0 −6 Classes/HatenaXMLParser.h
  61. +0 −17 Classes/HatenaXMLParser.m
  62. +0 −8 Classes/HotEntryNextCell.h
  63. +0 −21 Classes/HotEntryNextCell.m
  64. +0 −11 Classes/HotEntryNextCellController.h
  65. +0 −21 Classes/HotEntryNextCellController.m
  66. +3 −1 Classes/HotEntryViewController.m
  67. +0 −25 Classes/HttpClient.h
  68. +0 −165 Classes/HttpClient.m
  69. +3 −0 Classes/ImagePreviewViewController.m
  70. +0 −23 Classes/InformationSheetController.h
  71. +0 −118 Classes/InformationSheetController.m
  72. +0 −44 Classes/JSON/JSON.h
  73. +0 −60 Classes/JSON/NSObject+SBJSON.h
  74. +0 −57 Classes/JSON/NSObject+SBJSON.m
  75. +0 −41 Classes/JSON/NSString+SBJSON.h
  76. +0 −60 Classes/JSON/NSString+SBJSON.m
  77. +0 −137 Classes/JSON/SBJSON.h
  78. +0 −740 Classes/JSON/SBJSON.m
  79. +7 −1 Classes/MyBookmarkAPI.m
  80. +0 −15 Classes/MyBookmarkCell.h
  81. +0 −89 Classes/MyBookmarkCell.m
  82. +0 −19 Classes/MyBookmarkCellSelectedBackgroundView.h
  83. +0 −24 Classes/MyBookmarkCellSelectedBackgroundView.m
  84. +7 −1 Classes/MyBookmarkFeedParser.m
  85. +0 −7 Classes/MyBookmarkNextCell.h
  86. +0 −50 Classes/MyBookmarkNextCell.m
  87. +0 −5 Classes/MyBookmarkNextCellController.h
  88. +0 −17 Classes/MyBookmarkNextCellController.m
  89. +0 −19 Classes/MyBookmarkNextCellSelectedBackgroundView.h
  90. +0 −24 Classes/MyBookmarkNextCellSelectedBackgroundView.m
  91. +3 −2 Classes/MyBookmarkViewController.m
  92. +0 −15 Classes/NSCharacterSet_Extensions.h
  93. +0 −27 Classes/NSCharacterSet_Extensions.m
  94. +0 −17 Classes/NSDataAdditions.h
  95. +0 −156 Classes/NSDataAdditions.m
  96. +0 −15 Classes/NSDictionary_JSONExtensions.h
  97. +0 −20 Classes/NSDictionary_JSONExtensions.m
  98. +0 −15 Classes/PageBookmarkCell.h
  99. +0 −22 Classes/PageBookmarkCell.m
  100. +0 −10 Classes/PageBookmarkCellController.h
  101. +0 −20 Classes/PageBookmarkCellController.m
  102. +0 −13 Classes/PageInformationCell.h
  103. +0 −66 Classes/PageInformationCell.m
  104. +1 −0 Classes/Reachability.h
  105. +3 −1 Classes/RecentEntryViewController.m
  106. +7 −15 Classes/RootViewController.m
  107. +6 −2 Classes/SettingViewController.m
  108. +0 −10 Classes/StringHelper.h
  109. +0 −26 Classes/StringHelper.m
  110. +0 −13 Classes/TableCellDrawing.h
  111. +0 −81 Classes/TableCellDrawing.m
  112. +0 −23 Classes/UIImage+ProportionalFill.h
  113. +0 −134 Classes/UIImage+ProportionalFill.m
  114. +0 −15 Classes/UIImage+Tint.h
  115. +0 −54 Classes/UIImage+Tint.m
  116. +17 −0 Classes/UIImage+Utilities.h
  117. +65 −0 Classes/UIImage+Utilities.m
  118. +0 −11 Classes/UserSettingViewController.h
  119. +0 −248 Classes/UserSettingViewController.m
  120. +9 −1 Classes/UserSettings.m
  121. +0 −24 Classes/WBImage.h
  122. +0 −179 Classes/WBImage.m
  123. +0 −22 Classes/XMLParser.h
  124. +0 −101 Classes/XMLParser.m
  125. BIN Comment.png
  126. BIN Default-568h@2x.png
  127. BIN Default.png
  128. BIN Default@2x.png
  129. +0 −423 English.lproj/AddBookmarkView.xib
  130. +0 −317 English.lproj/DiaryCell.xib
  131. +0 −200 English.lproj/DiaryNextCell.xib
  132. +0 −233 English.lproj/DiaryTitleCell.xib
  133. +0 −278 English.lproj/HatenaSyntaxSheet.xib
  134. +0 −273 English.lproj/MainWindow.xib
  135. +0 −214 English.lproj/MyBookmarkNextCell.xib
  136. +0 −336 English.lproj/PageBookmarkCell.xib
  137. +1 −1 English.lproj/help.html
  138. +1 −1 HatenaTouch-Info.plist
  139. +39 −46 HatenaTouch.xcodeproj/project.pbxproj
  140. +7 −0 HatenaTouch.xcodeproj/project.xcworkspace/contents.xcworkspacedata
  141. BIN ...Touch.xcodeproj/project.xcworkspace/xcuserdata/katsumi.xcuserdatad/UserInterfaceState.xcuserstate
  142. +10 −0 ...naTouch.xcodeproj/project.xcworkspace/xcuserdata/katsumi.xcuserdatad/WorkspaceSettings.xcsettings
  143. +90 −0 HatenaTouch.xcodeproj/xcuserdata/katsumi.xcuserdatad/xcschemes/Debug.xcscheme
  144. +86 −0 HatenaTouch.xcodeproj/xcuserdata/katsumi.xcuserdatad/xcschemes/Distoribution.xcscheme
  145. +86 −0 HatenaTouch.xcodeproj/xcuserdata/katsumi.xcuserdatad/xcschemes/Release.xcscheme
  146. +32 −0 HatenaTouch.xcodeproj/xcuserdata/katsumi.xcuserdatad/xcschemes/xcschememanagement.plist
  147. BIN Icon-Small.png
  148. BIN Icon-Small@2x.png
  149. BIN Icon.png
  150. BIN Icon@2x.png
  151. +0 −32 Info.plist
  152. +0 −281 InformationSheet.xib
  153. +0 −423 Japanese.lproj/AddBookmarkView.xib
  154. +0 −317 Japanese.lproj/DiaryCell.xib
  155. +0 −200 Japanese.lproj/DiaryNextCell.xib
  156. +0 −233 Japanese.lproj/DiaryTitleCell.xib
  157. +0 −278 Japanese.lproj/HatenaSyntaxSheet.xib
  158. +0 −273 Japanese.lproj/MainWindow.xib
  159. +0 −216 Japanese.lproj/MyBookmarkNextCell.xib
  160. +0 −336 Japanese.lproj/PageBookmarkCell.xib
  161. +1 −1 Japanese.lproj/help.html
  162. +0 −51 README
  163. +0 −194 RootViewController.xib
  164. BIN Syntax.png
  165. +0 −435 WebView.xib
  166. BIN back.png
  167. BIN book_w_bookmark_small.png
  168. BIN book_w_bookmark_small@2x.png
  169. BIN dialogue.png
  170. BIN forward.png
  171. +0 −1 libxml2.dylib
  172. +0 −24 patch/hatena-touch-jsonliteapi.path
  173. +0 −20 patch/support-private-bookmark.patch
  174. BIN text_background.png
View
BIN Album.png
Deleted file not rendered
View
BIN Camera.png
Deleted file not rendered
View
152 Classes/Base64.cpp
@@ -1,152 +0,0 @@
-
-/*
- _______ .__ .__ .__ .__
- \ \ ____ __ __ _______ |__|| | | | |__| ____ ____
- / | \ _/ __ \ | | \\_ __ \| || | | | | | / _ \ / \
- / | \\ ___/ | | / | | \/| || |__| |__| |( <_> )| | \
- \____|__ / \___ >|____/ |__| |__||____/|____/|__| \____/ |___| /
- =========\/======\/=================================================\/==
- v0.01 19/OCT/2007 © Copyright 2007-2007 Scott D. Yelich SOME RIGHTS RESERVED
-
-
- LICENSE: Creative Commons Attribution 3.0 License.
- SEE: http://creativecommons.org/licenses/by/3.0/
-
-
- Fri Oct 19 23:57:59 EST 2007, v0.01 sdy
-
-*/
-
-// PACKAGE
-
-#include "Base64.h"
-
-
-Base64::Base64() :
- baseChars("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")
-{
-}
-
-Base64::~Base64()
-{
-}
-
-bool
-Base64::isBase64Char (char const c)
-{
- return (base64Char(c) != std::string::npos);
-}
-
-int
-Base64::base64Char (char const c)
-{
- return baseChars.find_first_of(c);
-}
-
-std::string
-Base64::scrub(std::string const & s)
-{
- return scrub(s, baseChars);
-}
-
-std::string
-Base64::scrub(std::string const & so, std::string const & goodchars)
-{
- int loc = 0;
- int nloc = 0;
- std::string s;
- bool process = true;
- while (process) {
- nloc = so.find_first_not_of(goodchars, loc);
- if (nloc != std::string::npos) {
- s.append(so.substr(loc, nloc-loc));
- loc = nloc+1;
- } else {
- process = false;
- }
- }
- s.append(so.substr(loc, so.size()-loc));
- return s;
-}
-
-std::string
-Base64::encode(std::string const & so, int split)
-{
- std::string s;
- std::string r;
- std::string p;
- if (so.size()<1) {
- return r;
- }
- s = so;
- int c = s.size()%3;
- // pad to make length a multiple of 3
- if (c>0) {
- for (; c<3; c++) {
- p.append("=");
- s.append("=");
- }
- }
- int n;
- int n1, n2, n3, n4;
- // go over over length of the string, by 3
- for (c=0; c<s.size(); c+=3) {
- if (0<c && 0<split && ((c/3)*4)%split == 0) {
- r.append("\n");
- }
- // convert 3 8-bit values into 1 24-bit value
- n = (s[c]<<16) + (s[c+1]<<8) + (s[c+2]);
- // split 1 24-bit value into 4 6-bit values
- n1 = (n >> 18) & 63;
- n2 = (n >> 12) & 63;
- n3 = (n >> 6) & 63;
- n4 = (n >> 0) & 63;
- // add each of the 6-bit chars to string via lookup
- r += baseChars[n1];
- r += baseChars[n2];
- r += baseChars[n3];
- r += baseChars[n4];
- }
- if (c>0) {
- r = r.substr(0, r.size()-p.size()).append(p);
- }
- return r;
-}
-
-std::string
-Base64::decode(std::string const & so)
-{
- std::string s;
- std::string r;
- std::string p;
- if (so.size()<1){
- return r;
- }
- s = so;
- // replace padding with 'A' for 0 valued bits...
- if (!s.substr(s.size()-1, 1).compare("=")) {
- p.append("A");
- }
- if (!s.substr(s.size()-2, 1).compare("=")) {
- p.append("A");
- }
- s = scrub(s);
- if (p.size()>0){
- s.append(p);
- }
- int n;
- // go over over length of the string, by 4
- for (int c=0; c<s.size(); c+=4) {
- // each of the 4 char represents 6-bits of the 1 24-bit value
- n = (base64Char(s[c ])<<18) +
- (base64Char(s[c+1])<<12) +
- (base64Char(s[c+2])<< 6) +
- (base64Char(s[c+3])<< 0);
- // split the 1 24-bit value into 3 8-bit values and append as chars
- r += char((n>>16)&255);
- r += char((n>> 8)&255);
- r += char((n>> 0)&255);
- }
- r = r.substr(0, r.size()-p.size());
- return r;
-}
View
53 Classes/Base64.h
@@ -1,53 +0,0 @@
-
-/*
- _______ .__ .__ .__ .__
- \ \ ____ __ __ _______ |__|| | | | |__| ____ ____
- / | \ _/ __ \ | | \\_ __ \| || | | | | | / _ \ / \
- / | \\ ___/ | | / | | \/| || |__| |__| |( <_> )| | \
- \____|__ / \___ >|____/ |__| |__||____/|____/|__| \____/ |___| /
- =========\/======\/=================================================\/==
- v0.01 19/OCT/2007 © Copyright 2007-2007 Scott D. Yelich SOME RIGHTS RESERVED
-
-
- LICENSE: Creative Commons Attribution 3.0 License.
- SEE: http://creativecommons.org/licenses/by/3.0/
-
-
- Fri Oct 19 23:57:59 EST 2007, v0.01 sdy
- Wed Nov 21 21:17:29 EST 2007, v0.02 sdy
-
- This is Base64.h, part of Base64.
-
- See Base64.cpp for implementation details.
-
-*/
-
-#ifndef BASE64_H
-#define BASE64_H
-
-// C++
-
-#include <string>
-
-class Base64
-{
-
- public:
-
- Base64();
- ~Base64();
-
- std::string decode(std::string const & s);
- std::string encode(std::string const & s, int split=0);
- std::string scrub(std::string const & s, std::string const & goodchars);
- std::string scrub(std::string const & s);
- bool isBase64Char(char const c);
- int base64Char(char const c);
-
- private:
-
- std::string baseChars;
-
-};
-
-#endif
View
31 Classes/Base64EncDec.h
@@ -1,31 +0,0 @@
-//
-// Base64EncDec.h
-//
-// Created by Takeshi Yamane on 06/07/03.
-// Copyright 2006 Takeshi Yamane. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-
-@interface NSData (Base64EncDec)
-
-//
-// 公開メソッド
-//
-// Base64文字列をデコードし、NSDataオブジェクトを生成する(ASCII文字列より)
-+ (NSData *)dataWithBase64CString:(const char *)pcBase64 length:(long)lLength;
-
-// Base64文字列をデコードし、NSDataオブジェクトを生成する(NSStringより)
-+ (NSData *)dataWithBase64String:(NSString *)pstrBase64;
-
-// Base64にエンコードした文字列を生成する
-- (NSString *)stringEncodedWithBase64;
-
-//
-// 内部メソッド
-//
-// Base64の文字から変換テーブルのインデックスを求める
-+ (int)indexOfBase64Char:(char)cBase64Char;
-
-@end
View
219 Classes/Base64EncDec.m
@@ -1,219 +0,0 @@
-//
-// Base64EncDec.m
-//
-// Created by Takeshi Yamane on 06/07/03.
-// Copyright 2006 Takeshi Yamane. All rights reserved.
-//
-
-#import "Base64EncDec.h"
-
-//! 符号化/復号化時の変換テーブル
-static const char s_cBase64Tbl[] = {
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
- 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
- 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
- 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
- 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
- 'w', 'x', 'y', 'z', '0', '1', '2', '3',
- '4', '5', '6', '7', '8', '9', '+', '/'
- // '='
- };
-
-// CR/LF
-static NSString *s_pstrCRLF = @"\r\n";
-
-// '-'
-static NSString *s_pstrEqual = @"=";
-
-
-@implementation NSData (Base64EncDec)
-
-//
-// 公開メソッド
-//
-// Base64文字列をデコードし、NSDataオブジェクトを生成する(ASCII文字列より)
-+ (NSData *)dataWithBase64CString:(const char *)pcBase64 length:(long)lLength
-{
- long lCnt;
- int nState, nVal;
- unsigned char cNewData;
- NSMutableData *pdatResult = [NSMutableData data];
-
- // 復号化
- nState = 0;
-
- for ( lCnt = 0; lCnt < lLength && pcBase64[lCnt] != '='; lCnt++ ) {
- // Base64文字をインデックス番号に変換
- nVal = [NSData indexOfBase64Char:pcBase64[lCnt]];
- if ( nVal < 0 || nVal > (64 - 1) ) {
- // 未定義文字はスキップ
- continue;
- }
-
- switch ( nState ) {
- case 0:
- // 先頭6bitの値の場合
- cNewData = nVal << 2;
- break;
-
- case 1:
- // 既にある6bitに次の2bit追加の場合
- cNewData |= (nVal & 0x30) >> 4;
- [pdatResult appendBytes:&cNewData length:1];
-
- // 次の位置の先頭4bit設定
- cNewData = (nVal & 0x0F) << 4;
- break;
-
- case 2:
- // 既にある4bitに次の4bit追加の場合
- cNewData |= (nVal >> 2) & 0x0F;
- [pdatResult appendBytes:&cNewData length:1];
-
- // 次の位置の先頭2bit設定
- cNewData = (nVal & 0x03) << 6;
- break;
-
- case 3:
- // 既にある2bitに次の6bit追加の場合
- cNewData |= nVal & 0x3F;
- [pdatResult appendBytes:&cNewData length:1];
- break;
- }
-
- // 状態更新
- nState++;
- if ( nState > 3 ) {
- // 3byte区切りで元に戻る
- nState = 0;
- }
- }
-
- return pdatResult;
-}
-
-// Base64文字列をデコードし、NSDataオブジェクトを生成する(NSStringより)
-+ (NSData *)dataWithBase64String:(NSString *)pstrBase64
-{
- const char *pcBase64 = [pstrBase64 cStringUsingEncoding:NSASCIIStringEncoding];
- if ( pcBase64 == nil ) {
- return nil;
- }
-
- return [NSData dataWithBase64CString:pcBase64 length:[pstrBase64 lengthOfBytesUsingEncoding:NSASCIIStringEncoding]];
-}
-
-// Base64にエンコードした文字列を生成する
-- (NSString *)stringEncodedWithBase64
-{
- int nState, nIndex, nLineCharCnt;
- unsigned unCnt;
- const unsigned char *pcRawData = [self bytes];
- unsigned unLength = [self length];
-
- NSMutableString *pstrResult = [NSMutableString string];
- nState = 0;
- nLineCharCnt = 0;
- unCnt = 0;
- while ( unCnt < unLength ) {
- switch ( nState ) {
- case 0:
- // バイトの先頭位置の場合
- // →先頭6bitを処理
- nIndex = (pcRawData[unCnt] >> 2) & 0x3F;
- break;
-
- case 1:
- // バイトの残り2bitと次のバイトの先頭4bitの場合
- nIndex = (pcRawData[unCnt] & 0x03) << 4;
- unCnt++;
- if ( unCnt < unLength ) {
- // 次のバイトがある場合のみ
- nIndex |= (pcRawData[unCnt] >> 4) & 0x0F;
- }
- break;
-
- case 2:
- // バイトの残り4bitと次のバイトの先頭2bitの場合
- nIndex = (pcRawData[unCnt] & 0x0F) << 2;
- unCnt++;
- if ( unCnt < unLength ) {
- // 次のバイトがある場合のみ
- nIndex |= (pcRawData[unCnt] >> 6) & 0x03;
- }
- break;
-
- case 3:
- // バイトの残り6bitの場合
- nIndex = pcRawData[unCnt] & 0x03F;
- unCnt++;
- break;
- }
-
- // 変換文字を符号化結果格納領域に設定
- char cConvChar[2];
- cConvChar[0] = s_cBase64Tbl[nIndex];
- cConvChar[1] = '\0';
- [pstrResult appendString:[NSString stringWithCString:cConvChar encoding:NSASCIIStringEncoding]];
- nLineCharCnt++;
- if ( (nLineCharCnt % 76) == 0 ) {
- // 76文字毎の改行コード挿入
- [pstrResult appendString:s_pstrCRLF];
- nLineCharCnt = 0;
- }
-
- // 状態更新
- nState++;
- if ( nState > 3 ) {
- // 3byte区切りで元に戻る
- nState = 0;
- }
- }
-
- // Padding文字決定
- int nPadCnt = 0;
- int i;
- switch ( nState ) {
- case 1:
- case 2:
- // 1バイト目で終わった場合
- nPadCnt = 2;
- break;
- case 3:
- // 2バイト目で終わった場合
- nPadCnt = 1;
- break;
- }
- for ( i = 0; i < nPadCnt; i++ ) {
- [pstrResult appendString:s_pstrEqual];
- nLineCharCnt++;
- if ( (nLineCharCnt % 76) == 0 && i+1 < nPadCnt ) {
- // 76文字毎の改行コード挿入
- [pstrResult appendString:s_pstrCRLF];
- nLineCharCnt = 0;
- }
- }
-
- return pstrResult;
-}
-
-//
-// 内部メソッド
-//
-+ (int)indexOfBase64Char:(char)cBase64Char
-{
- // Base64文字テーブル検索
- int i;
- for ( i = 0; i < 64; i++ ) {
- if ( cBase64Char == s_cBase64Tbl[i] ) {
- //! 該当インデックスを通知
- return i;
- }
- }
-
- // 未定義文字
- return -1;
-}
-
-@end
View
47 Classes/CDataScanner.h
@@ -1,47 +0,0 @@
-//
-// CDataScanner.h
-// TouchJSON
-//
-// Created by Jonathan Wight on 04/16/08.
-// Copyright 2008 Toxic Software. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-// NSScanner
-
-@interface CDataScanner : NSObject {
- NSData *data;
-
- u_int8_t *start;
- u_int8_t *end;
- u_int8_t *current;
- NSUInteger length;
-
- NSCharacterSet *doubleCharacters;
-}
-
-@property (readwrite, nonatomic, retain) NSData *data;
-@property (readwrite, nonatomic, assign) NSUInteger scanLocation;
-@property (readonly, nonatomic, assign) BOOL isAtEnd;
-
-+ (id)scannerWithData:(NSData *)inData;
-
-- (unichar)currentCharacter;
-- (unichar)scanCharacter;
-- (BOOL)scanCharacter:(unichar)inCharacter;
-
-- (BOOL)scanUTF8String:(const char *)inString intoString:(NSString **)outValue;
-- (BOOL)scanString:(NSString *)inString intoString:(NSString **)outValue;
-- (BOOL)scanCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString **)outValue; // inSet must only contain 7-bit ASCII characters
-
-- (BOOL)scanUpToString:(NSString *)string intoString:(NSString **)outValue;
-- (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)outValue; // inSet must only contain 7-bit ASCII characters
-
-- (BOOL)scanNumber:(NSNumber **)outValue;
-
-- (void)skipWhitespace;
-
-- (NSString *)remainingString;
-
-@end
View
249 Classes/CDataScanner.m
@@ -1,249 +0,0 @@
-//
-// CDataScanner.m
-// TouchJSON
-//
-// Created by Jonathan Wight on 04/16/08.
-// Copyright 2008 Toxic Software. All rights reserved.
-//
-
-#import "CDataScanner.h"
-
-#import "CDataScanner_Extensions.h"
-
-@interface CDataScanner ()
-@property (readwrite, nonatomic, retain) NSCharacterSet *doubleCharacters;
-@end
-
-#pragma mark -
-
-inline static unichar CharacterAtPointer(void *start, void *end)
-{
-#pragma unused(end)
-
-const u_int8_t theByte = *(u_int8_t *)start;
-if (theByte & 0x80)
- {
- // TODO -- UNICODE!!!! (well in theory nothing todo here)
- }
-const unichar theCharacter = theByte;
-return(theCharacter);
-}
-
-@implementation CDataScanner
-
-@dynamic data;
-@dynamic scanLocation;
-@dynamic isAtEnd;
-@synthesize doubleCharacters;
-
-+ (id)scannerWithData:(NSData *)inData
-{
-CDataScanner *theScanner = [[[self alloc] init] autorelease];
-theScanner.data = inData;
-return(theScanner);
-}
-
-- (id)init
-{
-if ((self = [super init]) != nil)
- {
- self.doubleCharacters = [NSCharacterSet characterSetWithCharactersInString:@"0123456789eE-."];
- }
-return(self);
-}
-
-- (void)dealloc
-{
-self.data = NULL;
-self.doubleCharacters = NULL;
-//
-[super dealloc];
-}
-
-- (NSUInteger)scanLocation
-{
-return(current - start);
-}
-
-- (NSData *)data
-{
-return(data);
-}
-
-- (void)setData:(NSData *)inData
-{
-if (data != inData)
- {
- if (data)
- {
- [data release];
- data = NULL;
- }
-
- if (inData)
- {
- data = [inData retain];
- //
- start = (u_int8_t *)data.bytes;
- end = start + data.length;
- current = start;
- length = data.length;
- }
- }
-}
-
-- (void)setScanLocation:(NSUInteger)inScanLocation
-{
-current = start + inScanLocation;
-}
-
-- (BOOL)isAtEnd
-{
-return(self.scanLocation >= length);
-}
-
-- (unichar)currentCharacter
-{
-return(CharacterAtPointer(current, end));
-}
-
-#pragma mark -
-
-- (unichar)scanCharacter
-{
-const unichar theCharacter = CharacterAtPointer(current++, end);
-return(theCharacter);
-}
-
-- (BOOL)scanCharacter:(unichar)inCharacter
-{
-unichar theCharacter = CharacterAtPointer(current, end);
-if (theCharacter == inCharacter)
- {
- ++current;
- return(YES);
- }
-else
- return(NO);
-}
-
-- (BOOL)scanUTF8String:(const char *)inString intoString:(NSString **)outValue;
-{
-const size_t theLength = strlen(inString);
-if ((size_t)(end - current) < theLength)
- return(NO);
-if (strncmp((char *)current, inString, theLength) == 0)
- {
- current += theLength;
- if (outValue)
- *outValue = [NSString stringWithUTF8String:inString];
- return(YES);
- }
-return(NO);
-}
-
-- (BOOL)scanString:(NSString *)inString intoString:(NSString **)outValue
-{
-if ((size_t)(end - current) < inString.length)
- return(NO);
-if (strncmp((char *)current, [inString UTF8String], inString.length) == 0)
- {
- current += inString.length;
- if (outValue)
- *outValue = inString;
- return(YES);
- }
-return(NO);
-}
-
-- (BOOL)scanCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString **)outValue
-{
-u_int8_t *P;
-for (P = current; P < end && [inSet characterIsMember:*P] == YES; ++P)
- ;
-
-if (P == current)
- {
- return(NO);
- }
-
-if (outValue)
- {
- *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease];
- }
-
-current = P;
-
-return(YES);
-}
-
-- (BOOL)scanUpToString:(NSString *)inString intoString:(NSString **)outValue
-{
-const char *theToken = [inString UTF8String];
-const char *theResult = strnstr((char *)current, theToken, end - current);
-if (theResult == NULL)
- {
- return(NO);
- }
-
-if (outValue)
- {
- *outValue = [[[NSString alloc] initWithBytes:current length:theResult - (char *)current encoding:NSUTF8StringEncoding] autorelease];
- }
-
-current = (u_int8_t *)theResult;
-
-return(YES);
-}
-
-- (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)inSet intoString:(NSString **)outValue
-{
-u_int8_t *P;
-for (P = current; P < end && [inSet characterIsMember:*P] == NO; ++P)
- ;
-
-if (P == current)
- {
- return(NO);
- }
-
-if (outValue)
- {
- *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease];
- }
-
-current = P;
-
-return(YES);
-}
-
-- (BOOL)scanNumber:(NSNumber **)outValue
-{
-// Replace all of this with a strtod call
-NSString *theString = NULL;
-if ([self scanCharactersFromSet:doubleCharacters intoString:&theString])
- {
- if (outValue)
- *outValue = [NSNumber numberWithDouble:[theString doubleValue]]; // TODO dont use doubleValue
- return(YES);
- }
-return(NO);
-}
-
-- (void)skipWhitespace
-{
-u_int8_t *P;
-for (P = current; P < end && (isspace(*P)); ++P)
- ;
-
-current = P;
-}
-
-- (NSString *)remainingString
-{
-NSData *theRemainingData = [NSData dataWithBytes:current length:end - current];
-NSString *theString = [[[NSString alloc] initWithData:theRemainingData encoding:NSUTF8StringEncoding] autorelease];
-return(theString);
-}
-
-@end
View
16 Classes/CDataScanner_Extensions.h
@@ -1,16 +0,0 @@
-//
-// CDataScanner_Extensions.h
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/08/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import "CDataScanner.h"
-
-@interface CDataScanner (CDataScanner_Extensions)
-
-- (BOOL)scanCStyleComment:(NSString **)outComment;
-- (BOOL)scanCPlusPlusStyleComment:(NSString **)outComment;
-
-@end
View
59 Classes/CDataScanner_Extensions.m
@@ -1,59 +0,0 @@
-//
-// NSScanner_Extensions.m
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/08/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import "CDataScanner_Extensions.h"
-
-#import "NSCharacterSet_Extensions.h"
-
-@implementation CDataScanner (CDataScanner_Extensions)
-
-- (BOOL)scanCStyleComment:(NSString **)outComment
-{
-if ([self scanString:@"/*" intoString:NULL] == YES)
- {
- NSString *theComment = NULL;
- if ([self scanUpToString:@"*/" intoString:&theComment] == NO)
- [NSException raise:NSGenericException format:@"Started to scan a C style comment but it wasn't terminated."];
-
- if ([theComment rangeOfString:@"/*"].location != NSNotFound)
- [NSException raise:NSGenericException format:@"C style comments should not be nested."];
-
- if ([self scanString:@"*/" intoString:NULL] == NO)
- [NSException raise:NSGenericException format:@"C style comment did not end correctly."];
-
- if (outComment != NULL)
- *outComment = theComment;
-
- return(YES);
- }
-else
- {
- return(NO);
- }
-}
-
-- (BOOL)scanCPlusPlusStyleComment:(NSString **)outComment
-{
-if ([self scanString:@"//" intoString:NULL] == YES)
- {
- NSString *theComment = NULL;
- [self scanUpToCharactersFromSet:[NSCharacterSet linebreaksCharacterSet] intoString:&theComment];
- [self scanCharactersFromSet:[NSCharacterSet linebreaksCharacterSet] intoString:NULL];
-
- if (outComment != NULL)
- *outComment = theComment;
-
- return(YES);
- }
-else
- {
- return(NO);
- }
-}
-
-@end
View
38 Classes/CJSONDeserializer.h
@@ -1,38 +0,0 @@
-//
-// CJSONDeserializer.h
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/15/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-extern NSString *const kJSONDeserializerErrorDomain /* = @"CJSONDeserializerErrorDomain" */;
-
-@protocol CDeserializerProtocol <NSObject>
-
-- (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError;
-
-@end
-
-#pragma mark -
-
-@interface CJSONDeserializer : NSObject <CDeserializerProtocol> {
-
-}
-
-+ (id)deserializer;
-
-- (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError;
-
-@end
-
-#pragma mark -
-
-@interface CJSONDeserializer (CJSONDeserializer_Deprecated)
-
-/// You should switch to using deserializeAsDictionary:error: instead.
-- (id)deserialize:(NSData *)inData error:(NSError **)outError;
-
-@end
View
63 Classes/CJSONDeserializer.m
@@ -1,63 +0,0 @@
-//
-// CJSONDeserializer.m
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/15/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import "CJSONDeserializer.h"
-
-#import "CJSONScanner.h"
-#import "CDataScanner.h"
-
-NSString *const kJSONDeserializerErrorDomain /* = @"CJSONDeserializerErrorDomain" */;
-
-@implementation CJSONDeserializer
-
-+ (id)deserializer
-{
-return([[[self alloc] init] autorelease]);
-}
-
-- (id)deserializeAsDictionary:(NSData *)inData error:(NSError **)outError;
-{
-if (inData == NULL || [inData length] == 0)
- {
- if (*outError)
- *outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
-
- return(NULL);
- }
-CJSONScanner *theScanner = [CJSONScanner scannerWithData:inData];
-NSDictionary *theDictionary = NULL;
-if ([theScanner scanJSONDictionary:&theDictionary error:outError] == YES)
- return(theDictionary);
-else
- return(NULL);
-}
-
-@end
-
-#pragma mark -
-
-@implementation CJSONDeserializer (CJSONDeserializer_Deprecated)
-
-- (id)deserialize:(NSData *)inData error:(NSError **)outError
-{
-if (inData == NULL || [inData length] == 0)
- {
- if (*outError)
- *outError = [NSError errorWithDomain:kJSONDeserializerErrorDomain code:-1 userInfo:NULL];
-
- return(NULL);
- }
-CJSONScanner *theScanner = [CJSONScanner scannerWithData:inData];
-id theObject = NULL;
-if ([theScanner scanJSONObject:&theObject error:outError] == YES)
- return(theObject);
-else
- return(NULL);
-}
-
-@end
View
22 Classes/CJSONScanner.h
@@ -1,22 +0,0 @@
-//
-// CJSONScanner.h
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/07/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import "CDataScanner.h"
-
-@interface CJSONScanner : CDataScanner {
-}
-
-- (BOOL)scanJSONObject:(id *)outObject error:(NSError **)outError;
-- (BOOL)scanJSONDictionary:(NSDictionary **)outDictionary error:(NSError **)outError;
-- (BOOL)scanJSONArray:(NSArray **)outArray error:(NSError **)outError;
-- (BOOL)scanJSONStringConstant:(NSString **)outStringConstant error:(NSError **)outError;
-- (BOOL)scanJSONNumberConstant:(NSNumber **)outNumberConstant error:(NSError **)outError;
-
-@end
-
-extern NSString *const kJSONScannerErrorDomain /* = @"CJSONScannerErrorDomain" */;
View
515 Classes/CJSONScanner.m
@@ -1,515 +0,0 @@
-//
-// CJSONScanner.m
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/07/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import "CJSONScanner.h"
-
-#import "NSCharacterSet_Extensions.h"
-#import "CDataScanner_Extensions.h"
-
-#if !defined(TREAT_COMMENTS_AS_WHITESPACE)
-#define TREAT_COMMENTS_AS_WHITESPACE 0
-#endif // !defined(TREAT_COMMENTS_AS_WHITESPACE)
-
-NSString *const kJSONScannerErrorDomain = @"CJSONScannerErrorDomain";
-
-inline static int HexToInt(char inCharacter)
-{
-int theValues[] = { 0x0 /* 48 '0' */, 0x1 /* 49 '1' */, 0x2 /* 50 '2' */, 0x3 /* 51 '3' */, 0x4 /* 52 '4' */, 0x5 /* 53 '5' */, 0x6 /* 54 '6' */, 0x7 /* 55 '7' */, 0x8 /* 56 '8' */, 0x9 /* 57 '9' */, -1 /* 58 ':' */, -1 /* 59 ';' */, -1 /* 60 '<' */, -1 /* 61 '=' */, -1 /* 62 '>' */, -1 /* 63 '?' */, -1 /* 64 '@' */, 0xa /* 65 'A' */, 0xb /* 66 'B' */, 0xc /* 67 'C' */, 0xd /* 68 'D' */, 0xe /* 69 'E' */, 0xf /* 70 'F' */, -1 /* 71 'G' */, -1 /* 72 'H' */, -1 /* 73 'I' */, -1 /* 74 'J' */, -1 /* 75 'K' */, -1 /* 76 'L' */, -1 /* 77 'M' */, -1 /* 78 'N' */, -1 /* 79 'O' */, -1 /* 80 'P' */, -1 /* 81 'Q' */, -1 /* 82 'R' */, -1 /* 83 'S' */, -1 /* 84 'T' */, -1 /* 85 'U' */, -1 /* 86 'V' */, -1 /* 87 'W' */, -1 /* 88 'X' */, -1 /* 89 'Y' */, -1 /* 90 'Z' */, -1 /* 91 '[' */, -1 /* 92 '\' */, -1 /* 93 ']' */, -1 /* 94 '^' */, -1 /* 95 '_' */, -1 /* 96 '`' */, 0xa /* 97 'a' */, 0xb /* 98 'b' */, 0xc /* 99 'c' */, 0xd /* 100 'd' */, 0xe /* 101 'e' */, 0xf /* 102 'f' */, };
-if (inCharacter >= '0' && inCharacter <= 'f')
- return(theValues[inCharacter - '0']);
-else
- return(-1);
-}
-
-@interface CJSONScanner ()
-- (BOOL)scanNotQuoteCharactersIntoString:(NSString **)outValue;
-@end
-
-#pragma mark -
-
-@implementation CJSONScanner
-
-- (id)init
-{
-if ((self = [super init]) != nil)
- {
- }
-return(self);
-}
-
-- (void)dealloc
-{
-//
-[super dealloc];
-}
-
-#pragma mark -
-
-- (void)setData:(NSData *)inData
-{
-NSData *theData = inData;
-if (theData && theData.length >= 4)
- {
- // This code is lame, but it works. Because the first character of any JSON string will always be a (ascii) control character we can work out the Unicode encoding by the bit pattern. See section 3 of http://www.ietf.org/rfc/rfc4627.txt
- const char *theChars = theData.bytes;
- NSStringEncoding theEncoding = NSUTF8StringEncoding;
- if (theChars[0] != 0 && theChars[1] == 0)
- {
- if (theChars[2] != 0 && theChars[3] == 0)
- theEncoding = NSUTF16LittleEndianStringEncoding;
- else if (theChars[2] == 0 && theChars[3] == 0)
- theEncoding = NSUTF32LittleEndianStringEncoding;
- }
- else if (theChars[0] == 0 && theChars[2] == 0 && theChars[3] != 0)
- {
- if (theChars[1] == 0)
- theEncoding = NSUTF32BigEndianStringEncoding;
- else if (theChars[1] != 0)
- theEncoding = NSUTF16BigEndianStringEncoding;
- }
-
- if (theEncoding != NSUTF8StringEncoding)
- {
- NSString *theString = [[NSString alloc] initWithData:theData encoding:theEncoding];
- theData = [theString dataUsingEncoding:NSUTF8StringEncoding];
- [theString release];
- }
- }
-[super setData:theData];
-}
-
-#pragma mark -
-
-- (BOOL)scanJSONObject:(id *)outObject error:(NSError **)outError
-{
-[self skipWhitespace];
-
-id theObject = NULL;
-
-const unichar C = [self currentCharacter];
-switch (C)
- {
- case 't':
- if ([self scanUTF8String:"true" intoString:NULL])
- {
- theObject = [NSNumber numberWithBool:YES];
- }
- break;
- case 'f':
- if ([self scanUTF8String:"false" intoString:NULL])
- {
- theObject = [NSNumber numberWithBool:NO];
- }
- break;
- case 'n':
- if ([self scanUTF8String:"null" intoString:NULL])
- {
- theObject = [NSNull null];
- }
- break;
- case '\"':
- case '\'':
- [self scanJSONStringConstant:&theObject error:outError];
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- case '-':
- [self scanJSONNumberConstant:&theObject error:outError];
- break;
- case '{':
- [self scanJSONDictionary:&theObject error:outError];
- break;
- case '[':
- [self scanJSONArray:&theObject error:outError];
- break;
- default:
-
- break;
- }
-
-if (outObject != NULL)
- *outObject = theObject;
-return(YES);
-}
-
-- (BOOL)scanJSONDictionary:(NSDictionary **)outDictionary error:(NSError **)outError
-{
-NSUInteger theScanLocation = [self scanLocation];
-
-if ([self scanCharacter:'{'] == NO)
- {
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan dictionary. Dictionary that does not start with '{' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-1 userInfo:theUserInfo];
- }
- return(NO);
- }
-
-NSMutableDictionary *theDictionary = [[NSMutableDictionary alloc] init];
-
-while ([self currentCharacter] != '}')
- {
- [self skipWhitespace];
-
- if ([self currentCharacter] == '}')
- break;
-
- NSString *theKey = NULL;
- if ([self scanJSONStringConstant:&theKey error:outError] == NO)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan dictionary. Failed to scan a key.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-2 userInfo:theUserInfo];
- }
- [theDictionary release];
- return(NO);
- }
-
- [self skipWhitespace];
-
- if ([self scanCharacter:':'] == NO)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan dictionary. Key was not terminated with a ':' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-3 userInfo:theUserInfo];
- }
- [theDictionary release];
- return(NO);
- }
-
- id theValue = NULL;
- if ([self scanJSONObject:&theValue error:outError] == NO)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan dictionary. Failed to scan a value.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-4 userInfo:theUserInfo];
- }
- [theDictionary release];
- return(NO);
- }
-
- [theDictionary setValue:theValue forKey:theKey];
-
- [self skipWhitespace];
- if ([self scanCharacter:','] == NO)
- {
- if ([self currentCharacter] != '}')
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan dictionary. Key value pairs not delimited with a ',' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-5 userInfo:theUserInfo];
- }
- [theDictionary release];
- return(NO);
- }
- break;
- }
- else
- {
- [self skipWhitespace];
- if ([self currentCharacter] == '}')
- break;
- }
- }
-
-if ([self scanCharacter:'}'] == NO)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan dictionary. Dictionary not terminated by a '}' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-6 userInfo:theUserInfo];
- }
- [theDictionary release];
- return(NO);
- }
-
-if (outDictionary != NULL)
- *outDictionary = [[theDictionary copy] autorelease];
-
-[theDictionary release];
-
-return(YES);
-}
-
-- (BOOL)scanJSONArray:(NSArray **)outArray error:(NSError **)outError
-{
-NSUInteger theScanLocation = [self scanLocation];
-
-if ([self scanCharacter:'['] == NO)
- {
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan array. Array not started by a '{' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-7 userInfo:theUserInfo];
- }
- return(NO);
- }
-
-NSMutableArray *theArray = [[NSMutableArray alloc] init];
-
-[self skipWhitespace];
-while ([self currentCharacter] != ']')
- {
- NSString *theValue = NULL;
- if ([self scanJSONObject:&theValue error:outError] == NO)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan array. Could not scan a value.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-8 userInfo:theUserInfo];
- }
- [theArray release];
- return(NO);
- }
-
- [theArray addObject:theValue];
-
- [self skipWhitespace];
- if ([self scanCharacter:','] == NO)
- {
- [self skipWhitespace];
- if ([self currentCharacter] != ']')
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan array. Array not terminated by a ']' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-9 userInfo:theUserInfo];
- }
- [theArray release];
- return(NO);
- }
-
- break;
- }
- [self skipWhitespace];
- }
-
-[self skipWhitespace];
-
-if ([self scanCharacter:']'] == NO)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan array. Array not terminated by a ']' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-10 userInfo:theUserInfo];
- }
- [theArray release];
- return(NO);
- }
-
-if (outArray != NULL)
- *outArray = [[theArray copy] autorelease];
-
-[theArray release];
-
-return(YES);
-}
-
-- (BOOL)scanJSONStringConstant:(NSString **)outStringConstant error:(NSError **)outError
-{
-NSUInteger theScanLocation = [self scanLocation];
-
-[self skipWhitespace]; // TODO - i want to remove this method. But breaks unit tests.
-
-NSMutableString *theString = [[NSMutableString alloc] init];
-
-if ([self scanCharacter:'"'] == NO)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan string constant. String not started by a '\"' character.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-11 userInfo:theUserInfo];
- }
- [theString release];
- return(NO);
- }
-
-while ([self scanCharacter:'"'] == NO)
- {
- NSString *theStringChunk = NULL;
- if ([self scanNotQuoteCharactersIntoString:&theStringChunk])
- {
- [theString appendString:theStringChunk];
- }
-
- if ([self scanCharacter:'\\'] == YES)
- {
- unichar theCharacter = [self scanCharacter];
- switch (theCharacter)
- {
- case '"':
- case '\\':
- case '/':
- break;
- case 'b':
- theCharacter = '\b';
- break;
- case 'f':
- theCharacter = '\f';
- break;
- case 'n':
- theCharacter = '\n';
- break;
- case 'r':
- theCharacter = '\r';
- break;
- case 't':
- theCharacter = '\t';
- break;
- case 'u':
- {
- theCharacter = 0;
-
- int theShift;
- for (theShift = 12; theShift >= 0; theShift -= 4)
- {
- const int theDigit = HexToInt([self scanCharacter]);
- if (theDigit == -1)
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan string constant. Unicode character could not be decoded.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-12 userInfo:theUserInfo];
- }
- [theString release];
- return(NO);
- }
- theCharacter |= (theDigit << theShift);
- }
- }
- break;
- default:
- {
- [self setScanLocation:theScanLocation];
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan string constant. Unknown escape code.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-13 userInfo:theUserInfo];
- }
- [theString release];
- return(NO);
- }
- break;
- }
- CFStringAppendCharacters((CFMutableStringRef)theString, &theCharacter, 1);
- }
- }
-
-if (outStringConstant != NULL)
- *outStringConstant = [[theString copy] autorelease];
-
-[theString release];
-
-return(YES);
-}
-
-- (BOOL)scanJSONNumberConstant:(NSNumber **)outNumberConstant error:(NSError **)outError
-{
-NSNumber *theNumber = NULL;
-if ([self scanNumber:&theNumber] == YES)
- {
- if (outNumberConstant != NULL)
- *outNumberConstant = theNumber;
- return(YES);
- }
-else
- {
- if (outError)
- {
- NSDictionary *theUserInfo = [NSDictionary dictionaryWithObjectsAndKeys:
- @"Could not scan number constant.", NSLocalizedDescriptionKey,
- NULL];
- *outError = [NSError errorWithDomain:kJSONScannerErrorDomain code:-14 userInfo:theUserInfo];
- }
- return(NO);
- }
-}
-
-#if TREAT_COMMENTS_AS_WHITESPACE
-- (void)skipWhitespace
-{
-[super skipWhitespace];
-[self scanCStyleComment:NULL];
-[self scanCPlusPlusStyleComment:NULL];
-[super skipWhitespace];
-}
-#endif // TREAT_COMMENTS_AS_WHITESPACE
-
-#pragma mark -
-
-- (BOOL)scanNotQuoteCharactersIntoString:(NSString **)outValue
-{
-u_int8_t *P;
-for (P = current; P < end && *P != '\"' && *P != '\\'; ++P)
- ;
-
-if (P == current)
- {
- return(NO);
- }
-
-if (outValue)
- {
- *outValue = [[[NSString alloc] initWithBytes:current length:P - current encoding:NSUTF8StringEncoding] autorelease];
- }
-
-current = P;
-
-return(YES);
-}
-
-@end
View
24 Classes/CJSONSerializer.h
@@ -1,24 +0,0 @@
-//
-// CJSONSerializer.h
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/07/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import <Foundation/Foundation.h>
-
-@interface CJSONSerializer : NSObject {
-}
-
-+ (id)serializer;
-
-- (NSString *)serializeObject:(id)inObject;
-
-- (NSString *)serializeNull:(NSNull *)inNull;
-- (NSString *)serializeNumber:(NSNumber *)inNumber;
-- (NSString *)serializeString:(NSString *)inString;
-- (NSString *)serializeArray:(NSArray *)inArray;
-- (NSString *)serializeDictionary:(NSDictionary *)inDictionary;
-
-@end
View
163 Classes/CJSONSerializer.m
@@ -1,163 +0,0 @@
-//
-// CJSONSerializer.m
-// TouchJSON
-//
-// Created by Jonathan Wight on 12/07/2005.
-// Copyright 2005 Toxic Software. All rights reserved.
-//
-
-#import "CJSONSerializer.h"
-
-@implementation CJSONSerializer
-
-+ (id)serializer
-{
-return([[[self alloc] init] autorelease]);
-}
-
-- (NSString *)serializeObject:(id)inObject;
-{
-NSString *theResult = @"";
-
-if ([inObject isKindOfClass:[NSNull class]])
- {
- theResult = [self serializeNull:inObject];
- }
-else if ([inObject isKindOfClass:[NSNumber class]])
- {
- theResult = [self serializeNumber:inObject];
- }
-else if ([inObject isKindOfClass:[NSString class]])
- {
- theResult = [self serializeString:inObject];
- }
-else if ([inObject isKindOfClass:[NSArray class]])
- {
- theResult = [self serializeArray:inObject];
- }
-else if ([inObject isKindOfClass:[NSDictionary class]])
- {
- theResult = [self serializeDictionary:inObject];
- }
-else if ([inObject isKindOfClass:[NSData class]])
- {
- NSString *theString = [[[NSString alloc] initWithData:inObject encoding:NSUTF8StringEncoding] autorelease];
- theResult = [self serializeString:theString];
- }
-else
- {
- [NSException raise:NSGenericException format:@"Cannot serialize data of type '%@'", NSStringFromClass([inObject class])];
- }
-if (theResult == NULL)
- [NSException raise:NSGenericException format:@"Could not serialize object '%@'", inObject];
-return(theResult);
-}
-
-- (NSString *)serializeNull:(NSNull *)inNull
-{
-#pragma unused (inNull)
-return(@"null");
-}
-
-- (NSString *)serializeNumber:(NSNumber *)inNumber
-{
-NSString *theResult = NULL;
-switch (CFNumberGetType((CFNumberRef)inNumber))
- {
- case kCFNumberCharType:
- {
- int theValue = [inNumber intValue];
- if (theValue == 0)
- theResult = @"false";
- else if (theValue == 1)
- theResult = @"true";
- else
- theResult = [inNumber stringValue];
- }
- break;
- case kCFNumberSInt8Type:
- case kCFNumberSInt16Type:
- case kCFNumberSInt32Type:
- case kCFNumberSInt64Type:
- case kCFNumberFloat32Type:
- case kCFNumberFloat64Type:
- case kCFNumberShortType:
- case kCFNumberIntType:
- case kCFNumberLongType:
- case kCFNumberLongLongType:
- case kCFNumberFloatType:
- case kCFNumberDoubleType:
- case kCFNumberCFIndexType:
- default:
- theResult = [inNumber stringValue];
- break;
- }
-return(theResult);
-}
-
-- (NSString *)serializeString:(NSString *)inString
-{
-NSMutableString *theMutableCopy = [[inString mutableCopy] autorelease];
-[theMutableCopy replaceOccurrencesOfString:@"\\" withString:@"\\\\" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-[theMutableCopy replaceOccurrencesOfString:@"\"" withString:@"\\\"" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-[theMutableCopy replaceOccurrencesOfString:@"/" withString:@"\\/" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-[theMutableCopy replaceOccurrencesOfString:@"\b" withString:@"\\b" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-[theMutableCopy replaceOccurrencesOfString:@"\f" withString:@"\\f" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-[theMutableCopy replaceOccurrencesOfString:@"\n" withString:@"\\n" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-[theMutableCopy replaceOccurrencesOfString:@"\n" withString:@"\\n" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-[theMutableCopy replaceOccurrencesOfString:@"\t" withString:@"\\t" options:0 range:NSMakeRange(0, [theMutableCopy length])];
-/*
- case 'u':
- {
- theCharacter = 0;
-
- int theShift;
- for (theShift = 12; theShift >= 0; theShift -= 4)
- {
- int theDigit = HexToInt([self scanCharacter]);
- if (theDigit == -1)
- {
- [self setScanLocation:theScanLocation];
- return(NO);
- }
- theCharacter |= (theDigit << theShift);
- }
- }
-*/
-return([NSString stringWithFormat:@"\"%@\"", theMutableCopy]);
-}
-
-- (NSString *)serializeArray:(NSArray *)inArray
-{
-NSMutableString *theString = [NSMutableString string];
-
-NSEnumerator *theEnumerator = [inArray objectEnumerator];
-id theValue = NULL;
-while ((theValue = [theEnumerator nextObject]) != NULL)
- {
- [theString appendString:[self serializeObject:theValue]];
- if (theValue != [inArray lastObject])
- [theString appendString:@","];
- }
-return([NSString stringWithFormat:@"[%@]", theString]);
-}
-
-- (NSString *)serializeDictionary:(NSDictionary *)inDictionary
-{
-NSMutableString *theString = [NSMutableString string];
-
-NSArray *theKeys = [inDictionary allKeys];
-NSEnumerator *theEnumerator = [theKeys objectEnumerator];
-NSString *theKey = NULL;
-while ((theKey = [theEnumerator nextObject]) != NULL)
- {
- id theValue = [inDictionary objectForKey:theKey];
-
- [theString appendFormat:@"%@:%@", [self serializeString:theKey], [self serializeObject:theValue]];
- if (theKey != [theKeys lastObject])
- [theString appendString:@","];
- }
-return([NSString stringWithFormat:@"{%@}", theString]);
-}
-
-@end
View
4 Classes/CocoaCryptoHashing.m
@@ -55,7 +55,7 @@ - (NSString *)md5HexHash
MD5([self bytes],[self length],digest);
for(i=0;i<MD5_DIGEST_LENGTH;i++) sprintf(finaldigest+i*2,"%02x",digest[i]);
- return [NSString stringWithCString:finaldigest length:2*MD5_DIGEST_LENGTH];
+ return [NSString stringWithCString:finaldigest encoding:NSUTF8StringEncoding];
}
- (NSData *)md5Hash
@@ -76,7 +76,7 @@ - (NSString *)sha1HexHash
SHA1([self bytes],[self length],digest);
for(i=0;i<SHA_DIGEST_LENGTH;i++) sprintf(finaldigest+i*2,"%02x",digest[i]);
- return [NSString stringWithCString:finaldigest length:2*SHA_DIGEST_LENGTH];
+ return [NSString stringWithCString:finaldigest encoding:NSUTF8StringEncoding];
}
- (NSData *)sha1Hash
View
9 Classes/CommentCell.m
@@ -18,7 +18,8 @@ @interface CommentCellContentView : UIView {
@implementation CommentCellContentView
- (id)initWithFrame:(CGRect)frame cell:(CommentCell *)tableCell {
- if (self = [super initWithFrame:frame]) {
+ self = [super initWithFrame:frame];
+ if (self) {
cell = tableCell;
self.opaque = YES;
self.backgroundColor = cell.backgroundColor;
@@ -58,8 +59,12 @@ - (BOOL)isHighlighted {
@implementation CommentCell
+@synthesize comment;
+@synthesize user;
+
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
+ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+ if (self) {
cellContentView = [[CommentCellContentView alloc] initWithFrame:CGRectInset(self.contentView.bounds, 0.0f, 1.0f) cell:self];
cellContentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
cellContentView.contentMode = UIViewContentModeRedraw;
View
7 Classes/Debug.h
@@ -1,7 +0,0 @@
-#ifdef DEBUG
-# define LOG(...) NSLog(__VA_ARGS__)
-# define LOG_CURRENT_METHOD NSLog(@"%@/%@", NSStringFromClass([self class]), NSStringFromSelector(_cmd))
-#else
-# define LOG(...) ;
-# define LOG_CURRENT_METHOD ;
-#endif
View
6 Classes/Diary.m
@@ -6,15 +6,17 @@ @implementation Diary
@synthesize diaryText;
- (id)init {
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
titleText = [[NSString alloc] init];
diaryText = [[NSString alloc] init];
}
return self;
}
- (id)initWithTitle:(NSString *)title text:(NSString *)text {
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
titleText = [title retain];
diaryText = [text retain];
}
View
9 Classes/DiaryCell.m
@@ -34,7 +34,8 @@ + (void)initialize {
}
- (id)initWithFrame:(CGRect)frame cell:(DiaryCell *)tableCell {
- if (self = [super initWithFrame:frame]) {
+ self = [super initWithFrame:frame];
+ if (self) {
cell = tableCell;
self.opaque = YES;
self.backgroundColor = cell.backgroundColor;
@@ -68,8 +69,12 @@ - (BOOL)isHighlighted {
@implementation DiaryCell
+@synthesize title;
+@synthesize date;
+
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
+ self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+ if (self) {
cellContentView = [[DiaryCellContentView alloc] initWithFrame:CGRectInset(self.contentView.bounds, 0.0f, 1.0f) cell:self];
cellContentView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
cellContentView.contentMode = UIViewContentModeRedraw;
View
10 Classes/DiaryCellController.h
@@ -1,10 +0,0 @@
-#import <UIKit/UIKit.h>
-#import "DiaryCell.h"
-
-@interface DiaryCellController : UIViewController {
- IBOutlet DiaryCell *cell;
-}
-
-@property (nonatomic, retain) DiaryCell *cell;
-
-@end
View
21 Classes/DiaryCellController.m
@@ -1,21 +0,0 @@
-#import "DiaryCellController.h"
-
-@implementation DiaryCellController
-
-@synthesize cell;
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- return (interfaceOrientation == UIInterfaceOrientationPortrait);
-}
-
-- (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
-}
-
-- (void)dealloc {
- [cell release];
- [super dealloc];
-}
-
-
-@end
View
8 Classes/DiaryFeedParser.m
@@ -25,13 +25,19 @@ - (void)endDocument;
@implementation DiaryFeedParser
+@synthesize delegate;
+@synthesize request;
+@synthesize connection;
+@synthesize diaries;
+
- (void)commonInit {
diaries = [[NSMutableDictionary alloc] init];
[diaries setObject:[NSMutableArray array] forKey:@"entries"];
}
- (id)init {
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
[self commonInit];
}
View
15 Classes/DiaryListCell.h
@@ -1,15 +0,0 @@
-#import <UIKit/UIKit.h>
-
-@interface DiaryListCell : UITableViewCell {
- NSString *titleText;
- NSString *dateText;
- NSString *numberText;
-}
-
-@property (nonatomic, retain) NSString *titleText;
-@property (nonatomic, retain) NSString *dateText;
-@property (nonatomic, retain) NSString *numberText;
-
-- (void)drawSelectedBackgroundRect:(CGRect)rect;
-
-@end
View
91 Classes/DiaryListCell.m
@@ -1,91 +0,0 @@
-#import "DiaryListCell.h"
-#import "DiaryListCellSelectedBackgroundView.h"
-#import "TableCellDrawing.h"
-
-@implementation DiaryListCell
-
-@synthesize titleText;
-@synthesize dateText;
-@synthesize numberText;
-
-static UIColor *blueColor = NULL;
-static UIColor *grayColor = NULL;
-static UIColor *darkGrayColor = NULL;
-
-+ (void)initialize {
- blueColor = [[UIColor colorWithRed:0.0f green:0.2f blue:1.0f alpha:1.0f] retain];
- grayColor = [[UIColor colorWithRed:0.4f green:0.4f blue:0.4f alpha:1.0f] retain];
- darkGrayColor = [[UIColor colorWithRed:0.2f green:0.2f blue:0.2f alpha:1.0f] retain];
-}
-
-- (void)setTitleText:(NSString *)text {
- if (titleText != text) {
- [titleText release];
- titleText = [text retain];
- [self setNeedsDisplay];
- }
-}
-
-- (void)setDateText:(NSString *)text {
- if (dateText != text) {
- [dateText release];
- dateText = [text retain];
- [self setNeedsDisplay];
- }
-}
-
-- (void)setNumberText:(NSString *)text {
- if (numberText != text) {
- [numberText release];
- numberText = [text retain];
- [self setNeedsDisplay];
- }
-}
-
-- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier {
- if (self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) {
- [self setAccessoryType:UITableViewCellAccessoryDisclosureIndicator];
- [self setOpaque:YES];
-
- DiaryListCellSelectedBackgroundView *selectedBackgroundView = [[DiaryListCellSelectedBackgroundView alloc] initWithFrame:[self frame]];
- [selectedBackgroundView setCell:self];
- [self setSelectedBackgroundView:selectedBackgroundView];
- [selectedBackgroundView release];
- }
- return self;
-}
-
-- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
- [self setNeedsDisplay];
- [self.selectedBackgroundView setNeedsDisplay];
-}
-
-- (void)drawRect:(CGRect)rect {
- [super drawRect:rect];
- [blueColor set];
- [titleText drawInRect:CGRectMake(20.0f, 3.0f, 277.0f, 37.0f) withFont:[UIFont boldSystemFontOfSize:14.0f] lineBreakMode:UILineBreakModeTailTruncation];
- [darkGrayColor set];
- [dateText drawInRect:CGRectMake(20.0f, 42.0f, 277.0f, 24.0f) withFont:[UIFont systemFontOfSize:12.0f] lineBreakMode:UILineBreakModeTailTruncation alignment:UITextAlignmentRight];
- [[UIColor blackColor] set];
- [numberText drawInRect:CGRectMake(0.0f, 26.0f, 16.0f, 21.0f) withFont:[UIFont systemFontOfSize:9.0f] lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentRight];
-}
-
-- (void)drawSelectedBackgroundRect:(CGRect)rect {
- CGGradientRef gradientForSelected = createTwoColorsGradient(5, 140, 245, 1, 93, 230);
- drawRoundedRectBackgroundGradient(rect, gradientForSelected, NO, NO, NO);
- CGGradientRelease(gradientForSelected);
- [[UIColor whiteColor] set];
- [titleText drawInRect:CGRectMake(20.0f, 3.0f, 277.0f, 37.0f) withFont:[UIFont boldSystemFontOfSize:14.0f] lineBreakMode:UILineBreakModeTailTruncation];
- [dateText drawInRect:CGRectMake(20.0f, 42.0f, 277.0f, 24.0f) withFont:[UIFont systemFontOfSize:12.0f] lineBreakMode:UILineBreakModeTailTruncation alignment:UITextAlignmentRight];
- [numberText drawInRect:CGRectMake(0.0f, 26.0f, 16.0f, 21.0f) withFont:[UIFont systemFontOfSize:9.0f] lineBreakMode:UILineBreakModeClip alignment:UITextAlignmentRight];
-}
-
-- (void)dealloc {
- [titleText release];
- [dateText release];
- [numberText release];
- [super dealloc];
-}
-
-@end
View
19 Classes/DiaryListCellSelectedBackgroundView.h
@@ -1,19 +0,0 @@
-//
-// DiaryListCellSelectedBackgroundView.h
-// HatenaTouch
-//
-// Created by KISHIKAWA Katsumi on 09/08/30.
-// Copyright 2009 KISHIKAWA Katsumi. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@class DiaryListCell;
-
-@interface DiaryListCellSelectedBackgroundView : UIView {
- DiaryListCell *cell;
-}
-
-@property (nonatomic, assign) DiaryListCell *cell;
-
-@end
View
24 Classes/DiaryListCellSelectedBackgroundView.m
@@ -1,24 +0,0 @@
-//
-// DiaryListCellSelectedBackgroundView.m
-// HatenaTouch
-//
-// Created by KISHIKAWA Katsumi on 09/08/30.
-// Copyright 2009 KISHIKAWA Katsumi. All rights reserved.
-//
-
-#import "DiaryListCellSelectedBackgroundView.h"
-#import "DiaryListCell.h"
-
-@implementation DiaryListCellSelectedBackgroundView
-
-@synthesize cell;
-
-- (void)drawRect:(CGRect)rect {
- [cell drawSelectedBackgroundRect:rect];
-}
-
-- (void)dealloc {
- [super dealloc];
-}
-
-@end
View
7 Classes/DiaryListViewController.m
@@ -34,7 +34,8 @@ + (void)initialize {
}
- (id)init {
- if (self = [super init]) {
+ self = [super init];
+ if (self) {
data = [[NSMutableArray alloc] initWithCapacity:30];
page = 1;
hasMoreData = YES;
@@ -325,7 +326,7 @@ - (void)parser:(DiaryFeedParser *)parser encounteredError:(NSError *)error {
}
- (void)parserFinished:(DiaryFeedParser *)p {
- if ([[parser.diaries objectForKey:@"entries"] count] < 20) {
+ if ([[p.diaries objectForKey:@"entries"] count] < 20) {
hasMoreData = NO;
dotImageView.hidden = NO;
[activityIndicator stopAnimating];
@@ -370,7 +371,7 @@ - (void)diaryUploader:(DiaryUploader *)diaryUploader uploadFailed:(NSError *)err