Menu

#2 Have one base class called "SubtitleFormat"

open
None
5
2009-01-16
2009-01-16
wj32
No

OSE should have a base class named "SubtitleFormat" which is then used to make specialized subtitle format classes. SubtitleFormat should provide basic functionality like having a collection of "subtitle entries". The specialized subtitle format class should then provide "Load" and "Save" methods.

There should also be a SubtitleEntry class which has the properties "Bold" and "Italic", and a SubtitleEntryCollection which derives from Collection<SubtitleEntry>.

Discussion

  • Lefteris Aslanoglou

    • assigned_to: nobody --> leftos
     
  • Lefteris Aslanoglou

    I think that 0.1.1.0 implements that with the Subtitles class. It has specialized Load and Save subs for each format which in turn fill up the given SubtitleType instance with all subtitles, and included are the Show, Hide, Text, isBold, isItalic, etc.

    Are you talking about something different, and if yes, in what way?

     
  • wj32

    wj32 - 2009-01-16

    Yes you do have a Subtitles class, but you should have formats in *derived* classes implementing format-specific features. Right now it's just specialized all in one class with different method names for different subtitle formats. You need to have something like this:

    public class SubtitleEntry
    {
    private bool _isBold, _isItalic;
    private string _text;
    private TimeSpan _time;

    public bool IsBold { get { return _isBold; } set { _isBold = value; } }
    // implement the other properties
    }

    public class SubtitleEntryCollection : System.Collections.ObjectModel<SubtitleEntry>
    { ... }

    public abstract class Subtitles
    {
    private SubtitleEntryCollection _subtitleCollection;

    public SubtitleEntryCollection Subtitles
    { ... }

    public abstract void Load(string fileName);
    public abstract void Save(string fileName);
    }

    public class SrtSubtitles : Subtitles
    {
    public void Load(string fileName)
    {
    foreach (var s in File.ReadAllText(fileName))
    ...
    }

    public void Save(string fileName)
    {
    ...
    }
    }

    public class MyFormatSubtitles : Subtitles
    {
    public ... // you get the idea
    }

     
  • Lefteris Aslanoglou

    Yap, I get what you mean. It's just that I'll need to freshen up my OOP knowledge quite a bit before I try this. If you're willing to help with some coding, tell me.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.