-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added MarshalingBehaviorAttribute support
- Loading branch information
1 parent
46dd306
commit 6c89ec1
Showing
3 changed files
with
37 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import DotNetMetadata | ||
|
||
/// Indicates the threading model of a Windows Runtime component. | ||
public enum MarshalingBehaviorAttribute: AttributeType { | ||
public static var namespace: String? { "Windows.Foundation.Metadata" } | ||
public static var name: String { "MarshalingBehaviorAttribute" } | ||
public static var validOn: AttributeTargets { .class } | ||
public static var allowMultiple: Bool { false } | ||
public static var inherited: Bool { true } | ||
|
||
public static func decode(_ attribute: Attribute) throws -> MarshalingType { | ||
let arguments = try attribute.arguments | ||
guard arguments.count == 1, | ||
case .constant(let constant) = arguments[0], | ||
case .int32(let value) = constant, | ||
let marshalingType = MarshalingType(rawValue: value) else { throw InvalidMetadataError.attributeArguments } | ||
return marshalingType | ||
} | ||
} | ||
|
||
public enum MarshalingType: Int32, Hashable { | ||
/// The class prevents marshaling on all interfaces. | ||
case none = 1 | ||
/// The class marshals and unmarshals to the same pointer value on all interfaces. | ||
case agile = 2 | ||
/// The class does not implement IMarshal or forwards to CoGetStandardMarshal on all interfaces. | ||
case standard = 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.