Add extensibility support for ASEnvironmentLayoutOptionsState

This commit is contained in:
Michael Schneider
2016-03-29 19:59:17 -07:00
parent 96df35e41a
commit 65b4961802
9 changed files with 186 additions and 11 deletions

View File

@@ -262,6 +262,8 @@
698548641CA9E025008A345F /* ASEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 698548611CA9E025008A345F /* ASEnvironment.h */; settings = {ATTRIBUTES = (Public, ); }; }; 698548641CA9E025008A345F /* ASEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = 698548611CA9E025008A345F /* ASEnvironment.h */; settings = {ATTRIBUTES = (Public, ); }; };
698548651CA9E025008A345F /* ASEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 698548621CA9E025008A345F /* ASEnvironment.m */; }; 698548651CA9E025008A345F /* ASEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 698548621CA9E025008A345F /* ASEnvironment.m */; };
698548661CA9E025008A345F /* ASEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 698548621CA9E025008A345F /* ASEnvironment.m */; }; 698548661CA9E025008A345F /* ASEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = 698548621CA9E025008A345F /* ASEnvironment.m */; };
698C8B611CAB49FC0052DC3F /* ASLayoutableExtensibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
698C8B621CAB49FC0052DC3F /* ASLayoutableExtensibility.h in Headers */ = {isa = PBXBuildFile; fileRef = 698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */; settings = {ATTRIBUTES = (Public, ); }; };
69E1006D1CA89CB600D88C1B /* ASEnvironmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */; }; 69E1006D1CA89CB600D88C1B /* ASEnvironmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */; };
69E1006E1CA89CB600D88C1B /* ASEnvironmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */; }; 69E1006E1CA89CB600D88C1B /* ASEnvironmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */; };
69E1006F1CA89CB600D88C1B /* ASEnvironmentInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */; }; 69E1006F1CA89CB600D88C1B /* ASEnvironmentInternal.mm in Sources */ = {isa = PBXBuildFile; fileRef = 69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */; };
@@ -742,6 +744,7 @@
68EE0DBC1C1B4ED300BA1B99 /* ASMainSerialQueue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASMainSerialQueue.mm; sourceTree = "<group>"; }; 68EE0DBC1C1B4ED300BA1B99 /* ASMainSerialQueue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASMainSerialQueue.mm; sourceTree = "<group>"; };
698548611CA9E025008A345F /* ASEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironment.h; sourceTree = "<group>"; }; 698548611CA9E025008A345F /* ASEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironment.h; sourceTree = "<group>"; };
698548621CA9E025008A345F /* ASEnvironment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASEnvironment.m; sourceTree = "<group>"; }; 698548621CA9E025008A345F /* ASEnvironment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASEnvironment.m; sourceTree = "<group>"; };
698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASLayoutableExtensibility.h; path = AsyncDisplayKit/Layout/ASLayoutableExtensibility.h; sourceTree = "<group>"; };
69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironmentInternal.h; sourceTree = "<group>"; }; 69E100691CA89CB600D88C1B /* ASEnvironmentInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASEnvironmentInternal.h; sourceTree = "<group>"; };
69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEnvironmentInternal.mm; sourceTree = "<group>"; }; 69E1006A1CA89CB600D88C1B /* ASEnvironmentInternal.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ASEnvironmentInternal.mm; sourceTree = "<group>"; };
69F10C851C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASRangeControllerUpdateRangeProtocol+Beta.h"; sourceTree = "<group>"; }; 69F10C851C84C35D0026140C /* ASRangeControllerUpdateRangeProtocol+Beta.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "ASRangeControllerUpdateRangeProtocol+Beta.h"; sourceTree = "<group>"; };
@@ -1317,14 +1320,13 @@
ACF6ED041B17843500DA7C62 /* ASCenterLayoutSpec.mm */, ACF6ED041B17843500DA7C62 /* ASCenterLayoutSpec.mm */,
ACF6ED071B17843500DA7C62 /* ASDimension.h */, ACF6ED071B17843500DA7C62 /* ASDimension.h */,
ACF6ED081B17843500DA7C62 /* ASDimension.mm */, ACF6ED081B17843500DA7C62 /* ASDimension.mm */,
AC47D9431B3BB41900AAEE9D /* ASRelativeSize.h */,
AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */,
ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */, ACF6ED091B17843500DA7C62 /* ASInsetLayoutSpec.h */,
ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */, ACF6ED0A1B17843500DA7C62 /* ASInsetLayoutSpec.mm */,
ACF6ED0B1B17843500DA7C62 /* ASLayout.h */, ACF6ED0B1B17843500DA7C62 /* ASLayout.h */,
ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */, ACF6ED0C1B17843500DA7C62 /* ASLayout.mm */,
ACF6ED111B17843500DA7C62 /* ASLayoutable.h */, ACF6ED111B17843500DA7C62 /* ASLayoutable.h */,
E55D86311CA8A14000A0C26F /* ASLayoutable.mm */, E55D86311CA8A14000A0C26F /* ASLayoutable.mm */,
698C8B601CAB49FC0052DC3F /* ASLayoutableExtensibility.h */,
9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */, 9CDC18CB1B910E12004965E2 /* ASLayoutablePrivate.h */,
ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */, ACF6ED0D1B17843500DA7C62 /* ASLayoutSpec.h */,
ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */, ACF6ED0E1B17843500DA7C62 /* ASLayoutSpec.mm */,
@@ -1334,6 +1336,8 @@
ACF6ED151B17843500DA7C62 /* ASRatioLayoutSpec.mm */, ACF6ED151B17843500DA7C62 /* ASRatioLayoutSpec.mm */,
7A06A7391C35F08800FE8DAA /* ASRelativeLayoutSpec.h */, 7A06A7391C35F08800FE8DAA /* ASRelativeLayoutSpec.h */,
7A06A7381C35F08800FE8DAA /* ASRelativeLayoutSpec.mm */, 7A06A7381C35F08800FE8DAA /* ASRelativeLayoutSpec.mm */,
AC47D9431B3BB41900AAEE9D /* ASRelativeSize.h */,
AC47D9441B3BB41900AAEE9D /* ASRelativeSize.mm */,
9C49C36E1B853957000B0DD5 /* ASStackLayoutable.h */, 9C49C36E1B853957000B0DD5 /* ASStackLayoutable.h */,
AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutDefines.h */, AC21EC0F1B3D0BF600C8B19A /* ASStackLayoutDefines.h */,
ACF6ED161B17843500DA7C62 /* ASStackLayoutSpec.h */, ACF6ED161B17843500DA7C62 /* ASStackLayoutSpec.h */,
@@ -1379,6 +1383,7 @@
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
698C8B611CAB49FC0052DC3F /* ASLayoutableExtensibility.h in Headers */,
698548631CA9E025008A345F /* ASEnvironment.h in Headers */, 698548631CA9E025008A345F /* ASEnvironment.h in Headers */,
E5711A2B1C840C81009619D4 /* ASIndexedNodeContext.h in Headers */, E5711A2B1C840C81009619D4 /* ASIndexedNodeContext.h in Headers */,
257754C21BEE458E00737CA5 /* ASTextKitCoreTextAdditions.h in Headers */, 257754C21BEE458E00737CA5 /* ASTextKitCoreTextAdditions.h in Headers */,
@@ -1522,6 +1527,7 @@
isa = PBXHeadersBuildPhase; isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
698C8B621CAB49FC0052DC3F /* ASLayoutableExtensibility.h in Headers */,
698548641CA9E025008A345F /* ASEnvironment.h in Headers */, 698548641CA9E025008A345F /* ASEnvironment.h in Headers */,
AC026B6A1BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */, AC026B6A1BD57D6F00BBC17E /* ASChangeSetDataController.h in Headers */,
B35062481B010EFD0018CF92 /* _AS-objc-internal.h in Headers */, B35062481B010EFD0018CF92 /* _AS-objc-internal.h in Headers */,

View File

@@ -24,7 +24,7 @@
#import "ASDisplayNodeExtras.h" #import "ASDisplayNodeExtras.h"
#import "ASEqualityHelpers.h" #import "ASEqualityHelpers.h"
#import "ASRunLoopQueue.h" #import "ASRunLoopQueue.h"
#import "ASEnvironment.h" #import "ASEnvironmentInternal.h"
#import "ASInternalHelpers.h" #import "ASInternalHelpers.h"
#import "ASLayout.h" #import "ASLayout.h"
@@ -2697,6 +2697,40 @@ static const char *ASDisplayNodeDrawingPriorityKey = "ASDrawingPriority";
return NO; return NO;
} }
#pragma mark - ASLayoutableExtensibility
- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx
{
_ASEnvironmentLayoutOptionsExtensionSetBoolAtIndex(self, idx, value);
}
- (BOOL)layoutOptionExtensionBoolAtIndex:(int)idx
{
return _ASEnvironmentLayoutOptionsExtensionGetBoolAtIndex(self, idx);
}
- (void)setLayoutOptionExtensionInteger:(NSInteger)value atIndex:(int)idx
{
_ASEnvironmentLayoutOptionsExtensionSetIntegerAtIndex(self, idx, value);
}
- (NSInteger)layoutOptionExtensionIntegerAtIndex:(int)idx
{
return _ASEnvironmentLayoutOptionsExtensionGetIntegerAtIndex(self, idx);
}
- (void)setLayoutOptionExtensionEdgeInsets:(UIEdgeInsets)value atIndex:(int)idx
{
_ASEnvironmentLayoutOptionsExtensionSetEdgeInsetsAtIndex(self, idx, value);
}
- (UIEdgeInsets)layoutOptionExtensionEdgeInsetsAtIndex:(int)idx
{
return _ASEnvironmentLayoutOptionsExtensionGetEdgeInsetsAtIndex(self, idx);
}
#if TARGET_OS_TV #if TARGET_OS_TV
#pragma mark - UIFocusEnvironment Protocol (tvOS) #pragma mark - UIFocusEnvironment Protocol (tvOS)

View File

@@ -18,8 +18,20 @@
ASDISPLAYNODE_EXTERN_C_BEGIN ASDISPLAYNODE_EXTERN_C_BEGIN
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
static const int kMaxEnvironmentStateBoolExtensions = 1;
static const int kMaxEnvironmentStateIntegerExtensions = 4;
static const int kMaxEnvironmentStateEdgeInsetExtensions = 1;
#pragma mark ASEnvironmentLayoutOptionsState #pragma mark -
typedef struct ASEnvironmentStateExtensions {
// Values to store extensions
BOOL boolExtensions[kMaxEnvironmentStateBoolExtensions];
NSInteger integerExtensions[kMaxEnvironmentStateIntegerExtensions];
UIEdgeInsets edgeInsetsExtensions[kMaxEnvironmentStateEdgeInsetExtensions];
} ASEnvironmentStateExtensions;
#pragma mark - ASEnvironmentLayoutOptionsState
typedef struct ASEnvironmentLayoutOptionsState { typedef struct ASEnvironmentLayoutOptionsState {
CGFloat spacingBefore;// = 0; CGFloat spacingBefore;// = 0;
@@ -34,13 +46,12 @@ typedef struct ASEnvironmentLayoutOptionsState {
ASRelativeSizeRange sizeRange;// = ASRelativeSizeRangeMake(ASRelativeSizeMakeWithCGSize(CGSizeZero), ASRelativeSizeMakeWithCGSize(CGSizeZero));; ASRelativeSizeRange sizeRange;// = ASRelativeSizeRangeMake(ASRelativeSizeMakeWithCGSize(CGSizeZero), ASRelativeSizeMakeWithCGSize(CGSizeZero));;
CGPoint layoutPosition;// = CGPointZero; CGPoint layoutPosition;// = CGPointZero;
// TODO: ASEnvironment: find a good way to expand the options state ASEnvironmentStateExtensions _extensions;
// id otherOptions;
} ASEnvironmentLayoutOptionsState; } ASEnvironmentLayoutOptionsState;
extern ASEnvironmentLayoutOptionsState ASEnvironmentLayoutOptionsStateCreate(); extern ASEnvironmentLayoutOptionsState ASEnvironmentLayoutOptionsStateCreate();
#pragma mark ASEnvironmentHierarchyState #pragma mark - ASEnvironmentHierarchyState
typedef struct ASEnvironmentHierarchyState { typedef struct ASEnvironmentHierarchyState {
unsigned rasterized:1; // = NO unsigned rasterized:1; // = NO
@@ -51,7 +62,7 @@ typedef struct ASEnvironmentHierarchyState {
extern ASEnvironmentHierarchyState ASEnvironmentHierarchyStateCreate(); extern ASEnvironmentHierarchyState ASEnvironmentHierarchyStateCreate();
#pragma mark ASEnvironmentCollection #pragma mark - ASEnvironmentCollection
typedef struct ASEnvironmentCollection { typedef struct ASEnvironmentCollection {
struct ASEnvironmentHierarchyState hierarchyState; struct ASEnvironmentHierarchyState hierarchyState;

View File

@@ -158,6 +158,39 @@ static NSString * const kDefaultChildrenKey = @"kDefaultChildrenKey";
return NO; return NO;
} }
#pragma mark - ASLayoutableExtensibility
- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx
{
_ASEnvironmentLayoutOptionsExtensionSetBoolAtIndex(self, idx, value);
}
- (BOOL)layoutOptionExtensionBoolAtIndex:(int)idx
{
return _ASEnvironmentLayoutOptionsExtensionGetBoolAtIndex(self, idx);
}
- (void)setLayoutOptionExtensionInteger:(NSInteger)value atIndex:(int)idx
{
_ASEnvironmentLayoutOptionsExtensionSetIntegerAtIndex(self, idx, value);
}
- (NSInteger)layoutOptionExtensionIntegerAtIndex:(int)idx
{
return _ASEnvironmentLayoutOptionsExtensionGetIntegerAtIndex(self, idx);
}
- (void)setLayoutOptionExtensionEdgeInsets:(UIEdgeInsets)value atIndex:(int)idx
{
_ASEnvironmentLayoutOptionsExtensionSetEdgeInsetsAtIndex(self, idx, value);
}
- (UIEdgeInsets)layoutOptionExtensionEdgeInsetsAtIndex:(int)idx
{
return _ASEnvironmentLayoutOptionsExtensionGetEdgeInsetsAtIndex(self, idx);
}
@end @end
@implementation ASLayoutSpec (Debugging) @implementation ASLayoutSpec (Debugging)

View File

@@ -16,6 +16,7 @@
#import <AsyncDisplayKit/ASLayoutablePrivate.h> #import <AsyncDisplayKit/ASLayoutablePrivate.h>
#import <AsyncDisplayKit/ASEnvironment.h> #import <AsyncDisplayKit/ASEnvironment.h>
#import <AsyncDisplayKit/ASLayoutableExtensibility.h>
@class ASLayout; @class ASLayout;
@class ASLayoutSpec; @class ASLayoutSpec;
@@ -38,7 +39,7 @@ NS_ASSUME_NONNULL_BEGIN
* access to the options via convenience properties. If you are creating custom layout spec, then you can * access to the options via convenience properties. If you are creating custom layout spec, then you can
* extend the backing layout options class to accommodate any new layout options. * extend the backing layout options class to accommodate any new layout options.
*/ */
@protocol ASLayoutable <ASEnvironment, ASStackLayoutable, ASStaticLayoutable, ASLayoutablePrivate> @protocol ASLayoutable <ASEnvironment, ASStackLayoutable, ASStaticLayoutable, ASLayoutablePrivate, ASLayoutableExtensibility>
/** /**
* @abstract Calculate a layout based on given size range. * @abstract Calculate a layout based on given size range.

View File

@@ -114,6 +114,9 @@ void ASLayoutableSetValuesForLayoutable(id<ASLayoutable> layoutable)
} }
} }
#pragma mark - ASLayoutOptionsForwarding
/** /**
* Both an ASDisplayNode and an ASLayoutSpec conform to ASLayoutable. There are several properties * Both an ASDisplayNode and an ASLayoutSpec conform to ASLayoutable. There are several properties
* in ASLayoutable that are used when a node or spec is used in a layout spec. * in ASLayoutable that are used when a node or spec is used in a layout spec.
@@ -250,11 +253,11 @@ void ASLayoutableSetValuesForLayoutable(id<ASLayoutable> layoutable)
}\ }\
@implementation ASDisplayNode(ASLayoutOptions) @implementation ASDisplayNode(ASLayoutOptionsForwarding)
ASEnvironmentLayoutOptionsForwarding ASEnvironmentLayoutOptionsForwarding
@end @end
@implementation ASLayoutSpec(ASLayoutOptions) @implementation ASLayoutSpec(ASLayoutOptionsForwarding)
ASEnvironmentLayoutOptionsForwarding ASEnvironmentLayoutOptionsForwarding
@end @end

View File

@@ -0,0 +1,25 @@
//
// ASLayoutableExtensibility.h
// AsyncDisplayKit
//
// Created by Michael Schneider on 3/29/16.
// Copyright © 2016 Facebook. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol ASLayoutableExtensibility <NSObject>
/// Currently up to 4 BOOL values
- (void)setLayoutOptionExtensionBool:(BOOL)value atIndex:(int)idx;
- (BOOL)layoutOptionExtensionBoolAtIndex:(int)idx;
/// Currently up to 1 NSInteger value
- (void)setLayoutOptionExtensionInteger:(NSInteger)value atIndex:(int)idx;
- (NSInteger)layoutOptionExtensionIntegerAtIndex:(int)idx;
/// Currently up to 1 UIEdgeInsets value
- (void)setLayoutOptionExtensionEdgeInsets:(UIEdgeInsets)value atIndex:(int)idx;
- (UIEdgeInsets)layoutOptionExtensionEdgeInsetsAtIndex:(int)idx;
@end

View File

@@ -14,6 +14,19 @@
enum ASEnvironmentStatePropagation { DOWN, UP }; enum ASEnvironmentStatePropagation { DOWN, UP };
#pragma mark - Set and get extensible values for layout options
void _ASEnvironmentLayoutOptionsExtensionSetBoolAtIndex(id<ASEnvironment> object, int idx, BOOL value);
BOOL _ASEnvironmentLayoutOptionsExtensionGetBoolAtIndex(id<ASEnvironment> object, int idx);
void _ASEnvironmentLayoutOptionsExtensionSetIntegerAtIndex(id<ASEnvironment> object, int idx, NSInteger value);
NSInteger _ASEnvironmentLayoutOptionsExtensionGetIntegerAtIndex(id<ASEnvironment> object, int idx);
void _ASEnvironmentLayoutOptionsExtensionSetEdgeInsetsAtIndex(id<ASEnvironment> object, int idx, UIEdgeInsets value);
UIEdgeInsets _ASEnvironmentLayoutOptionsExtensionGetEdgeInsetsAtIndex(id<ASEnvironment> object, int idx);
#pragma mark - Traversing an ASEnvironment Tree #pragma mark - Traversing an ASEnvironment Tree
void ASEnvironmentPerformBlockOnObjectAndChildren(id<ASEnvironment> object, void(^block)(id<ASEnvironment> object)); void ASEnvironmentPerformBlockOnObjectAndChildren(id<ASEnvironment> object, void(^block)(id<ASEnvironment> object));

View File

@@ -9,6 +9,7 @@
*/ */
#import "ASEnvironmentInternal.h" #import "ASEnvironmentInternal.h"
#import <queue> #import <queue>
//#define LOG(...) NSLog(__VA_ARGS__) //#define LOG(...) NSLog(__VA_ARGS__)
@@ -45,6 +46,54 @@ void ASEnvironmentPerformBlockOnObjectAndParents(id<ASEnvironment> object, void(
} }
#pragma mark - Set and get extensible values from state structs
void _ASEnvironmentLayoutOptionsExtensionSetBoolAtIndex(id<ASEnvironment> object, int idx, BOOL value)
{
NSCAssert(idx < kMaxEnvironmentStateBoolExtensions, @"Setting index outside of max bool extensions space");
ASEnvironmentStateExtensions extension = object.environmentCollection->layoutOptionsState._extensions;
extension.boolExtensions[idx] = value;
object.environmentCollection->layoutOptionsState._extensions = extension;
}
BOOL _ASEnvironmentLayoutOptionsExtensionGetBoolAtIndex(id<ASEnvironment> object, int idx)
{
NSCAssert(idx < kMaxEnvironmentStateBoolExtensions, @"Accessing index outside of max bool extensions space");
return object.environmentCollection->layoutOptionsState._extensions.boolExtensions[idx];
}
void _ASEnvironmentLayoutOptionsExtensionSetIntegerAtIndex(id<ASEnvironment> object, int idx, NSInteger value)
{
NSCAssert(idx < kMaxEnvironmentStateIntegerExtensions, @"Setting index outside of max integer extensions space");
ASEnvironmentStateExtensions extension = object.environmentCollection->layoutOptionsState._extensions;
extension.integerExtensions[idx] = value;
object.environmentCollection->layoutOptionsState._extensions = extension;
}
NSInteger _ASEnvironmentLayoutOptionsExtensionGetIntegerAtIndex(id<ASEnvironment> object, int idx)
{
NSCAssert(idx < kMaxEnvironmentStateIntegerExtensions, @"Accessing index outside of max integer extensions space");
return object.environmentCollection->layoutOptionsState._extensions.integerExtensions[idx];
}
void _ASEnvironmentLayoutOptionsExtensionSetEdgeInsetsAtIndex(id<ASEnvironment> object, int idx, UIEdgeInsets value)
{
NSCAssert(idx < kMaxEnvironmentStateEdgeInsetExtensions, @"Setting index outside of max edge insets extensions space");
ASEnvironmentStateExtensions extension = object.environmentCollection->layoutOptionsState._extensions;
extension.edgeInsetsExtensions[idx] = value;
object.environmentCollection->layoutOptionsState._extensions = extension;
}
UIEdgeInsets _ASEnvironmentLayoutOptionsExtensionGetEdgeInsetsAtIndex(id<ASEnvironment> object, int idx)
{
NSCAssert(idx < kMaxEnvironmentStateEdgeInsetExtensions, @"Accessing index outside of max edge insets extensions space");
return object.environmentCollection->layoutOptionsState._extensions.edgeInsetsExtensions[idx];
}
#pragma mark - Merging functions for states #pragma mark - Merging functions for states
void ASEnvironmentMergeObjectAndState(id<ASEnvironment> object, ASEnvironmentHierarchyState& state, ASEnvironmentStatePropagation propagation) { void ASEnvironmentMergeObjectAndState(id<ASEnvironment> object, ASEnvironmentHierarchyState& state, ASEnvironmentStatePropagation propagation) {