トップ 差分 一覧 ping ソース 検索 ヘルプ PDF RSS ログイン

Perl VBのプロパティプロシージャを生成



目次



記事一覧

キーワード

Perl VBのプロパティプロシージャを生成


#プロパティ
@props = (
    "fieldName",        
    "fieldLogicalName",
    "dataType",         
    "byteSize",         
    "dataLength",       
    "notes"            
);
#プロパティの型
%types = (
    "fieldName"        =>"String",
    "fieldLogicalName" =>"String",
    "dataType"         =>"String",
    "byteSize"         =>"String",
    "dataLength"       =>"String",
    "notes"            =>"String"
);
#プロパティのコメント
%comments = (
    "fieldName"        =>"列名(物理)",
    "fieldLogicalName" =>"列名(論理)",
    "dataType"         =>"データ型",
    "byteSize"         =>"バイト数",
    "dataLength"       =>"桁数",
    "notes"            =>"備考"
);

$prop_cnt = @props;
for ($i=0; $i<$prop_cnt; $i++) {
    $prop_name = @props[$i];
    $prop_type = $types{$prop_name};
    $comment   = $comments{$prop_name};
    
    print "Private m_$prop_name \t\t\tAs $prop_type\t'$comment\n";
}
print "\n\n";
for ($i=0; $i<$prop_cnt; $i++) {
    $prop_name = @props[$i];
    $prop_type = $types{$prop_name};
    $comment   = $comments{$prop_name};

    print "'$comment を取得する\n";
    print "Public Property Get $prop_name() As $prop_type\n";
    print "    $prop_name = m_$prop_name\n";
    print "End Property\n";

    print "'$comment を設定する\n";
    print "Public Property Let $prop_name(ByVal new_$prop_name As $prop_type)\n";
    print "    m_$prop_name = new_$prop_name\n";
    print "End Property\n";
}



YAGI Hiroto (piroto@a-net.email.ne.jp)
twitter http://twitter.com/pppiroto

Copyright© 矢木 浩人 All Rights Reserved.