Click here to Skip to main content
15,895,142 members
Articles / Programming Languages / C++

The Dynamic Registry Factory

Rate me:
Please Sign up or sign in to vote.
4.40/5 (7 votes)
6 Jan 2010CPOL5 min read 25.3K   102   9  
The idea was to write the system in such a way that every format will have a common interface, and adding (or removing) a new format will not a affect the existing code at all.
//
//  Copyright (c) 2009 Roman Kecher (rmn@cplusplus.co.il)
//
//  Distributed under the Code Project Open License, Version 1.02.
//  See http://www.codeproject.com/info/cpol10.aspx
//

#ifndef __FORMAT_MP3__
#define __FORMAT_MP3__

#include "knownformat.h"
#include "knownformattemplatedfactory.h"

#include <string>

/**
 * This class implements the MP3 file format.
 */
class FormatMP3 : public KnownFormat {
    public:
        FormatMP3 (const std::string &filename);

        virtual std::string getFormatName () const;

    protected:
        const static std::string MAGIC;
        const static std::string NAME;

    private:
        // declare registration
        DECLARE_FORMAT(FormatMP3);
};

#endif // __FORMAT_MP3__

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Israel Israel
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions