| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

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

提供: MyMemoWiki
ナビゲーションに移動 検索に移動

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";
}