oo.tpl

来自「perl learn perl by examples」· TPL 代码 · 共 43 行

TPL
43
字号
@perl $user = $ENV{"USER"};
@foreach class_list          
@//-------------------------------------------------------------------------
@// Note: we are opening a new ".h" file within the foreach above ...
@perl print "Generating ${class_name}.h\n";
@openfile ${class_name}.h 
#ifndef _${class_name}_h_
#define _${class_name}_h_
#include <stdio.h>
// File : '${class_name}.h'
// User : "$user"
class $class_name {
@foreach attr_list
   $attr_type $attr_name;
@end
   $class_name(); // private constructor. Use Create()
public:
   // Methods
   $class_name* Create();
    ~$class_name();
   // Accessor Methods;
@foreach attr_list
   $attr_type   get_${attr_name}();
   void set_${attr_name}($attr_type);
@end .. attr_list
}
#endif
@end .. class_list
@//
@//-------------------------------------------------------------------------
@//
@perl print "db.sql\n";
@openfile db.sql 
@perl %db_typemap = ("int" => 'integer', string => 'varchar');
@foreach class_list
create table $class_name (
@foreach attr_list
@perl $typemap = $db_typemap{$attr_type};
     $attr_name $typemap,
@end
)
@end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?