[Foundation] Unify a few NSAttributedString constructor implementations. (#16804)
Unify the code for the following constructors: * NSAttributedString (NSData data, NSDictionary options, out NSDictionary resultDocumentAttributes, ref/out NSError error); * NSAttributedString (NSUrl url, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, ref/out NSError error); * NSAttributedString (NSData data, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, ref/out NSError error); These functions use 'ref' arguments instead of 'out' arguments for mobile platforms (likely due to the generator not having proper 'out' parameter support when these functions were implemented), so improve to use 'out' parameters in XAMCORE_5_0 (and macOS, where they already use 'out' parameters). Also fix nullability. Ref: https://github.com/xamarin/xamarin-macios/issues/15216
This commit is contained in:
Родитель
d7f5544c18
Коммит
c1606d5497
|
@ -332,23 +332,6 @@ namespace Foundation
|
|||
[Export ("initWithString:")]
|
||||
NativeHandle Constructor (string str);
|
||||
|
||||
#if !MONOMAC
|
||||
[NoMac]
|
||||
[iOS (7,0)]
|
||||
[Wrap ("this (url, options.GetDictionary ()!, out resultDocumentAttributes, ref error)")]
|
||||
NativeHandle Constructor (NSUrl url, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, ref NSError error);
|
||||
|
||||
[NoMac]
|
||||
[iOS (7,0)]
|
||||
[Export ("initWithData:options:documentAttributes:error:")]
|
||||
NativeHandle Constructor (NSData data, [NullAllowed] NSDictionary options, out NSDictionary resultDocumentAttributes, ref NSError error);
|
||||
|
||||
[NoMac]
|
||||
[iOS (7,0)]
|
||||
[Wrap ("this (data, options.GetDictionary ()!, out resultDocumentAttributes, ref error)")]
|
||||
NativeHandle Constructor (NSData data, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, ref NSError error);
|
||||
#endif
|
||||
|
||||
[Export ("initWithString:attributes:")]
|
||||
[EditorBrowsable (EditorBrowsableState.Advanced)]
|
||||
NativeHandle Constructor (string str, [NullAllowed] NSDictionary attributes);
|
||||
|
@ -369,11 +352,32 @@ namespace Foundation
|
|||
NativeHandle Constructor (NSUrl url, NSDictionary options, out NSDictionary resultDocumentAttributes, out NSError error);
|
||||
#endif
|
||||
|
||||
#if MONOMAC
|
||||
[NoiOS][NoMacCatalyst][NoWatch][NoTV]
|
||||
[Export ("initWithData:options:documentAttributes:error:")]
|
||||
NativeHandle Constructor (NSData data, [NullAllowed] NSDictionary options, out NSDictionary docAttributes, out NSError error);
|
||||
#if XAMCORE_5_0
|
||||
NativeHandle Constructor (NSData data, NSDictionary options, out NSDictionary resultDocumentAttributes, out NSError error);
|
||||
#elif __MACOS__
|
||||
NativeHandle Constructor (NSData data, NSDictionary options, out NSDictionary docAttributes, out NSError error);
|
||||
#else
|
||||
NativeHandle Constructor (NSData data, NSDictionary options, out NSDictionary resultDocumentAttributes, ref NSError error);
|
||||
#endif
|
||||
|
||||
#if __MACOS__ || XAMCORE_5_0
|
||||
[Wrap ("this (url, options.GetDictionary ()!, out resultDocumentAttributes, out error)")]
|
||||
NativeHandle Constructor (NSUrl url, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, out NSError error);
|
||||
#else
|
||||
[Wrap ("this (url, options.GetDictionary ()!, out resultDocumentAttributes, ref error)")]
|
||||
NativeHandle Constructor (NSUrl url, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, ref NSError error);
|
||||
#endif
|
||||
|
||||
#if __MACOS__ || XAMCORE_5_0
|
||||
[Wrap ("this (data, options.GetDictionary ()!, out resultDocumentAttributes, out error)")]
|
||||
NativeHandle Constructor (NSData data, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, out NSError error);
|
||||
#else
|
||||
[Wrap ("this (data, options.GetDictionary ()!, out resultDocumentAttributes, ref error)")]
|
||||
NativeHandle Constructor (NSData data, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, ref NSError error);
|
||||
#endif
|
||||
|
||||
#if MONOMAC
|
||||
[NoiOS][NoMacCatalyst][NoWatch][NoTV]
|
||||
[Export ("initWithDocFormat:documentAttributes:")]
|
||||
NativeHandle Constructor(NSData wordDocFormat, out NSDictionary docAttributes);
|
||||
|
@ -386,14 +390,6 @@ namespace Foundation
|
|||
[Export ("drawWithRect:options:")]
|
||||
void DrawString (CGRect rect, NSStringDrawingOptions options);
|
||||
|
||||
[NoiOS][NoMacCatalyst][NoWatch][NoTV]
|
||||
[Wrap ("this (url, options.GetDictionary ()!, out resultDocumentAttributes, out error)")]
|
||||
NativeHandle Constructor (NSUrl url, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, out NSError error);
|
||||
|
||||
[NoiOS][NoMacCatalyst][NoWatch][NoTV]
|
||||
[Wrap ("this (data, options.GetDictionary ()!, out resultDocumentAttributes, out error)")]
|
||||
NativeHandle Constructor (NSData data, NSAttributedStringDocumentAttributes options, out NSDictionary resultDocumentAttributes, out NSError error);
|
||||
|
||||
[NoiOS][NoMacCatalyst][NoWatch][NoTV]
|
||||
[Deprecated (PlatformName.MacOSX, 10, 11, message: "Use 'NSAttributedString (NSUrl, NSDictionary, out NSDictionary, ref NSError)' instead.")]
|
||||
[Export ("initWithPath:documentAttributes:")]
|
||||
|
|
|
@ -60,7 +60,6 @@
|
|||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #2
|
||||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #3
|
||||
!extra-null-allowed! 'System.Boolean UIKit.UIApplication::CanOpenUrl(Foundation.NSUrl)' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::set_Name(System.String)' has a extraneous [NullAllowed] on parameter #0
|
||||
|
|
|
@ -267,7 +267,6 @@
|
|||
!extra-null-allowed! 'System.Void AppKit.NSView::set_ContentFilters(CoreImage.CIFilter[])' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void AppKit.NSView::WillRemoveSubview(AppKit.NSView)' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
|
||||
|
||||
# Initial result from new rule missing-null-allowed
|
||||
!missing-null-allowed! 'AppKit.INSPasteboardWriting AppKit.NSCollectionViewDelegate::PasteboardWriterForItem(AppKit.NSCollectionView,System.UIntPtr)' is missing an [NullAllowed] on return type
|
||||
|
|
|
@ -101,7 +101,6 @@
|
|||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #2
|
||||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.Runtime.InteropServices.NFloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #3
|
||||
!extra-null-allowed! 'System.Boolean UIKit.UIApplication::CanOpenUrl(Foundation.NSUrl)' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::set_Name(System.String)' has a extraneous [NullAllowed] on parameter #0
|
||||
|
|
|
@ -82,7 +82,6 @@
|
|||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.nfloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #2
|
||||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.nfloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #3
|
||||
!extra-null-allowed! 'System.Boolean UIKit.UIApplication::CanOpenUrl(Foundation.NSUrl)' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::set_Name(System.String)' has a extraneous [NullAllowed] on parameter #0
|
||||
|
|
|
@ -367,7 +367,6 @@
|
|||
!extra-null-allowed! 'System.Void AppKit.NSView::set_ContentFilters(CoreImage.CIFilter[])' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void AppKit.NSView::WillRemoveSubview(AppKit.NSView)' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
|
||||
|
||||
# Initial result from new rule missing-null-allowed
|
||||
!missing-null-allowed! 'AppKit.INSPasteboardWriting AppKit.NSCollectionViewDelegate::PasteboardWriterForItem(AppKit.NSCollectionView,System.nuint)' is missing an [NullAllowed] on return type
|
||||
|
|
|
@ -113,7 +113,6 @@
|
|||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.nfloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #2
|
||||
!extra-null-allowed! 'System.Boolean UIKit.NSLayoutManagerDelegate::ShouldSetLineFragmentRect(UIKit.NSLayoutManager,CoreGraphics.CGRect&,CoreGraphics.CGRect&,System.nfloat&,UIKit.NSTextContainer,Foundation.NSRange)' has a extraneous [NullAllowed] on parameter #3
|
||||
!extra-null-allowed! 'System.Boolean UIKit.UIApplication::CanOpenUrl(Foundation.NSUrl)' has a extraneous [NullAllowed] on parameter #0
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(Foundation.NSAttributedString,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::.ctor(System.String,UIKit.UIAccessibilityCustomActionHandler)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIAccessibilityCustomAction::set_Name(System.String)' has a extraneous [NullAllowed] on parameter #0
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
!missing-pinvoke! UIImageSymbolWeightForFontWeight is not bound
|
||||
|
||||
# Initial result from new rule extra-null-allowed
|
||||
!extra-null-allowed! 'System.Void Foundation.NSAttributedString::.ctor(Foundation.NSData,Foundation.NSDictionary,Foundation.NSDictionary&,Foundation.NSError&)' has a extraneous [NullAllowed] on parameter #1
|
||||
!extra-null-allowed! 'System.Void UIKit.UIBezierPath::set_CGPath(CoreGraphics.CGPath)' has a extraneous [NullAllowed] on parameter #0
|
||||
|
||||
# Initial result from new rule missing-null-allowed
|
||||
|
|
Загрузка…
Ссылка в новой задаче