使用getter/setter生成属性并创建私有字段的Delphi实时模板?

使用getter/setter生成属性并创建私有字段的Delphi实时模板?,delphi,live-templates,Delphi,Live Templates,在这里和互联网上搜索并没有让我看到Delphi的实时模板示例,它使用getter/setter生成属性,还生成私有字段并执行复杂化。(SHIFT+CTRL+C) 这可能吗?可以修改前面提到的页面上标题为“读/写属性”的示例,以生成getter/setter方法,而不是私有字段: <?xml version="1.0" encoding="utf-8" ?> <codetemplate xmlns="http://schemas.borland.com/Delphi/2005

在这里和互联网上搜索并没有让我看到Delphi的实时模板示例,它使用getter/setter生成属性,还生成私有字段并执行复杂化。(SHIFT+CTRL+C)

这可能吗?

可以修改前面提到的页面上标题为“读/写属性”的示例,以生成getter/setter方法,而不是私有字段:

<?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>

字段的读写属性
twm
名称
属性的名称
整数
属性的类型
完成任务;

但是,这不会生成私有字段。

可以修改前面提到的页面上标题为“读/写属性”的示例,以生成getter/setter方法,而不是私有字段:

<?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>

字段的读写属性
twm
名称
属性的名称
整数
属性的类型
完成任务;


但是,这不会生成私有字段。

谢谢TOndrej-这与我现在使用的几乎相同,但正如您所说,它不会生成私有字段。Oops。完全没有看到示例中的脚本标记。很抱歉感谢TOndrej-这与我现在使用的几乎相同,但正如您所说,它不会生成private field.Oops。完全没有看到示例中的脚本标记。很抱歉如果您需要在Delphi中实现真正的生产力提升,那么考虑MMX(MultMeorgCortExplorer)——它来自荷兰的Vedoer,并优于所有其他Delphi重构工具。如果在Delphi中需要一个真正的生产力提升,那么考虑MMX(MultMuxCortExplorer)——它来自一个荷兰的Vedoer,并在所有其他Delphi重构工具之上。杰罗恩