예제 #1
0
std::unique_ptr<DataSource> DataSourceFactory::create(const Content& content)
{
    switch (content.getType())
    {
#if TIDE_ENABLE_MOVIE_SUPPORT
    case ContentType::movie:
        return std::make_unique<MovieUpdater>(content.getUri());
#endif

    case ContentType::pixel_stream:
#if TIDE_ENABLE_WEBBROWSER_SUPPORT
    case ContentType::webbrowser:
#endif
        return std::make_unique<PixelStreamUpdater>(content.getUri());
    case ContentType::svg:
        return std::make_unique<SVGTiler>(content.getUri(),
                                          content.getMaxDimensions());
    case ContentType::image:
        return std::make_unique<ImageSource>(content.getUri());

#if TIDE_ENABLE_PDF_SUPPORT
    case ContentType::pdf:
        return std::make_unique<PDFTiler>(content.getUri(),
                                          content.getMaxDimensions());
#endif

#if TIDE_USE_TIFF
    case ContentType::image_pyramid:
        return std::make_unique<ImagePyramidDataSource>(content.getUri());
#endif
    default:
        throw std::logic_error("No data source for this content type");
    }
}