共用方式為


VCFileCodeModel Interface

An object representing the code elements in a source file.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

Syntax

'宣告
<GuidAttribute("DE3653F8-737D-4BDC-A340-6BA8DDDC0FA8")> _
Public Interface VCFileCodeModel _
    Inherits FileCodeModel2
[GuidAttribute("DE3653F8-737D-4BDC-A340-6BA8DDDC0FA8")]
public interface VCFileCodeModel : FileCodeModel2
[GuidAttribute(L"DE3653F8-737D-4BDC-A340-6BA8DDDC0FA8")]
public interface class VCFileCodeModel : FileCodeModel2
[<GuidAttribute("DE3653F8-737D-4BDC-A340-6BA8DDDC0FA8")>]
type VCFileCodeModel =  
    interface
        interface FileCodeModel2
    end
public interface VCFileCodeModel extends FileCodeModel2

The VCFileCodeModel type exposes the following members.

Properties

  Name Description
Public property Attributes Gets a collection of all of the attributes for the object.
Public property Classes Gets a collection of classes for the object.
Public property CodeElements (Inherited from FileCodeModel2.)
Public property CodeElements Gets a collection of code elements.
Public property Delegates Gets a collection of delegates for the object.
Public property DTE (Inherited from FileCodeModel2.)
Public property DTE Gets the top-level extensibility object.
Public property EndPoint Gets the edit point that is the location of the end of the code item.
Public property Enums Gets a collection of enumerations for the object.
Public property Functions Gets a collection of functions for the object.
Public property IDLImports Gets the collection of Import statements from the .idl file of the object.
Public property IDLLibraries Gets the collection of Library elements on the object.
Public property Imports Gets the collection of #import statements for the object.
Public property Includes Gets the collection of #include statements for the object.
Public property Interfaces Gets the collection of interfaces for the object.
Public property IsBatchOpen (Inherited from FileCodeModel2.)
Public property IsBatchOpen Not currently implemented.
Public property IsManaged Gets true if the ref keyword is used.
Public property IsMCOldSyntax Gets a value indicating whether the file was compiled using the old syntax.
Public property IsSynchronized Not implemented.
Public property Language (Inherited from FileCodeModel2.)
Public property Language Gets the programming language used to author the code.
Public property Macros Gets the collection of macros (#define statements) for the object.
Public property Maps Gets the collection of maps for the object.
Public property Namespaces Gets the collection of namespaces for the object.
Public property Parent (Inherited from FileCodeModel2.)
Public property Parent Gets the immediate parent object of a given object.
Public property ParseStatus (Inherited from FileCodeModel2.)
Public property ParseStatus Gets an enumeration defining the outcome of parsing the file for the code model.
Public property StartPoint Gets a TextPoint object that defines the beginning of the code item.
Public property Structs Gets the collection of structure elements for the object.
Public property Typedefs Gets the collection of typedef elements for the object.
Public property Unions Gets the collection of union elements for the object.
Public property Usings Gets the collection of #using elements for the object.
Public property Variables Gets the collection of variables for the object.

Top

Methods

  Name Description
Public method AbortTransaction Halts the current transaction.
Public method AddAttribute(String, String, Object) (Inherited from FileCodeModel2.)
Public method AddAttribute(String, String, Object) Creates a new attribute code construct and inserts the code in the correct location.
Public method AddClass(String, Object, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public method AddClass(String, Object, Object, Object, vsCMAccess) Creates a new class code construct and inserts the code in the correct location.
Public method AddDelegate(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public method AddDelegate(String, Object, Object, vsCMAccess) Creates a new delegate code construct and inserts the code in the correct location.
Public method AddEnum(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public method AddEnum(String, Object, Object, vsCMAccess) Creates a new enumeration code construct and inserts the code in the correct location.
Public method AddFunction(String, vsCMFunction, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public method AddFunction(String, vsCMFunction, Object, Object, vsCMAccess) Creates a new function code construct and inserts the code in the correct location.
Public method AddIDLImport Adds a new import statement to the .idl file of the VCFileCodeModel object.
Public method AddIDLLibrary Adds a new library statement to the .idl file of the VCFileCodeModel object.
Public method AddImport(String, Object, String) (Inherited from FileCodeModel2.)
Public method AddImport(String, Object, String) Adds a #import element to the VCFileCodeModel object.
Public method AddImport_2 Adds a #import element to the VCFileCodeModel object.
Public method AddInclude Adds a #include element to the VCFileCodeModel object.
Public method AddInterface(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public method AddInterface(String, Object, Object, vsCMAccess) Creates a new interface code construct and inserts the code in the correct location.
Public method AddMacro Adds a #define element to the VCFileCodeModel object.
Public method AddMap Adds a map to the object.
Public method AddNamespace(String, Object) (Inherited from FileCodeModel2.)
Public method AddNamespace(String, Object) Creates a new namespace code construct and inserts the code in the correct location.
Public method AddStruct(String, Object, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public method AddStruct(String, Object, Object, Object, vsCMAccess) Creates a new structure code construct and inserts the code in the correct location.
Public method AddTypedef Adds a typedef statement to the object.
Public method AddUnion Adds a union statement to the object.
Public method AddUsing Adds a #using element to the VCFileCodeModel object.
Public method AddVariable(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public method AddVariable(String, Object, Object, vsCMAccess) Creates a new variable code construct and inserts the code in the correct location.
Public method BeginBatch() (Inherited from FileCodeModel2.)
Public method BeginBatch() Not currently implemented.
Public method CodeElementFromFullName Gets a collection of the specified code elements for the object.
Public method CodeElementFromPoint(TextPoint, vsCMElement) (Inherited from FileCodeModel2.)
Public method CodeElementFromPoint(TextPoint, vsCMElement) Gets a code element at a specific location in a source file.
Public method CommitTransaction Commits the current transaction for the object.
Public method ElementFromID(String) (Inherited from FileCodeModel2.)
Public method ElementFromID(String) Not currently implemented.
Public method EndBatch() (Inherited from FileCodeModel2.)
Public method EndBatch() Not currently implemented.
Public method Remove(Object) (Inherited from FileCodeModel2.)
Public method Remove(Object) Removes the specified project from the solution.
Public method RemoveEx Removes the specified project from the solution with an option to delete.
Public method StartTransaction Begins a transaction.
Public method Synchronize() (Inherited from FileCodeModel2.)
Public method Synchronize() Synchronizes all code model objects in the solution with edits made to source files.
Public method ValidateMember Validates that the proposed name is a valid C++ name for the kind given in the context of the parent object.

Top

Remarks

The VCFileCodeModel object is used to modify an existing source file and the code elements contained within.

注意

A large part of the functionality of this object is provided by the Visual Studio FileCodeModel object. For more information, see FileCodeModel object.

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

Examples

This example retrieves the VCFileCodeModel for the first project item of the current solution. It assumes a default MFC project is open.

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

See Also

Reference

Microsoft.VisualStudio.VCCodeModel Namespace