Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
317 Beiträge
 
#10

AW: Methoden in abgeleiteten Klassen ggf. einschränken

  Alt 12. Jul 2024, 11:12
I would go with something like TMetaDataAudioFactory with half fully-abstracted base class that support everything.
The base with have everything you could use or has been implemented but in two ways, like for each type there is a method like
Code:
function LyricsSupported : Boolean;
This will indicate that LyricsCount and LyricsItems are possible to use. (In an imaginary case where there is multiple lyrics in multiple language)

In the base/abstract class LyricsSupported is an abstract method, meaning all the derived class must implement this one, this will force you to not forget about them.
While in that base methods like LyricsCount and LyricsItems will raise an exception this will enforce you and the users of your library to check LyricsSupported before use, and will remove the need to implement in the derived and specific MetaData parsers, simply override the base classes to prevent raising exceptions.

for the end user/developer the use is straight forward, call PictureSupported then use Picture, or Picture and PictureCount.... and may be PictureMaxCount, that depends on what you see fit for each file type.
Kas
  Mit Zitat antworten Zitat