Merge pull request #542 from grigaci/fixDuplicateSymbols

Issue #541 Fix duplicate symbols on ASIndexPath with extern header and implementation file.
This commit is contained in:
appleguy
2015-07-07 10:15:38 -07:00
3 changed files with 105 additions and 62 deletions

View File

@@ -167,6 +167,10 @@
299DA1AA1A828D2900162D41 /* ASBatchContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 299DA1A81A828D2900162D41 /* ASBatchContext.mm */; };
29CDC2E21AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29CDC2E11AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m */; };
3C9C128519E616EF00E942A0 /* ASTableViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9C128419E616EF00E942A0 /* ASTableViewTests.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
430E7C8F1B4C23F100697A4C /* ASIndexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 430E7C8D1B4C23F100697A4C /* ASIndexPath.h */; };
430E7C901B4C23F100697A4C /* ASIndexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 430E7C8D1B4C23F100697A4C /* ASIndexPath.h */; };
430E7C911B4C23F100697A4C /* ASIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 430E7C8E1B4C23F100697A4C /* ASIndexPath.m */; };
430E7C921B4C23F100697A4C /* ASIndexPath.m in Sources */ = {isa = PBXBuildFile; fileRef = 430E7C8E1B4C23F100697A4C /* ASIndexPath.m */; };
464052201A3F83C40061C0BA /* ASDataController.h in Headers */ = {isa = PBXBuildFile; fileRef = 464052191A3F83C40061C0BA /* ASDataController.h */; settings = {ATTRIBUTES = (Public, ); }; };
464052211A3F83C40061C0BA /* ASDataController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4640521A1A3F83C40061C0BA /* ASDataController.mm */; };
464052221A3F83C40061C0BA /* ASFlowLayoutController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4640521B1A3F83C40061C0BA /* ASFlowLayoutController.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -510,6 +514,8 @@
299DA1A81A828D2900162D41 /* ASBatchContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASBatchContext.mm; sourceTree = "<group>"; };
29CDC2E11AAE70D000833CA4 /* ASBasicImageDownloaderContextTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASBasicImageDownloaderContextTests.m; sourceTree = "<group>"; };
3C9C128419E616EF00E942A0 /* ASTableViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASTableViewTests.m; sourceTree = "<group>"; };
430E7C8D1B4C23F100697A4C /* ASIndexPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIndexPath.h; sourceTree = "<group>"; };
430E7C8E1B4C23F100697A4C /* ASIndexPath.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIndexPath.m; sourceTree = "<group>"; };
464052191A3F83C40061C0BA /* ASDataController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASDataController.h; sourceTree = "<group>"; };
4640521A1A3F83C40061C0BA /* ASDataController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASDataController.mm; sourceTree = "<group>"; };
4640521B1A3F83C40061C0BA /* ASFlowLayoutController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASFlowLayoutController.h; sourceTree = "<group>"; };
@@ -793,6 +799,8 @@
4640521C1A3F83C40061C0BA /* ASFlowLayoutController.mm */,
058D09E6195D050800B7D73C /* ASHighlightOverlayLayer.h */,
058D09E7195D050800B7D73C /* ASHighlightOverlayLayer.mm */,
430E7C8D1B4C23F100697A4C /* ASIndexPath.h */,
430E7C8E1B4C23F100697A4C /* ASIndexPath.m */,
05F20AA31A15733C00DCA68A /* ASImageProtocols.h */,
4640521D1A3F83C40061C0BA /* ASLayoutController.h */,
292C59991A956527007E5DD6 /* ASLayoutRangeType.h */,
@@ -986,6 +994,7 @@
058D0A4A195D05CB00B7D73C /* ASDisplayNode.h in Headers */,
1950C4491A3BB5C1005C8279 /* ASEqualityHelpers.h in Headers */,
058D0A4B195D05CB00B7D73C /* ASDisplayNode.mm in Headers */,
430E7C8F1B4C23F100697A4C /* ASIndexPath.h in Headers */,
058D0A4C195D05CB00B7D73C /* ASDisplayNode+Subclasses.h in Headers */,
058D0A4D195D05CB00B7D73C /* ASDisplayNodeExtras.h in Headers */,
058D0A4E195D05CB00B7D73C /* ASDisplayNodeExtras.mm in Headers */,
@@ -1091,6 +1100,7 @@
B35062261B010EFD0018CF92 /* ASRangeController.h in Headers */,
B35062111B010EFD0018CF92 /* _ASDisplayView.h in Headers */,
B35061F81B010EFD0018CF92 /* ASControlNode.h in Headers */,
430E7C901B4C23F100697A4C /* ASIndexPath.h in Headers */,
B35062281B010EFD0018CF92 /* ASRangeHandler.h in Headers */,
B35061FD1B010EFD0018CF92 /* ASDisplayNode+Subclasses.h in Headers */,
B35062491B010EFD0018CF92 /* _ASCoreAnimationExtras.h in Headers */,
@@ -1342,6 +1352,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
430E7C911B4C23F100697A4C /* ASIndexPath.m in Sources */,
058D0A26195D050800B7D73C /* _ASCoreAnimationExtras.mm in Sources */,
058D0A23195D050800B7D73C /* _ASAsyncTransactionContainer.m in Sources */,
058D0A1E195D050800B7D73C /* ASTextNodeShadower.m in Sources */,
@@ -1476,6 +1487,7 @@
B35062031B010EFD0018CF92 /* ASImageNode.mm in Sources */,
B35062091B010EFD0018CF92 /* ASScrollNode.m in Sources */,
B35062251B010EFD0018CF92 /* ASMutableAttributedStringBuilder.m in Sources */,
430E7C921B4C23F100697A4C /* ASIndexPath.m in Sources */,
B35062381B010EFD0018CF92 /* ASTextNodeWordKerner.m in Sources */,
B35062101B010EFD0018CF92 /* _ASDisplayLayer.mm in Sources */,
B35062351B010EFD0018CF92 /* ASTextNodeTextKitHelpers.mm in Sources */,

View File

@@ -1,13 +1,12 @@
//
// ASIndexPath.h
// Pods
//
// Created by Scott Goodson on 7/4/15.
//
// A much more efficient way to handle index paths than NSIndexPath.
// For best results, use C++ vectors; NSValue wrapping with Cocoa collections
// would make NSIndexPath a much better choice.
//
/* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import <AsyncDisplayKit/ASBaseDefines.h>
typedef struct {
NSInteger section;
@@ -19,66 +18,25 @@ typedef struct {
ASIndexPath end;
} ASIndexPathRange;
ASIndexPath ASIndexPathMake(NSInteger section, NSInteger row)
{
ASIndexPath indexPath;
indexPath.section = section;
indexPath.row = row;
return indexPath;
}
ASDISPLAYNODE_EXTERN_C_BEGIN
BOOL ASIndexPathEqualToIndexPath(ASIndexPath first, ASIndexPath second)
{
return (first.section == second.section && first.row == second.row);
}
extern ASIndexPath ASIndexPathMake(NSInteger section, NSInteger row);
ASIndexPath ASIndexPathMinimum(ASIndexPath first, ASIndexPath second)
{
if (first.section < second.section) {
return first;
} else if (first.section > second.section) {
return second;
} else {
return (first.row < second.row ? first : second);
}
}
extern BOOL ASIndexPathEqualToIndexPath(ASIndexPath first, ASIndexPath second);
ASIndexPath ASIndexPathMaximum(ASIndexPath first, ASIndexPath second)
{
if (first.section > second.section) {
return first;
} else if (first.section < second.section) {
return second;
} else {
return (first.row > second.row ? first : second);
}
}
extern ASIndexPath ASIndexPathMinimum(ASIndexPath first, ASIndexPath second);
ASIndexPathRange ASIndexPathRangeMake(ASIndexPath first, ASIndexPath second)
{
ASIndexPathRange range;
range.start = ASIndexPathMinimum(first, second);
range.end = ASIndexPathMaximum(first, second);
return range;
}
extern ASIndexPath ASIndexPathMaximum(ASIndexPath first, ASIndexPath second);
BOOL ASIndexPathRangeEqualToIndexPathRange(ASIndexPathRange first, ASIndexPathRange second)
{
return ASIndexPathEqualToIndexPath(first.start, second.start) && ASIndexPathEqualToIndexPath(first.end, second.end);
}
extern ASIndexPathRange ASIndexPathRangeMake(ASIndexPath first, ASIndexPath second);
extern BOOL ASIndexPathRangeEqualToIndexPathRange(ASIndexPathRange first, ASIndexPathRange second);
ASDISPLAYNODE_EXTERN_C_END
@interface NSIndexPath (ASIndexPathAdditions)
+ (NSIndexPath *)indexPathWithASIndexPath:(ASIndexPath)indexPath;
- (ASIndexPath)ASIndexPathValue;
@end
@implementation NSIndexPath (ASIndexPathAdditions)
+ (NSIndexPath *)indexPathWithASIndexPath:(ASIndexPath)indexPath
{
return [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];;
}
- (ASIndexPath)ASIndexPathValue
{
return ASIndexPathMake(self.section, self.row);
}
@end

View File

@@ -0,0 +1,73 @@
/* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#import "ASIndexPath.h"
#import <UIKit/UIKit.h>
ASIndexPath ASIndexPathMake(NSInteger section, NSInteger row)
{
ASIndexPath indexPath;
indexPath.section = section;
indexPath.row = row;
return indexPath;
}
BOOL ASIndexPathEqualToIndexPath(ASIndexPath first, ASIndexPath second)
{
return (first.section == second.section && first.row == second.row);
}
ASIndexPath ASIndexPathMinimum(ASIndexPath first, ASIndexPath second)
{
if (first.section < second.section) {
return first;
} else if (first.section > second.section) {
return second;
} else {
return (first.row < second.row ? first : second);
}
}
ASIndexPath ASIndexPathMaximum(ASIndexPath first, ASIndexPath second)
{
if (first.section > second.section) {
return first;
} else if (first.section < second.section) {
return second;
} else {
return (first.row > second.row ? first : second);
}
}
ASIndexPathRange ASIndexPathRangeMake(ASIndexPath first, ASIndexPath second)
{
ASIndexPathRange range;
range.start = ASIndexPathMinimum(first, second);
range.end = ASIndexPathMaximum(first, second);
return range;
}
BOOL ASIndexPathRangeEqualToIndexPathRange(ASIndexPathRange first, ASIndexPathRange second)
{
return ASIndexPathEqualToIndexPath(first.start, second.start) && ASIndexPathEqualToIndexPath(first.end, second.end);
}
@implementation NSIndexPath (ASIndexPathAdditions)
+ (NSIndexPath *)indexPathWithASIndexPath:(ASIndexPath)indexPath
{
return [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];;
}
- (ASIndexPath)ASIndexPathValue
{
return ASIndexPathMake(self.section, self.row);
}
@end