We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

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)

[GuidAttribute("DE3653F8-737D-4BDC-A340-6BA8DDDC0FA8")]
public interface VCFileCodeModel : FileCodeModel2

The VCFileCodeModel type exposes the following members.

  NameDescription
Public propertyAttributesGets a collection of all of the attributes for the object.
Public propertyClassesGets a collection of classes for the object.
Public propertyCodeElements (Inherited from FileCodeModel2.)
Public propertyCodeElementsGets a collection of code elements.
Public propertyDelegatesGets a collection of delegates for the object.
Public propertyDTE (Inherited from FileCodeModel2.)
Public propertyDTEGets the top-level extensibility object.
Public propertyEndPointGets the edit point that is the location of the end of the code item.
Public propertyEnumsGets a collection of enumerations for the object.
Public propertyFunctionsGets a collection of functions for the object.
Public propertyIDLImportsGets the collection of Import statements from the .idl file of the object.
Public propertyIDLLibrariesGets the collection of Library elements on the object.
Public propertyImportsGets the collection of #import statements for the object.
Public propertyIncludesGets the collection of #include statements for the object.
Public propertyInterfacesGets the collection of interfaces for the object.
Public propertyIsBatchOpen (Inherited from FileCodeModel2.)
Public propertyIsBatchOpenNot currently implemented.
Public propertyIsManagedGets true if the ref keyword is used.
Public propertyIsMCOldSyntaxGets a value indicating whether the file was compiled using the old syntax.
Public propertyIsSynchronizedNot implemented.
Public propertyLanguage (Inherited from FileCodeModel2.)
Public propertyLanguageGets the programming language used to author the code.
Public propertyMacrosGets the collection of macros (#define statements) for the object.
Public propertyMapsGets the collection of maps for the object.
Public propertyNamespacesGets the collection of namespaces for the object.
Public propertyParent (Inherited from FileCodeModel2.)
Public propertyParentGets the immediate parent object of a given object.
Public propertyParseStatus (Inherited from FileCodeModel2.)
Public propertyParseStatusGets an enumeration defining the outcome of parsing the file for the code model.
Public propertyStartPointGets a TextPoint object that defines the beginning of the code item.
Public propertyStructsGets the collection of structure elements for the object.
Public propertyTypedefsGets the collection of typedef elements for the object.
Public propertyUnionsGets the collection of union elements for the object.
Public propertyUsingsGets the collection of #using elements for the object.
Public propertyVariablesGets the collection of variables for the object.
Top

  NameDescription
Public methodAbortTransactionHalts the current transaction.
Public methodAddAttribute(String, String, Object) (Inherited from FileCodeModel2.)
Public methodAddAttribute(String, String, Object)Creates a new attribute code construct and inserts the code in the correct location.
Public methodAddClass(String, Object, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public methodAddClass(String, Object, Object, Object, vsCMAccess)Creates a new class code construct and inserts the code in the correct location.
Public methodAddDelegate(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public methodAddDelegate(String, Object, Object, vsCMAccess)Creates a new delegate code construct and inserts the code in the correct location.
Public methodAddEnum(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public methodAddEnum(String, Object, Object, vsCMAccess)Creates a new enumeration code construct and inserts the code in the correct location.
Public methodAddFunction(String, vsCMFunction, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public methodAddFunction(String, vsCMFunction, Object, Object, vsCMAccess)Creates a new function code construct and inserts the code in the correct location.
Public methodAddIDLImportAdds a new import statement to the .idl file of the VCFileCodeModel object.
Public methodAddIDLLibraryAdds a new library statement to the .idl file of the VCFileCodeModel object.
Public methodAddImport(String, Object, String) (Inherited from FileCodeModel2.)
Public methodAddImport(String, Object, String)Adds a #import element to the VCFileCodeModel object.
Public methodAddImport_2Adds a #import element to the VCFileCodeModel object.
Public methodAddIncludeAdds a #include element to the VCFileCodeModel object.
Public methodAddInterface(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public methodAddInterface(String, Object, Object, vsCMAccess)Creates a new interface code construct and inserts the code in the correct location.
Public methodAddMacroAdds a #define element to the VCFileCodeModel object.
Public methodAddMapAdds a map to the object.
Public methodAddNamespace(String, Object) (Inherited from FileCodeModel2.)
Public methodAddNamespace(String, Object)Creates a new namespace code construct and inserts the code in the correct location.
Public methodAddStruct(String, Object, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public methodAddStruct(String, Object, Object, Object, vsCMAccess)Creates a new structure code construct and inserts the code in the correct location.
Public methodAddTypedefAdds a typedef statement to the object.
Public methodAddUnionAdds a union statement to the object.
Public methodAddUsingAdds a #using element to the VCFileCodeModel object.
Public methodAddVariable(String, Object, Object, vsCMAccess) (Inherited from FileCodeModel2.)
Public methodAddVariable(String, Object, Object, vsCMAccess)Creates a new variable code construct and inserts the code in the correct location.
Public methodBeginBatch() (Inherited from FileCodeModel2.)
Public methodBeginBatch()Not currently implemented.
Public methodCodeElementFromFullNameGets a collection of the specified code elements for the object.
Public methodCodeElementFromPoint(TextPoint, vsCMElement) (Inherited from FileCodeModel2.)
Public methodCodeElementFromPoint(TextPoint, vsCMElement)Gets a code element at a specific location in a source file.
Public methodCommitTransactionCommits the current transaction for the object.
Public methodElementFromID(String) (Inherited from FileCodeModel2.)
Public methodElementFromID(String)Not currently implemented.
Public methodEndBatch() (Inherited from FileCodeModel2.)
Public methodEndBatch()Not currently implemented.
Public methodRemove(Object) (Inherited from FileCodeModel2.)
Public methodRemove(Object)Removes the specified project from the solution.
Public methodRemoveExRemoves the specified project from the solution with an option to delete.
Public methodStartTransactionBegins a transaction.
Public methodSynchronize() (Inherited from FileCodeModel2.)
Public methodSynchronize()Synchronizes all code model objects in the solution with edits made to source files.
Public methodValidateMemberValidates that the proposed name is a valid C++ name for the kind given in the context of the parent object.
Top

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

NoteNote

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.

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
Show: