forked from organicmaps/organicmaps
[ios] Replace [NSString stringWithUTF8String:str] with modern Objective-C 2.0 syntax (@(str)).
This commit is contained in:
parent
de370da0c3
commit
f88c9b2843
18 changed files with 60 additions and 60 deletions
|
@ -126,7 +126,7 @@ extern NSString * const MapsStatusChangedNotification;
|
|||
|
||||
- (NSString *)selectedMapName
|
||||
{
|
||||
return [NSString stringWithUTF8String:self.mapsLayout.GetCountryName(self.selectedGroup, self.selectedPosition).c_str()];
|
||||
return @(self.mapsLayout.GetCountryName(self.selectedGroup, self.selectedPosition).c_str());
|
||||
}
|
||||
|
||||
- (uint64_t)selectedMapSizeWithOptions:(MapOptions)options
|
||||
|
@ -247,7 +247,7 @@ extern NSString * const MapsStatusChangedNotification;
|
|||
BOOL const isLast = (indexPath.row == numberOfRows - 1);
|
||||
BOOL const isFirst = (indexPath.row == 0);
|
||||
|
||||
cell.titleLabel.text = [NSString stringWithUTF8String:self.mapsLayout.GetCountryName(group, position).c_str()];
|
||||
cell.titleLabel.text = @(self.mapsLayout.GetCountryName(group, position).c_str());
|
||||
cell.parentMode = NO;
|
||||
cell.status = status;
|
||||
cell.options = options;
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
BookmarkCategory const * cat = GetFramework().GetBmCategory(indexPath.row);
|
||||
if (cat)
|
||||
{
|
||||
NSString * title = [NSString stringWithUTF8String:cat->GetName().c_str()];
|
||||
NSString * title = @(cat->GetName().c_str());
|
||||
cell.textLabel.text = [self truncateString:title toWidth:(self.tableView.width - 122) withFont:cell.textLabel.font];
|
||||
cell.imageView.image = [UIImage imageNamed:(cat->IsVisible() ? @"eye" : @"empty")];
|
||||
cell.detailTextLabel.text = [NSString stringWithFormat:@"%ld", cat->GetBookmarksCount() + cat->GetTracksCount()];
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
{
|
||||
m_locationManager = [MapsAppDelegate theApp].m_locationManager;
|
||||
m_categoryIndex = index;
|
||||
self.title = [NSString stringWithUTF8String:GetFramework().GetBmCategory(index)->GetName().c_str()];
|
||||
self.title = @(GetFramework().GetBmCategory(index)->GetName().c_str());
|
||||
[self calculateSections];
|
||||
}
|
||||
return self;
|
||||
|
@ -132,7 +132,7 @@
|
|||
cell.detailTextLabel.text = nil;
|
||||
[cell.contentView addSubview:f];
|
||||
}
|
||||
((UITextField *)[cell.contentView viewWithTag:TEXTFIELD_TAG]).text = [NSString stringWithUTF8String:cat->GetName().c_str()];
|
||||
((UITextField *)[cell.contentView viewWithTag:TEXTFIELD_TAG]).text = @(cat->GetName().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -156,7 +156,7 @@
|
|||
if (!cell)
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"TrackCell"];
|
||||
Track const * tr = cat->GetTrack(indexPath.row);
|
||||
cell.textLabel.text = [NSString stringWithUTF8String:tr->GetName().c_str()];
|
||||
cell.textLabel.text = @(tr->GetName().c_str());
|
||||
string dist;
|
||||
if (MeasurementUtils::FormatDistance(tr->GetLengthMeters(), dist))
|
||||
//Change Length before release!!!
|
||||
|
@ -175,8 +175,8 @@
|
|||
Bookmark const * bm = cat->GetBookmark(indexPath.row);
|
||||
if (bm)
|
||||
{
|
||||
bmCell.bmName.text = [NSString stringWithUTF8String:bm->GetName().c_str()];
|
||||
bmCell.imageView.image = [CircleView createCircleImageWith:PINDIAMETER andColor:[ColorPickerView colorForName:[NSString stringWithUTF8String:bm->GetType().c_str()]]];
|
||||
bmCell.bmName.text = @(bm->GetName().c_str());
|
||||
bmCell.imageView.image = [CircleView createCircleImageWith:PINDIAMETER andColor:[ColorPickerView colorForName:@(bm->GetType().c_str())]];
|
||||
|
||||
// Get current position and compass "north" direction
|
||||
double azimut = -1.0;
|
||||
|
@ -190,7 +190,7 @@
|
|||
string distance;
|
||||
fr.GetDistanceAndAzimut(bm->GetOrg(), lat, lon, north, distance, azimut);
|
||||
|
||||
bmCell.bmDistance.text = [NSString stringWithUTF8String:distance.c_str()];
|
||||
bmCell.bmDistance.text = @(distance.c_str());
|
||||
}
|
||||
else
|
||||
bmCell.bmDistance.text = nil;
|
||||
|
@ -267,7 +267,7 @@
|
|||
if (![catName length])
|
||||
[catName setString:@"MapsMe"];
|
||||
|
||||
NSString * filePath = [NSString stringWithUTF8String:cat->GetFileName().c_str()];
|
||||
NSString * filePath = @(cat->GetFileName().c_str());
|
||||
NSMutableString * kmzFile = [NSMutableString stringWithString:filePath];
|
||||
[kmzFile replaceCharactersInRange:NSMakeRange([filePath length] - 1, 1) withString:@"z"];
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
{
|
||||
BookmarkCategory * cat = GetFramework().GetBmCategory(indexPath.row);
|
||||
if (cat)
|
||||
cell.textLabel.text = [NSString stringWithUTF8String:cat->GetName().c_str()];
|
||||
cell.textLabel.text = @(cat->GetName().c_str());
|
||||
|
||||
BookmarkAndCategory const bac = self.manager.entity.bac;
|
||||
|
||||
|
@ -115,7 +115,7 @@
|
|||
entity.bac = bac;
|
||||
|
||||
BookmarkCategory const * category = GetFramework().GetBookmarkManager().GetBmCategory(bac.first);
|
||||
entity.bookmarkCategory = [NSString stringWithUTF8String:category->GetName().c_str()];
|
||||
entity.bookmarkCategory = @(category->GetName().c_str());
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
uint64_t totalRoutingSize = 0;
|
||||
for (auto const & i : indexes)
|
||||
{
|
||||
[titles addObject:[NSString stringWithUTF8String:a.GetCountryName(i).c_str()]];
|
||||
[titles addObject:@(a.GetCountryName(i).c_str())];
|
||||
totalRoutingSize += a.GetCountrySize(i, isMaps ? MapOptions::MapWithCarRouting : MapOptions::CarRouting).second;
|
||||
}
|
||||
self.isMapsFiles = isMaps;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
- (void)show
|
||||
{
|
||||
self.titleLabel.text = [NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetAppTitle().c_str()];
|
||||
self.titleLabel.text = @(GetFramework().GetApiDataHolder().GetAppTitle().c_str());
|
||||
[self.delegate.view insertSubview:self.rootView belowSubview:self.delegate.searchView];
|
||||
self.rootView.width = self.delegate.view.width;
|
||||
self.rootView.maxY = 0.0;
|
||||
|
@ -66,7 +66,7 @@
|
|||
|
||||
- (IBAction)backButtonTouchUpInside:(UIButton *)sender
|
||||
{
|
||||
NSURL * url = [NSURL URLWithString:[NSString stringWithUTF8String:GetFramework().GetApiDataHolder().GetGlobalBackUrl().c_str()]];
|
||||
NSURL * url = [NSURL URLWithString:@(GetFramework().GetApiDataHolder().GetGlobalBackUrl().c_str())];
|
||||
[[UIApplication sharedApplication] openURL:url];
|
||||
[self hideBarAndClearAnimated:NO];
|
||||
}
|
||||
|
|
|
@ -89,12 +89,12 @@ using feature::Metadata;
|
|||
f.FindClosestPOIMetadata(point, metadata);
|
||||
f.GetAddressInfoForGlobalPoint(point, info);
|
||||
|
||||
self.bookmarkTitle = [NSString stringWithUTF8String:data.GetName().c_str()];
|
||||
self.bookmarkCategory = [NSString stringWithUTF8String:category->GetName().c_str()];
|
||||
self.bookmarkTitle = @(data.GetName().c_str());
|
||||
self.bookmarkCategory = @(category->GetName().c_str());
|
||||
string const description = data.GetDescription();
|
||||
self.bookmarkDescription = [NSString stringWithUTF8String:description.c_str()];
|
||||
self.bookmarkDescription = @(description.c_str());
|
||||
_isHTMLDescription = strings::IsHTML(description);
|
||||
self.bookmarkColor = [NSString stringWithUTF8String:data.GetType().c_str()];
|
||||
self.bookmarkColor = @(data.GetType().c_str());
|
||||
|
||||
[self configureEntityWithMetadata:metadata addressInfo:info];
|
||||
[self insertBookmarkInTypes];
|
||||
|
@ -122,7 +122,7 @@ using feature::Metadata;
|
|||
NSMutableArray * values = [NSMutableArray array];
|
||||
[types addObject:kPatternTypesArray.lastObject];
|
||||
BOOL const isLatLonAsDMS = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsLatLonAsDMSKey];
|
||||
NSString * latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String: MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()]: [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
|
||||
NSString * latLonStr = isLatLonAsDMS ? @(MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()): @( MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str());
|
||||
[values addObject:latLonStr];
|
||||
|
||||
self.metadata = @{kTypesKey : types, kValuesKey : values};
|
||||
|
@ -131,23 +131,23 @@ using feature::Metadata;
|
|||
- (void)configureForApi:(ApiMarkPoint const *)apiMark
|
||||
{
|
||||
self.type = MWMPlacePageEntityTypeAPI;
|
||||
self.title = [NSString stringWithUTF8String:apiMark->GetName().c_str()];
|
||||
self.title = @(apiMark->GetName().c_str());
|
||||
self.category = @(GetFramework().GetApiDataHolder().GetAppTitle().c_str());
|
||||
NSMutableArray const * types = [NSMutableArray array];
|
||||
NSMutableArray const * values = [NSMutableArray array];
|
||||
[types addObject:kPatternTypesArray.lastObject];
|
||||
BOOL const isLatLonAsDMS = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsLatLonAsDMSKey];
|
||||
NSString * latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String:MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()] : [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
|
||||
latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String:MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()] : [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
|
||||
NSString * latLonStr = isLatLonAsDMS ? @(MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()) : @(MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str());
|
||||
latLonStr = isLatLonAsDMS ? @(MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()) : @(MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str());
|
||||
[values addObject:latLonStr];
|
||||
self.metadata = @{kTypesKey : types, kValuesKey : values};
|
||||
}
|
||||
|
||||
- (void)configureEntityWithMetadata:(Metadata const &)metadata addressInfo:(search::AddressInfo const &)info
|
||||
{
|
||||
NSString * const name = [NSString stringWithUTF8String:info.GetPinName().c_str()];
|
||||
NSString * const name = @(info.GetPinName().c_str());
|
||||
self.title = name.length > 0 ? name : L(@"dropped_pin");
|
||||
self.category = [NSString stringWithUTF8String:info.GetPinType().c_str()];
|
||||
self.category = @(info.GetPinType().c_str());
|
||||
|
||||
vector<Metadata::EType> const presentTypes = metadata.GetPresentTypes();
|
||||
|
||||
|
@ -160,7 +160,7 @@ using feature::Metadata;
|
|||
{
|
||||
case Metadata::FMD_CUISINE:
|
||||
{
|
||||
NSString * result = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
|
||||
NSString * result = @(metadata.Get(type).c_str());
|
||||
NSString * cuisine = [NSString stringWithFormat:@"cuisine_%@", result];
|
||||
NSString * localizedResult = L(cuisine);
|
||||
NSString * currentCategory = self.category;
|
||||
|
@ -187,7 +187,7 @@ using feature::Metadata;
|
|||
}
|
||||
case Metadata::FMD_OPERATOR:
|
||||
{
|
||||
NSString const * bank = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
|
||||
NSString const * bank = @(metadata.Get(type).c_str());
|
||||
if (self.category.length)
|
||||
self.category = [NSString stringWithFormat:@"%@, %@", self.category, bank];
|
||||
else
|
||||
|
@ -215,7 +215,7 @@ using feature::Metadata;
|
|||
else if (type == Metadata::FMD_INTERNET)
|
||||
v = L(@"WiFi_available");
|
||||
else
|
||||
v = [NSString stringWithUTF8String:metadata.Get(type).c_str()];
|
||||
v = @(metadata.Get(type).c_str());
|
||||
|
||||
NSNumber const * t = [self typeFromMetadata:type];
|
||||
[types addObject:t];
|
||||
|
@ -241,8 +241,8 @@ using feature::Metadata;
|
|||
|
||||
[types addObject:kPatternTypesArray.lastObject];
|
||||
BOOL const isLatLonAsDMS = [[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsLatLonAsDMSKey];
|
||||
NSString * latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String:MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()] : [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
|
||||
latLonStr = isLatLonAsDMS ? [NSString stringWithUTF8String:MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()] : [NSString stringWithUTF8String: MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str()];
|
||||
NSString * latLonStr = isLatLonAsDMS ? @(MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()) : @( MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str());
|
||||
latLonStr = isLatLonAsDMS ? @(MeasurementUtils::FormatLatLonAsDMS(self.point.x, self.point.y, 2).c_str()) : @( MeasurementUtils::FormatLatLon(self.point.x, self.point.y).c_str());
|
||||
[values addObject:latLonStr];
|
||||
|
||||
self.metadata = @{kTypesKey : types, kValuesKey : values};
|
||||
|
@ -301,7 +301,7 @@ using feature::Metadata;
|
|||
{
|
||||
Framework & f = GetFramework();
|
||||
BookmarkCategory * category = f.GetBmCategory(f.LastEditedBMCategory());
|
||||
_bookmarkCategory = [NSString stringWithUTF8String:category->GetName().c_str()];
|
||||
_bookmarkCategory = @(category->GetName().c_str());
|
||||
}
|
||||
return _bookmarkCategory;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ using feature::Metadata;
|
|||
{
|
||||
Framework & f = GetFramework();
|
||||
string type = f.LastEditedBMType();
|
||||
_bookmarkColor = [NSString stringWithUTF8String:type.c_str()];
|
||||
_bookmarkColor = @(type.c_str());
|
||||
}
|
||||
return _bookmarkColor;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ extern NSString * const kUserDefaultsLatLonAsDMSKey;
|
|||
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
|
||||
BOOL const showLatLonAsDMS = [defaults boolForKey:kUserDefaultsLatLonAsDMSKey];
|
||||
m2::PointD const point = self.currentEntity.point;
|
||||
[self.textContainer setText:[NSString stringWithUTF8String:(showLatLonAsDMS ? MeasurementUtils::FormatLatLon(point.x, point.y).c_str() : MeasurementUtils::FormatLatLonAsDMS(point.x, point.y, 2).c_str())]];
|
||||
[self.textContainer setText:@((showLatLonAsDMS ? MeasurementUtils::FormatLatLon(point.x, point.y).c_str() : MeasurementUtils::FormatLatLonAsDMS(point.x, point.y, 2).c_str()))];
|
||||
[defaults setBool:!showLatLonAsDMS forKey:kUserDefaultsLatLonAsDMSKey];
|
||||
[defaults synchronize];
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageManagerState)
|
|||
CLLocationCoordinate2D const coord = location.coordinate;
|
||||
GetFramework().GetDistanceAndAzimut(m_userMark->GetUserMark()->GetOrg(), coord.latitude, coord.longitude, north,
|
||||
distance, azimut);
|
||||
return [NSString stringWithUTF8String:distance.c_str()];
|
||||
return @(distance.c_str());
|
||||
}
|
||||
|
||||
- (void)onCompassUpdate:(location::CompassInfo const &)info
|
||||
|
|
|
@ -652,7 +652,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
if(HasOptions(options, MapOptions::CarRouting))
|
||||
sizeToDownload += sizes.second;
|
||||
|
||||
NSString * name = [NSString stringWithUTF8String:layout.GetCountryName(idx).c_str()];
|
||||
NSString * name = @(layout.GetCountryName(idx).c_str());
|
||||
Platform::EConnectionType const connection = Platform::ConnectionStatus();
|
||||
if (connection != Platform::EConnectionType::CONNECTION_NONE)
|
||||
{
|
||||
|
@ -920,7 +920,7 @@ typedef NS_OPTIONS(NSUInteger, MapInfoView)
|
|||
return;
|
||||
CGFloat const normProgress = (CGFloat)progress.first / (CGFloat)progress.second;
|
||||
ActiveMapsLayout & activeMapLayout = GetFramework().GetCountryTree().GetActiveMapLayout();
|
||||
NSString * countryName = [NSString stringWithUTF8String:activeMapLayout.GetFormatedCountryName(activeMapLayout.GetCoreIndex(group, position)).c_str()];
|
||||
NSString * countryName = @(activeMapLayout.GetFormatedCountryName(activeMapLayout.GetCoreIndex(group, position)).c_str());
|
||||
[self.searchView downloadProgress:normProgress countryName:countryName];
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ static BOOL keyboardLoaded = NO;
|
|||
string distance;
|
||||
double azimut = -1.0;
|
||||
GetFramework().GetDistanceAndAzimut(result.GetFeatureCenter(), lat, lon, north, distance, azimut);
|
||||
wrapper.distances[@(position)] = [NSString stringWithUTF8String:distance.c_str()];
|
||||
wrapper.distances[@(position)] = @(distance.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ static BOOL keyboardLoaded = NO;
|
|||
if (!f.IsCountryLoaded(viewportCenter))
|
||||
{
|
||||
secondSentence = [NSString stringWithFormat:L(@"download_viewport_country_to_search"),
|
||||
[NSString stringWithUTF8String:f.GetCountryName(viewportCenter).c_str()]];
|
||||
@(f.GetCountryName(viewportCenter).c_str())];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -467,7 +467,7 @@ static BOOL keyboardLoaded = NO;
|
|||
m2::PointD const mercatorLocation = MercatorBounds::FromLatLon(lat, lon);
|
||||
if (!f.IsCountryLoaded(mercatorLocation)) {
|
||||
secondSentence = [NSString stringWithFormat:L(@"download_location_country"),
|
||||
[NSString stringWithUTF8String:f.GetCountryName(mercatorLocation).c_str()]];
|
||||
@(f.GetCountryName(mercatorLocation).c_str())];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ static BOOL keyboardLoaded = NO;
|
|||
NSRange range = NSMakeRange(pairRange.first, pairRange.second);
|
||||
[ranges addObject:[NSValue valueWithRange:range]];
|
||||
}
|
||||
NSString * title = [NSString stringWithUTF8String:result.GetString()];
|
||||
NSString * title = @(result.GetString());
|
||||
[cell setTitle:title selectedRanges:ranges];
|
||||
}
|
||||
|
||||
|
@ -568,10 +568,10 @@ static BOOL keyboardLoaded = NO;
|
|||
NSInteger const position = [self searchResultPositionForIndexPath:indexPath];
|
||||
search::Result const & result = [self.wrapper resultWithPosition:position];
|
||||
[self setCellAttributedTitle:customCell result:result];
|
||||
customCell.subtitleLabel.text = [NSString stringWithUTF8String:result.GetRegionString()];
|
||||
customCell.subtitleLabel.text = @(result.GetRegionString());
|
||||
customCell.iconImageView.image = [UIImage imageNamed:@"SearchCellPinIcon"];
|
||||
customCell.distanceLabel.text = self.wrapper.distances[@(position)];
|
||||
customCell.typeLabel.text = [NSString stringWithUTF8String:result.GetFeatureType()];
|
||||
customCell.typeLabel.text = @(result.GetFeatureType());
|
||||
cell = customCell;
|
||||
break;
|
||||
}
|
||||
|
@ -606,13 +606,13 @@ static BOOL keyboardLoaded = NO;
|
|||
NSInteger const position = [self searchResultPositionForIndexPath:indexPath];
|
||||
SearchResultsWrapper * wrapper = self.wrapper;
|
||||
search::Result const & result = [wrapper resultWithPosition:position];
|
||||
NSString * title = [NSString stringWithUTF8String:result.GetString()];
|
||||
NSString * title = @(result.GetString());
|
||||
NSString * subtitle;
|
||||
NSString * type;
|
||||
if (result.GetResultType() == search::Result::RESULT_FEATURE || result.GetResultType() == search::Result::RESULT_LATLON)
|
||||
{
|
||||
subtitle = [NSString stringWithUTF8String:result.GetRegionString()];
|
||||
type = [NSString stringWithUTF8String:result.GetFeatureType()];
|
||||
subtitle = @(result.GetRegionString());
|
||||
type = @(result.GetFeatureType());
|
||||
}
|
||||
return [SearchResultCell cellHeightWithTitle:title type:type subtitle:subtitle distance:wrapper.distances[@(position)] viewWidth:tableView.width];
|
||||
}
|
||||
|
@ -666,7 +666,7 @@ static BOOL keyboardLoaded = NO;
|
|||
{
|
||||
NSInteger const position = [self searchResultPositionForIndexPath:indexPath];
|
||||
search::Result const & result = [self.wrapper resultWithPosition:position];
|
||||
NSString * newQuery = [NSString stringWithUTF8String:result.GetSuggestionString()];
|
||||
NSString * newQuery = @(result.GetSuggestionString());
|
||||
self.searchBar.textField.text = newQuery;
|
||||
[self search:newQuery];
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ NSString * httpGe0Url(NSString * shortUrl)
|
|||
auto & f = GetFramework();
|
||||
string const s = f.CodeGe0url(self.location.latitude, self.location.longitude, f.GetDrawScale(),
|
||||
self.title.UTF8String);
|
||||
NSString * url = [NSString stringWithUTF8String:s.c_str()];
|
||||
NSString * url = @(s.c_str());
|
||||
if (!isShort)
|
||||
return url;
|
||||
NSUInteger const kGe0UrlLength = 16;
|
||||
|
|
|
@ -28,7 +28,7 @@ extern NSString * const MapsStatusChangedNotification;
|
|||
else
|
||||
{
|
||||
ASSERT(position < self.tree.GetChildCount(), ());
|
||||
self.title = [NSString stringWithUTF8String:self.tree.GetChildName(position).c_str()];
|
||||
self.title = @(self.tree.GetChildName(position).c_str());
|
||||
self.tree.SetChildAsRoot(position);
|
||||
}
|
||||
|
||||
|
@ -127,12 +127,12 @@ extern NSString * const MapsStatusChangedNotification;
|
|||
|
||||
- (NSString *)parentTitle
|
||||
{
|
||||
return self.tree.IsCountryRoot() ? [NSString stringWithUTF8String:self.tree.GetRootName().c_str()] : nil;
|
||||
return self.tree.IsCountryRoot() ? @(self.tree.GetRootName().c_str()) : nil;
|
||||
}
|
||||
|
||||
- (NSString *)selectedMapName
|
||||
{
|
||||
return [NSString stringWithUTF8String:self.tree.GetChildName(self.selectedPosition).c_str()];
|
||||
return @(self.tree.GetChildName(self.selectedPosition).c_str());
|
||||
}
|
||||
|
||||
- (uint64_t)selectedMapSizeWithOptions:(MapOptions)options
|
||||
|
@ -228,7 +228,7 @@ extern NSString * const MapsStatusChangedNotification;
|
|||
BOOL const isLast = (indexPath.row == numberOfRows - 1);
|
||||
BOOL const isFirst = (indexPath.row == 0);
|
||||
|
||||
cell.titleLabel.text = [NSString stringWithUTF8String:self.tree.GetChildName(position).c_str()];
|
||||
cell.titleLabel.text = @(self.tree.GetChildName(position).c_str());
|
||||
cell.subtitleLabel.text = [self parentTitle];
|
||||
cell.delegate = self;
|
||||
cell.badgeView.value = 0;
|
||||
|
|
|
@ -260,7 +260,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
|
|||
|
||||
string s;
|
||||
MeasurementUtils::FormatDistance(meters, s);
|
||||
return [NSString stringWithUTF8String:s.c_str()];
|
||||
return @(s.c_str());
|
||||
}
|
||||
|
||||
+ (char const *)getSpeedSymbol:(double)metersPerSecond
|
||||
|
@ -309,7 +309,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
|
|||
result += " ";
|
||||
result += [LocationManager getSpeedSymbol:l.speed] + MeasurementUtils::FormatSpeed(l.speed);
|
||||
}
|
||||
return result.empty() ? nil : [NSString stringWithUTF8String:result.c_str()];
|
||||
return result.empty() ? nil : @(result.c_str());
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ extern NSDictionary * const deviceNames = @{@"x86_64" : @"Simulator",
|
|||
{
|
||||
string s; GetPlatform().GetReader("copyright.html")->ReadAsString(s);
|
||||
NSString * str = [NSString stringWithFormat:@"Version: %@ \n", [[NSBundle mainBundle] infoDictionary][@"CFBundleVersion"]];
|
||||
NSString * text = [NSString stringWithFormat:@"%@%@", str, [NSString stringWithUTF8String:s.c_str()]];
|
||||
NSString * text = [NSString stringWithFormat:@"%@%@", str, @(s.c_str())];
|
||||
WebViewController * aboutViewController = [[WebViewController alloc] initWithHtml:text baseUrl:nil andTitleOrNil:L(@"copyright")];
|
||||
aboutViewController.openInSafari = YES;
|
||||
[self.navigationController pushViewController:aboutViewController animated:YES];
|
||||
|
|
|
@ -90,7 +90,7 @@ static NSString * const kAppInfoFirstLaunchDateKey = @"AppInfoFirstLaunchDate";
|
|||
if (carrier.isoCountryCode) // if device can access sim card info
|
||||
Settings::Set(kCountryCodeKey, std::string([_countryCode UTF8String])); // then save new code instead
|
||||
else
|
||||
_countryCode = [NSString stringWithUTF8String:codeString.c_str()]; // if device can NOT access sim card info then using saved code
|
||||
_countryCode = @(codeString.c_str()); // if device can NOT access sim card info then using saved code
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -110,7 +110,7 @@ static NSString * const kAppInfoFirstLaunchDateKey = @"AppInfoFirstLaunchDate";
|
|||
string uniqueString;
|
||||
if (Settings::Get(kUniqueIdKey, uniqueString)) // if id stored in settings
|
||||
{
|
||||
_uniqueId = [NSString stringWithUTF8String:uniqueString.c_str()];
|
||||
_uniqueId = @(uniqueString.c_str());
|
||||
}
|
||||
else // if id not stored in settings
|
||||
{
|
||||
|
|
|
@ -59,7 +59,7 @@ extern NSString * const kSearchResultPointKey;
|
|||
if (countryIndex == storage::TIndex())
|
||||
return @"";
|
||||
string countryName = f.GetCountryTree().GetActiveMapLayout().GetFormatedCountryName(countryIndex);
|
||||
return [NSString stringWithUTF8String:countryName.c_str()];
|
||||
return @(countryName.c_str());
|
||||
}
|
||||
|
||||
+ (void)initSoftwareRenderer
|
||||
|
@ -122,8 +122,8 @@ extern NSString * const kSearchResultPointKey;
|
|||
{
|
||||
search::Result result = results.GetResult(index);
|
||||
NSMutableDictionary * d = [NSMutableDictionary dictionary];
|
||||
d[kSearchResultTitleKey] = [NSString stringWithUTF8String:result.GetString()];
|
||||
d[kSearchResultCategoryKey] = [NSString stringWithUTF8String:result.GetFeatureType()];
|
||||
d[kSearchResultTitleKey] = @(result.GetString());
|
||||
d[kSearchResultCategoryKey] = @(result.GetFeatureType());
|
||||
m2::PointD const featureCenter = result.GetFeatureCenter();
|
||||
d[kSearchResultPointKey] = [NSValue value:&featureCenter withObjCType:@encode(m2::PointD)];
|
||||
res[index] = d;
|
||||
|
|
|
@ -94,7 +94,7 @@ static CLLocationDistance const kDistanceToDestinationThreshold = 5.0;
|
|||
|
||||
string distance;
|
||||
if (MeasurementUtils::FormatDistance(d, distance))
|
||||
return [NSString stringWithUTF8String:distance.c_str()];
|
||||
return @(distance.c_str());
|
||||
return @"";
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue