VCFileCodeModel 接口

表示源文件中代码元素的对象。

命名空间:  Microsoft.VisualStudio.VCCodeModel
程序集:  Microsoft.VisualStudio.VCCodeModel(在 Microsoft.VisualStudio.VCCodeModel.dll 中)

语法

声明
<GuidAttribute("0624857C-D3E4-4DC1-9E8D-401434E07364")> _
Public Interface VCFileCodeModel _
    Inherits FileCodeModel2
[GuidAttribute("0624857C-D3E4-4DC1-9E8D-401434E07364")]
public interface VCFileCodeModel : FileCodeModel2
[GuidAttribute(L"0624857C-D3E4-4DC1-9E8D-401434E07364")]
public interface class VCFileCodeModel : FileCodeModel2
[<GuidAttribute("0624857C-D3E4-4DC1-9E8D-401434E07364")>]
type VCFileCodeModel =  
    interface 
        interface FileCodeModel2 
    end
public interface VCFileCodeModel extends FileCodeModel2

VCFileCodeModel 类型公开以下成员。

属性

  名称 说明
公共属性 Attributes 获取对象的所有特性的集合。
公共属性 Classes 获取对象的类集合。
公共属性 CodeElements 获取代码元素的集合。
公共属性 Delegates 获取对象的委托的集合。
公共属性 DTE 获取顶级扩展性对象。
公共属性 EndPoint 获取表示代码项的结束位置的编辑点。
公共属性 Enums 获取对象的枚举集合。
公共属性 Functions 获取对象的函数集合。
公共属性 IDLImports 从对象的 .idl 文件获取 Import 语句的集合。
公共属性 IDLLibraries 获取对象上 Library 元素的集合。
公共属性 Imports 获取对象的 #import 语句的集合。
公共属性 Includes 获取对象的 #include 语句的集合。
公共属性 Interfaces 获取对象的接口的集合。
公共属性 IsBatchOpen 目前尚未实现。
公共属性 IsManaged 如果使用 ref 关键字,则获得 true。
公共属性 IsMCOldSyntax 获取一个值,该值指示是否使用旧语法编译文件。
公共属性 IsSynchronized 未实现。
公共属性 Language 获取用于创作代码的编程语言。
公共属性 Macros 获取对象的宏(#define 语句)的集合。
公共属性 Maps 获取对象的映射集合。
公共属性 Namespaces 获取对象的命名空间的集合。
公共属性 Parent 获取给定对象的直接父对象。
公共属性 ParseStatus 获取一个枚举,它定义分析代码模型文件的结果。
公共属性 StartPoint 获取一个 TextPoint 对象,该对象定义代码项的开始位置。
公共属性 Structs 获取对象的结构元素的集合。
公共属性 Typedefs 获取对象的 typedef 元素的集合。
公共属性 Unions 获取对象的 union 元素的集合。
公共属性 UsingAliases
公共属性 Usings 获取对象的 #using 元素的集合。
公共属性 Variables 获取对象的变量集合。

页首

方法

  名称 说明
公共方法 AbortTransaction 暂停当前事务。
公共方法 AddAttribute 创建新的特性代码构造,并将代码插入正确的位置。
公共方法 AddClass 创建新的类代码构造,并将代码插入正确的位置。
公共方法 AddDelegate 创建新的委托代码构造,并将代码插入正确的位置。
公共方法 AddEnum 创建新的枚举代码构造,并将代码插入正确的位置。
公共方法 AddFunction 创建新的函数代码构造,并将代码插入正确的位置。
公共方法 AddIDLImport 将新的 import 语句添加到 VCFileCodeModel 对象的 .idl 文件。
公共方法 AddIDLLibrary 将新的 library 语句添加到 VCFileCodeModel 对象的 .idl 文件。
公共方法 AddImport 将 #import 元素添加到 VCFileCodeModel 对象中。
公共方法 AddImport_2 将 #import 元素添加到 VCFileCodeModel 对象中。
公共方法 AddInclude 将 #include 元素添加到 VCFileCodeModel 对象中。
公共方法 AddInterface 创建新的接口代码构造,并将代码插入正确的位置。
公共方法 AddMacro 将 #define 元素添加到 VCFileCodeModel 对象中。
公共方法 AddMap 将映射添加到对象。
公共方法 AddNamespace 创建新的命名空间代码构造,并将代码插入正确的位置。
公共方法 AddStruct 创建新的结构代码构造,并将代码插入正确的位置。
公共方法 AddTypedef 将 typedef 语句添加到该对象中。
公共方法 AddUnion 将 union 语句添加到该对象中。
公共方法 AddUsing 将 #using 元素添加到 VCFileCodeModel 对象中。
公共方法 AddUsingAlias
公共方法 AddVariable 创建新的变量代码构造,并将代码插入正确的位置。
公共方法 BeginBatch 目前尚未实现。
公共方法 CodeElementFromFullName 获取对象的指定代码元素的集合。
公共方法 CodeElementFromPoint 获取源文件中指定位置处的代码元素。
公共方法 CommitTransaction 提交对象的当前事务。
公共方法 ElementFromID 目前尚未实现。
公共方法 EndBatch 目前尚未实现。
公共方法 Remove 从解决方案中移除指定的项目。
公共方法 RemoveEx 从解决方案中移除指定的项目(可选择删除)。
公共方法 StartTransaction 开始事务。
公共方法 Synchronize 将解决方案中的所有代码模型对象与源文件的编辑结果进行同步。
公共方法 ValidateMember 验证所建议的名称是否是父对象上下文中给定类型的有效 C++ 名称。
公共方法 ValidateMemberName

页首

备注

VCFileCodeModel 对象用于修改现有源文件和代码元素中包含。

备注

Visual Studio FileCodeModel 对象提供此对象功能的一个主要部分。有关更多信息,请参见 FileCodeModel 对象。

有关如何编译和运行此示例的信息,请参见 如何:编译 Visual C++ 代码模型扩展性的示例代码

示例

此示例检索当前解决方案中第一个项目项的 VCFileCodeModel。 假定默认 MFC 项目打开。

Sub GetSourceFile()
    Dim vcFile as VCFileCodeModel
    Dim project as Project
    project = DTE.Solution.Item(1)
    vcFile = project.ProjectItems.Item(1).FileCodeModel
End Sub

请参阅

参考

Microsoft.VisualStudio.VCCodeModel 命名空间