[ID3 Dev] Implementation question
Jud White
jwhite at cdtag.com
Wed Jan 24 06:23:21 PST 2007
Brian,
I keep two dictionaries for each tag format, one for single occurrence
frames and one for multiple occurrence frames. The keys are always
FrameID's. The single occurrence dictionary's value is of type IFrame,
so without knowing the actual type of the specific frame you can call
the Read/Write methods, you just need to know the FrameID. The multiple
occurrence dictionary's value implements another interface with an Add
method that returns an IFrame, which can then have its Read/Write
methods called. I also use a type (UnknownFrame) to catch values not in
either dictionary and ensure they are written back. Adding another
supported frame just requires adding another key/value to the
appropriate dictionaries, no need to update the Read/Write methods of
the ID3 class.
Brian Mearns wrote:
> I have a question for developers who use an OO paradigm for ID3 work:
> Assuming there are different classes to implement different frames,
> but not neccessarily one class per frame (for instance, a class to
> handle text-frames and another to handle everything else), what
> pattern do you use to decide which class will be called on while
> parsing a tag? I'd like to keep it as abstract as possible so that,
> for instance, if I add another class to handle another type of frame
> later, it will be easy and consistent to work it in.
>
> Is that at all clear?
>
> Thanks,
> -Brian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: id3v2-unsubscribe at id3.org
> For additional commands, e-mail: id3v2-help at id3.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: id3v2-unsubscribe at id3.org
For additional commands, e-mail: id3v2-help at id3.org
More information about the ID3v2
mailing list