开发者

Live Template for Delphi that generate a Property with getter / setter and create the private field?

开发者 https://www.devze.com 2022-12-31 07:01 出处:网络
Searching here and on the internet have not let me to a example of a Live Template for Delphi that ge开发者_JAVA技巧nerate a Property with getter / setter and also generate the private field and execu

Searching here and on the internet have not let me to a example of a Live Template for Delphi that ge开发者_JAVA技巧nerate a Property with getter / setter and also generate the private field and execute the complication. (SHIFT + CTRL + C)

Is this possible?


The example titled "Read/write property" on the already-mentioned Delphi Live Templates page can be modified to generate getter/setter methods instead of a private field:

<?xml version="1.0" encoding="utf-8" ?>
<codetemplate   xmlns="http://schemas.borland.com/Delphi/2005/codetemplates"
                version="1.0.0">
    <template name="prop" invoke="manual">
        <description>
            read write property for field
        </description>
        <author>
            twm
        </author>
        <point name="ident">
            <text>Name</text>
            <hint>the name for the property</hint>
        </point>
        <point name="type">
            <text>Integer</text>
            <hint>the type for the property</hint>
        </point>
        <script language="Delphi" onenter="false" onleave="true">
            InvokeClassCompletion;
        </script>
        <code language="Delphi" delimiter="|">
        <![CDATA[property |ident|: |type| read Get|ident| write Set|ident|;
|end|]]>
        </code>
    </template>
</codetemplate>

This, however, doesn't generate the private field.

0

精彩评论

暂无评论...
验证码 换一张
取 消