Skip to content

Commit

Permalink
[Bgen/Rgen] Rename method to be an overload of GetValue.
Browse files Browse the repository at this point in the history
We talked about it in a PR in which we agreed to have the same name and
have it as an overload.
  • Loading branch information
mandel-macaque committed Mar 2, 2025
1 parent f6c6aba commit f6f91ff
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/bgen/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void GenerateEnum (Type type)
print ($"/// <param name=\"handle\">The native handle with the name of the constant to retrieve.</param>");
}

print ("public static {0} GetValueFromHandle ({1} handle)", type.Name, NativeHandleType);
print ("public static {0} GetValue ({1} handle)", type.Name, NativeHandleType);
print ("{");
indent++;
print ("using var str = Runtime.GetNSObject<{0}> (handle){1};", backingFieldTypeName, !nullable ? "!" : "");
Expand Down
2 changes: 1 addition & 1 deletion src/bgen/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ string GetFromBindAsWrapper (MemberInformation minfo, out string suffix)
var arrRetType = arrIsNullable ? nullableElementType : retType.GetElementType ();
var valueFetcher = string.Empty;
if (arrType == TypeCache.NSString && !arrIsNullable)
append = $"{TypeManager.FormatType (arrRetType.DeclaringType, arrRetType)}Extensions.GetValueFromHandle";
append = $"{TypeManager.FormatType (arrRetType.DeclaringType, arrRetType)}Extensions.GetValue ";
else if (arrType == TypeCache.NSNumber && !arrIsNullable) {
if (arrRetType.IsEnum) {
// get the underlying type of the enum and use a callback with the appropiate one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void EmitExtensionMethods (TabbedWriter<StringWriter> classBlock, in Binding bin

// get value from a handle, this is a helper method used in the BindAs bindings.
using (var getValueFromHandle =
classBlock.CreateBlock ($"public static {binding.Name} GetValueFromHandle (NativeHandle handle)",
classBlock.CreateBlock ($"public static {binding.Name} GetValue (NativeHandle handle)",
true)) {
getValueFromHandle.WriteRaw (
@"using var str = Runtime.GetNSObject<NSString> (handle)!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public static AVCaptureDeviceType GetValue (NSString constant)
throw new NotSupportedException ($"The constant {constant} has no associated enum value on this platform.");
}

public static AVCaptureDeviceType GetValueFromHandle (NativeHandle handle)
public static AVCaptureDeviceType GetValue (NativeHandle handle)
{
using var str = Runtime.GetNSObject<NSString> (handle)!;
return GetValue (str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static AVCaptureSystemPressureLevel GetValue (NSString constant)
throw new NotSupportedException ($"The constant {constant} has no associated enum value on this platform.");
}

public static AVCaptureSystemPressureLevel GetValueFromHandle (NativeHandle handle)
public static AVCaptureSystemPressureLevel GetValue (NativeHandle handle)
{
using var str = Runtime.GetNSObject<NSString> (handle)!;
return GetValue (str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static CustomLibraryEnum GetValue (NSString constant)
throw new NotSupportedException ($"The constant {constant} has no associated enum value on this platform.");
}

public static CustomLibraryEnum GetValueFromHandle (NativeHandle handle)
public static CustomLibraryEnum GetValue (NativeHandle handle)
{
using var str = Runtime.GetNSObject<NSString> (handle)!;
return GetValue (str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static CustomLibraryEnumInternal GetValue (NSString constant)
throw new NotSupportedException ($"The constant {constant} has no associated enum value on this platform.");
}

public static CustomLibraryEnumInternal GetValueFromHandle (NativeHandle handle)
public static CustomLibraryEnumInternal GetValue (NativeHandle handle)
{
using var str = Runtime.GetNSObject<NSString> (handle)!;
return GetValue (str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public static AVMediaCharacteristics GetValue (NSString constant)
throw new NotSupportedException ($"The constant {constant} has no associated enum value on this platform.");
}

public static AVMediaCharacteristics GetValueFromHandle (NativeHandle handle)
public static AVMediaCharacteristics GetValue (NativeHandle handle)
{
using var str = Runtime.GetNSObject<NSString> (handle)!;
return GetValue (str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public static AVMediaCharacteristics GetValue (NSString constant)
throw new NotSupportedException ($"The constant {constant} has no associated enum value on this platform.");
}

public static AVMediaCharacteristics GetValueFromHandle (NativeHandle handle)
public static AVMediaCharacteristics GetValue (NativeHandle handle)
{
using var str = Runtime.GetNSObject<NSString> (handle)!;
return GetValue (str);
Expand Down

0 comments on commit f6f91ff

Please sign in to comment.