Просмотр исходного кода

LibGfx/TIFF: Consider ASCII and UTF-8 as containers

The generator will now create APIs that return a single `String`
instead of a `Vector<String>`.
Lucas CHOLLET 1 год назад
Родитель
Сommit
a382ea7c1f
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      Userland/Libraries/LibGfx/TIFFGenerator.py

+ 3 - 1
Userland/Libraries/LibGfx/TIFFGenerator.py

@@ -104,6 +104,8 @@ def tiff_type_to_cpp(t: TIFFType, without_promotion: bool = False) -> str:
     # Note that the Value<> type doesn't include u16 for this reason
     if not without_promotion:
         t = promote_type(t)
+    if t in [TIFFType.ASCII, TIFFType.UTF8]:
+        return 'String'
     if t == TIFFType.Undefined:
         return 'ByteBuffer'
     if t == TIFFType.UnsignedShort:
@@ -119,7 +121,7 @@ def is_container(t: TIFFType) -> bool:
         An example of that are ASCII strings defined as N * byte. Let's intercept that and generate
         a nice API instead of Vector<u8>.
     """
-    return t in [TIFFType.Byte, TIFFType.Undefined]
+    return t in [TIFFType.ASCII, TIFFType.Byte, TIFFType.Undefined, TIFFType.UTF8]
 
 
 def export_promoter() -> str: