Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: ios/chrome/common/string_util.mm

Issue 2503483002: [ObjC ARC] Converts ios/chrome/common to ARC (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/common/material_timing.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ios/chrome/common/string_util.h" 5 #include "ios/chrome/common/string_util.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/scoped_block.h" 10 #include "base/mac/scoped_block.h"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 14
15 #if !defined(__has_feature) || !__has_feature(objc_arc)
16 #error "This file requires ARC support."
17 #endif
18
15 namespace { 19 namespace {
16 typedef BOOL (^ArrayFilterProcedure)(id object, NSUInteger index, BOOL* stop); 20 typedef BOOL (^ArrayFilterProcedure)(id object, NSUInteger index, BOOL* stop);
17 typedef NSString* (^SubstringExtractionProcedure)(NSUInteger); 21 typedef NSString* (^SubstringExtractionProcedure)(NSUInteger);
18 } 22 }
19 23
20 NSString* ParseStringWithLink(NSString* text, NSRange* out_link_range) { 24 NSString* ParseStringWithLink(NSString* text, NSRange* out_link_range) {
21 // Find the range within |text| and create a substring without the link tags. 25 // Find the range within |text| and create a substring without the link tags.
22 NSRange begin_range = [text rangeOfString:@"BEGIN_LINK[ \t]*" 26 NSRange begin_range = [text rangeOfString:@"BEGIN_LINK[ \t]*"
23 options:NSRegularExpressionSearch]; 27 options:NSRegularExpressionSearch];
24 NSRange link_text_range = NSMakeRange(NSNotFound, 0); 28 NSRange link_text_range = NSMakeRange(NSNotFound, 0);
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 else { 173 else {
170 substring = getSubstring.get()(characters - increment); 174 substring = getSubstring.get()(characters - increment);
171 break; // Growing the string, found the right size. 175 break; // Growing the string, found the right size.
172 } 176 }
173 } 177 }
174 prevWidth = thisWidth; 178 prevWidth = thisWidth;
175 } while (characters > 0 && characters < [string length]); 179 } while (characters > 0 && characters < [string length]);
176 180
177 return substring; 181 return substring;
178 } 182 }
OLDNEW
« no previous file with comments | « ios/chrome/common/material_timing.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698