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

MyMemoWiki

「Perl VBのプロパティプロシージャを生成」の版間の差分

提供: MyMemoWiki
ナビゲーションに移動 検索に移動
(ページの作成:「==Perl VBのプロパティプロシージャを生成== #プロパティ @props = ( "fieldName", "fieldLogicalName", "dataType",…」)
 
12行目: 12行目:
 
  #プロパティの型
 
  #プロパティの型
 
  %types = (
 
  %types = (
     "fieldName"        =>"String",
+
     "fieldName"        =>"String",
     "fieldLogicalName" =>"String",
+
     "fieldLogicalName" =>"String",
     "dataType"        =>"String",
+
     "dataType"        =>"String",
     "byteSize"        =>"String",
+
     "byteSize"        =>"String",
     "dataLength"      =>"String",
+
     "dataLength"      =>"String",
     "notes"            =>"String"
+
     "notes"            =>"String"
 
  );
 
  );
 
  #プロパティのコメント
 
  #プロパティのコメント
 
  %comments = (
 
  %comments = (
     "fieldName"        =>"列名(物理)",
+
     "fieldName"        =>"列名(物理)",
     "fieldLogicalName" =>"列名(論理)",
+
     "fieldLogicalName" =>"列名(論理)",
     "dataType"        =>"データ型",
+
     "dataType"        =>"データ型",
     "byteSize"        =>"バイト数",
+
     "byteSize"        =>"バイト数",
     "dataLength"      =>"桁数",
+
     "dataLength"      =>"桁数",
     "notes"            =>"備考"
+
     "notes"            =>"備考"
 
  );
 
  );
 
   
 
   
 
  $prop_cnt = @props;
 
  $prop_cnt = @props;
  for ($i=0; $i<$prop_cnt; $i++) {
+
  for ($i=0; $i&lt;$prop_cnt; $i++) {
 
     $prop_name = @props[$i];
 
     $prop_name = @props[$i];
 
     $prop_type = $types{$prop_name};
 
     $prop_type = $types{$prop_name};
38行目: 38行目:
 
  }
 
  }
 
  print "\n\n";
 
  print "\n\n";
  for ($i=0; $i<$prop_cnt; $i++) {
+
  for ($i=0; $i&lt;$prop_cnt; $i++) {
 
     $prop_name = @props[$i];
 
     $prop_name = @props[$i];
 
     $prop_type = $types{$prop_name};
 
     $prop_type = $types{$prop_name};

2020年2月15日 (土) 08:05時点における版

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