Mirror reflection library - Lagoon run-time layer 0.5.13

lagoon/example/various_01.cpp

This example shows the usage of the various utilities provided by Lagoon

Copyright 2008-2010 Matus Chochlik. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <mirror/mirror.hpp>
#include <lagoon/lagoon.hpp>
#include <iostream>

int main(void)
{
    using namespace lagoon;
    //
    // reflect the global scope
    auto meta_gs(reflected_global_scope());
    // reflect the wstring* type
    auto meta_w(reflected_type<std::wstring*>());
    // reflect the vector<string> type
    auto meta_v(reflected_type<std::vector<std::wstring> >());
    //
    // get the full name of the type
    std::cout << meta_w->full_name() << std::endl;
    std::cout << meta_v->full_name() << std::endl;
    // get the full name of the scope of the reflected type
    std::cout << meta_w->scope()->full_name() << std::endl;
    std::cout << meta_v->scope()->full_name() << std::endl;
    //
    // get the full name of the type used to define
    // the mstring type
    //
    // get the meta_templated_type interface, get the zeroth
    // parameter and print it full type name
    std::cout << meta_v.as<meta_templated_type>()->
        template_parameters().at(0)->full_name() <<
        std::endl;
    // get the meta_templated_type interface, get the first
    // parameter and print it full type name
    std::cout << meta_v.as<meta_templated_type>()->
        template_parameters().at(1)->full_name() <<
        std::endl;
    //
    return 0;
}


Copyright © 2006-2011 Matus Chochlik, University of Zilina, Zilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Fri Dec 16 2011 by Doxygen (version 1.7.3).
Important note: Although the 'boostified' version of Mirror uses the Boost C++ libraries Coding Guidelines and is implemented inside of the boost namespace, it IS NOT an officially reviewed and accepted Boost library. Mirror is being developed with the intention to be submitted for review for inclusion to the Boost C++ libraries.