Skip to content

Commit b710112

Browse files
authored
Add OGGraphAnyInputsChanged API (#128)
* Add OGGraphAnyInputsChanged API * Fix OG_COUNTED_BY compacibility issue on Linux * Fix macOS CI Xcode 16.4 issue
1 parent c35c481 commit b710112

File tree

6 files changed

+29
-3
lines changed

6 files changed

+29
-3
lines changed

.github/workflows/macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [macos-15]
16-
xcode-version: [16.0] # Swift 6.0
16+
xcode-version: ["16.0"] # Swift 6.0
1717
runs-on: ${{ matrix.os }}
1818
env:
1919
OPENGRAPH_WERROR: 1

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/OpenGraph/Attribute/Attribute/AnyAttribute.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extension AnyAttribute {
6262
public var _bodyPointer: UnsafeRawPointer {
6363
info.body
6464
}
65-
65+
6666
public var valueType: Any.Type {
6767
info.type.pointee.valueTypeID.type
6868
}
@@ -97,3 +97,10 @@ extension AnyAttribute {
9797
body: (UnsafeMutableRawPointer) -> Void
9898
)
9999
}
100+
101+
extension [AnyAttribute] {
102+
@_transparent
103+
public var anyInputsChanged: Bool {
104+
__OGGraphAnyInputsChanged(self, count)
105+
}
106+
}

Sources/OpenGraph_SPI/Graph/OGGraph.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,8 @@ void OGGraphSetNeedsUpdate(OGGraphRef graph) {
207207
}
208208
// graph->context->set_needs_update();
209209
}
210+
211+
bool OGGraphAnyInputsChanged(const OGAttribute *inputs, size_t count) {
212+
// TODO
213+
return false;
214+
}

Sources/OpenGraph_SPI/include/OGBase.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@
4343
#define OG_CONSTEXPR
4444
#endif
4545

46+
#if !defined(__counted_by)
47+
#if __has_attribute(__counted_by__)
48+
#define __counted_by(N) __attribute__((__counted_by__(N)))
49+
#else
50+
#define __counted_by(N)
51+
#endif
52+
#endif
53+
54+
#define OG_COUNTED_BY(N) __counted_by(N)
55+
4656
#include "OGSwiftSupport.h"
4757
#include "OGTargetConditionals.h"
4858
#include <CoreFoundation/CoreFoundation.h>

Sources/OpenGraph_SPI/include/OGGraph.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ OG_EXPORT
103103
OG_REFINED_FOR_SWIFT
104104
void OGGraphSetNeedsUpdate(OGGraphRef graph) OG_SWIFT_NAME(OGGraphRef.setNeedsUpdate(self:));
105105

106+
OG_EXPORT
107+
OG_REFINED_FOR_SWIFT
108+
bool OGGraphAnyInputsChanged(const OGAttribute *inputs OG_COUNTED_BY(count), size_t count);
109+
106110
OG_EXTERN_C_END
107111

108112
OG_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)