Exemple #1
0
int main(int argc, char** argv) {
    pomagma::Log::Context log_context(argc, argv);

    if (argc != 4) {
        std::cout << "Usage: " << boost::filesystem::basename(argv[0])
                  << " structure language address"
                  << "\n"
                  << "Environment Variables:\n"
                  << "  POMAGMA_LOG_FILE = " << pomagma::DEFAULT_LOG_FILE
                  << "\n"
                  << "  POMAGMA_LOG_LEVEL = " << pomagma::DEFAULT_LOG_LEVEL
                  << "\n";
        POMAGMA_WARN("incorrect program args");
        exit(1);
    }

    const char* structure_file = argv[1];
    const char* language_file = argv[2];
    const char* address = argv[3];

    pomagma::Server server(structure_file, language_file);
    server.serve(address);

    return 0;
}
int
main()
try
{
    fcppt::log::context log_context(
    fcppt::log::optional_level{
        fcppt::log::level::debug
    },
    sge::log::default_level_streams()
    );

    sge::plugin::manager manager(
        log_context,
        sge::config::plugin_path(),
        sge::plugin::optional_cache_ref()
    );

    typedef
    boost::mpl::vector6<
    sge::audio::loader,
        sge::audio::player,
        sge::font::system,
        sge::image2d::system,
        sge::input::system,
        sge::renderer::core
        >
        plugins;

    fcppt::mpl::for_each<
    plugins
    >(
        [
            &manager
        ](
            auto const _tag
        )
    {
        FCPPT_USE(
            _tag
        );

        typedef
        fcppt::tag_type<
        decltype(
            _tag
        )
        >
        type;

        fcppt::io::cout()
                <<
                fcppt::type_name_from_info(
                    typeid(
                        type
                    )
                )
                <<
                FCPPT_TEXT('\n');

        for(
            auto const &plugin
            :
            manager.collection<
            type
            >()
        )
        {
            sge::plugin::info const &info(
                plugin.info()
            );

            fcppt::io::cout()
                    <<
                    FCPPT_TEXT("\tname: \"")
                    <<
                    info.name()
                    <<
                    FCPPT_TEXT("\", description: \"")
                    <<
                    info.description()
                    <<
                    FCPPT_TEXT("\"\n");
        }
    }
    );
}
catch(
        fcppt::exception const &_exception
    )
{
    fcppt::io::cerr()
            <<
            _exception.string()
            <<
            FCPPT_TEXT('\n');

    return
        EXIT_FAILURE;
}
catch(
        std::exception const &_exception
    )
{
    std::cerr
            <<
            _exception.what()
            <<
            '\n';

    return
        EXIT_FAILURE;
}