Example #1
0
/** Prints init_attr function for each class */
void PrintFileContents10::print_init_attr_func( std::ofstream & outfile , ClassValues * cv ) {

    ClassValues::FieldIterator fit ;

    printOpenNamespaceBlocks(outfile, cv) ;
    outfile << "\nvoid init_attr" ;
    printNamespaces( outfile, cv , "__" ) ;
    printContainerClasses( outfile, cv , "__" ) ;
    outfile << cv->getMangledTypeName() ;
    outfile << "() {\n\n"
"    static int initialized_1337 ;\n"
"    if ( initialized_1337 ) {\n"
"            return ;\n"
"    }\n"
"    initialized_1337 = 1 ;\n\n"
"    Trick::MemoryManager * mm ;\n"
"    std::string next_attr ;\n"
"    mm = trick_MM ;\n" ;

    if ( cv->getMangledTypeName() != cv->getName() ) {
        outfile << "    typedef " << cv->getName() << " " << cv->getMangledTypeName() << " ;\n\n" ;
    }

    unsigned int ii = 0 ;
    for ( fit = cv->field_begin() ; fit != cv->field_end() ; fit++ ) {
        if ( determinePrintAttr(cv , *fit) ) {
            print_field_init_attr_stmts(outfile, *fit, cv, ii) ;
            ii++ ;
        }
    }
    print_inherited_add_attr_info(outfile, cv ) ;
    outfile << "}\n\n" ;
    printCloseNamespaceBlocks(outfile, cv) ;
}
Example #2
0
/** Prints init_attr function for each class */
void PrintFileContents10::print_init_attr_func( std::ostream & ostream , ClassValues * cv ) {
    cv->printOpenNamespaceBlocks(ostream) ;
    ostream << "\nvoid init_attr" << cv->getFullyQualifiedMangledTypeName("__") << "() {\n\n"
            << "    static int initialized ;\n"
            << "    if (initialized) {\n"
            << "        return;\n"
            << "    }\n"
            << "    initialized = 1;\n\n" ;

    unsigned int ii = 0;
    for ( FieldDescription* field : getPrintableFields(*cv) ) {
        print_field_init_attr_stmts(ostream, field, cv, ii++) ;
    }
    print_inherited_add_attr_info(ostream, cv ) ;
    ostream << "}\n" ;
    cv->printCloseNamespaceBlocks(ostream) ;
}