コード例 #1
0
void register_Log_class(){

    { //::xfx::Log
        typedef bp::class_< xfx::Log, boost::noncopyable > Log_exposer_t;
        Log_exposer_t Log_exposer = Log_exposer_t( "Log", bp::init< xfx::String const & >(( bp::arg("log_file") )) );
        bp::scope Log_scope( Log_exposer );
        bp::enum_< xfx::Log::EMessageType>("EMessageType")
            .value("EMT_CRITICAL", xfx::Log::EMT_CRITICAL)
            .value("EMT_ERROR", xfx::Log::EMT_ERROR)
            .value("EMT_WARNING", xfx::Log::EMT_WARNING)
            .value("EMT_DEFAULT", xfx::Log::EMT_DEFAULT)
            .export_values()
            ;
        bp::implicitly_convertible< xfx::String const &, xfx::Log >();
        { //::xfx::Log::Print
        
            typedef void ( ::xfx::Log::*print_function_type )( ::xfx::Log::EMessageType const &,::xfx::String const &,::xfx::String const & ) ;
            
            Log_exposer.def( 
                "print"
                , print_function_type( &::xfx::Log::Print )
                , ( bp::arg("type"), bp::arg("msg"), bp::arg("prefix")="" ) );
        
        }
        bp::register_ptr_to_python< boost::shared_ptr< xfx::Log const > >( );
        bp::implicitly_convertible< boost::shared_ptr< xfx::Log >, boost::shared_ptr< xfx::Log const > >( );
    }

}
コード例 #2
0
ファイル: type.c プロジェクト: MatzeB/fluffy
void print_type(const type_t *type)
{
	if (type == NULL) {
		fputs("nil type", out);
		return;
	}

	switch (type->kind) {
	case TYPE_INVALID:
		fputs("invalid", out);
		return;
	case TYPE_TYPEOF: {
		const typeof_type_t *typeof_type = (const typeof_type_t*) type;
		fputs("typeof(", out);
		print_expression(typeof_type->expression);
		fputs(")", out);
		return;
	}
	case TYPE_ERROR:
		fputs("error", out);
		return;
	case TYPE_VOID:
		fputs("void", out);
		return;
	case TYPE_ATOMIC:
		print_atomic_type(&type->atomic);
		return;
	case TYPE_COMPOUND_UNION:
	case TYPE_COMPOUND_STRUCT:
		print_compound_type(&type->compound);
		return;
	case TYPE_FUNCTION:
		print_function_type(&type->function);
		return;
	case TYPE_POINTER:
		print_pointer_type(&type->pointer);
		return;
	case TYPE_ARRAY:
		print_array_type(&type->array);
		return;
	case TYPE_REFERENCE:
		print_type_reference(&type->reference);
		return;
	case TYPE_REFERENCE_TYPE_VARIABLE:
		print_type_reference_variable(&type->reference);
		return;
	case TYPE_BIND_TYPEVARIABLES:
		print_bind_type_variables(&type->bind_typevariables);
		return;
	}
	fputs("unknown", out);
}