Skip to content

Commit 37c0c02

Browse files
committed
Add attribute and resetSource() to IndirectAttribute
1 parent 8dc21f6 commit 37c0c02

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Sources/OpenGraph/Attribute/Indirect/IndirectAttribute.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,19 @@ public struct IndirectAttribute<Value> {
1515
identifier = source.identifier.createIndirect(size: UInt64(MemoryLayout<Value>.size))
1616
}
1717

18+
public var attribute: Attribute<Value> {
19+
Attribute(identifier: identifier)
20+
}
21+
1822
public var source: Attribute<Value> {
1923
get { Attribute(identifier: identifier.source) }
2024
nonmutating set { identifier.source = newValue.identifier }
2125
}
2226

27+
public func resetSource() {
28+
__OGGraphResetIndirectAttribute(identifier, false)
29+
}
30+
2331
public var dependency: AnyAttribute? {
2432
get {
2533
let dependency = identifier._indirectDependency

Sources/OpenGraphCxx/Attribute/OGAttribute.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ void OGGraphSetIndirectAttribute(OGAttribute attribute1, OGAttribute attribute2)
9898
// TODO
9999
}
100100

101+
void OGGraphResetIndirectAttribute(OGAttribute attribute, bool non_nil) {
102+
// TODO
103+
}
104+
101105
OGAttribute OGGraphCreateAttribute(long index, const void *body, const void * value) {
102106
// TODO
103107
return OGAttributeNil;

Sources/OpenGraphCxx/include/OpenGraph/OGAttribute.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ OG_EXPORT
8383
OG_REFINED_FOR_SWIFT
8484
void OGGraphSetIndirectAttribute(OGAttribute attribute1, OGAttribute attribute2) OG_SWIFT_NAME(setter:OGAttribute.source(self:_:));
8585

86+
OG_EXPORT
87+
OG_REFINED_FOR_SWIFT
88+
void OGGraphResetIndirectAttribute(OGAttribute attribute, bool non_nil);
89+
8690
OG_EXPORT
8791
OG_REFINED_FOR_SWIFT
8892
OGAttribute OGGraphCreateAttribute(long index, const void *body, const void * _Nullable value);

0 commit comments

Comments
 (0)