【发布时间】:2015-12-22 22:56:42
【问题描述】:
我对 Clang 格式 API 有很多困惑。
- 我无法打开 .clangformat 文件,因此我可以查看并根据我的配置进行配置。
- 我需要以 Allman 样式格式化我的代码。
- 我也看过很多关于 Google 和 Stack Overflow 的文档,但我没有得到任何帮助来实现 Allman 样式格式。
我遇到了http://clangformat.com/,但我也没有得到任何帮助来实现 Allman 风格。
这是我想要的问题和解决方案。
问题 #1:
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(captureSearchFiltersNotificationWithSelection:)
name:kSearchFiltersNotificationWithSelection
object:nil];
需要 #1:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(captureSearchFiltersNotificationWithSelection:)name:kSearchFiltersNotificationWithSelection object:nil];
问题 #2:
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// listings = [NSMutableArray new];
self.navTitle = @"Buy";
searchFilters = [SearchFilter new];
if ([LocationManager locationManager].location == nil) {
selectedSortOption = kSortBuyRefineOptionUndefined;
}
else {
selectedSortOption = kSortBuyRefineOptionNearMeAsc;
}
}
return self;
}
需要 #2:
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle*)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
listings = [NSMutableArray new];
self.navTitle = @"Buy";
searchFilters = [SearchFilter new];
if ([LocationManager locationManager].location == nil)
{
selectedSortOption = kSortBuyRefineOptionUndefined;
}
else
{
selectedSortOption = kSortBuyRefineOptionNearMeAsc;
}
}
return self;
}
【问题讨论】:
-
@halfer 知道答案吗?
-
回复:“我无法打开 .clangformat 文件,以便我可以查看并根据我的配置进行配置。”您能否澄清您的意思,因为不清楚?文件名通常应为
.clang-format或_clang-format并放在项目目录中。 -
@l'L'l 在哪个编辑器中可以看到“.clang-format”文件的内容?
-
@Developer 当然是任何编辑器
标签: ios code-formatting clang-format