VCCodeModel Interface

VCCodeModel Interface

An object providing project-level access to any contained code element.

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

[GuidAttribute("2FCA4A98-5A65-4895-9FEF-1854182CEDC8")]
public interface VCCodeModel : CodeModel2

The VCCodeModel 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 CodeModel2.)
Public propertyCodeElementsGets a collection of code elements.
Public propertyDelegatesGets a collection of delegates for the object.
Public propertyDialogClassesGets a collection of dialog classes.
Public propertyDTE (Inherited from CodeModel2.)
Public propertyDTEGets the top-level extensibility object.
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 parent object.
Public propertyIDLLibrariesGets the collection of Library elements on the object.
Public propertyImportsGets the collection of #import statements for the parent object.
Public propertyIncludesGets the collection of #include statements for the object.
Public propertyInterfacesGets the collection of interfaces for the object.
Public propertyIsCaseSensitive (Inherited from CodeModel2.)
Public propertyIsCaseSensitiveGets a value indicating whether a code element is case-sensitive.
Public propertyIsSynchronizedDetermines whether VCCodeModel is in sync with the source code for the solution.
Public propertyLanguage (Inherited from CodeModel2.)
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 CodeModel2.)
Public propertyParentGets the immediate parent object of a given object.
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 methodAbortTransactionCancels the current transaction.
Public methodAddAttribute(String, Object, String, Object) (Inherited from CodeModel2.)
Public methodAddAttribute(String, Object, String, Object)Creates a new attribute code construct and inserts the code in the correct location.
Public methodAddClass(String, Object, Object, Object, Object, vsCMAccess) (Inherited from CodeModel2.)
Public methodAddClass(String, Object, Object, Object, Object, vsCMAccess)Creates a new class code construct and inserts the code in the correct location.
Public methodAddDelegate(String, Object, Object, Object, vsCMAccess) (Inherited from CodeModel2.)
Public methodAddDelegate(String, Object, Object, Object, vsCMAccess)Creates a new delegate code construct and inserts the code in the correct location.
Public methodAddEnum(String, Object, Object, Object, vsCMAccess) (Inherited from CodeModel2.)
Public methodAddEnum(String, Object, Object, Object, vsCMAccess)Creates a new enumeration code construct and inserts the code in the correct location.
Public methodAddFunction(String, Object, vsCMFunction, Object, Object, vsCMAccess) (Inherited from CodeModel2.)
Public methodAddFunction(String, Object, 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 a specific .idl file.
Public methodAddIDLLibraryAdds a new library statement to a specific .idl file.
Public methodAddImportAdds a #import element to a specific file.
Public methodAddIncludeAdds a #include element to a specific file.
Public methodAddInterface(String, Object, Object, Object, vsCMAccess) (Inherited from CodeModel2.)
Public methodAddInterface(String, Object, Object, Object, vsCMAccess)Creates a new interface code construct and inserts the code in the correct location.
Public methodAddMacroAdds a #define element to a specific file.
Public methodAddMapAdds a map entry to the object.
Public methodAddNamespace(String, Object, Object) (Inherited from CodeModel2.)
Public methodAddNamespace(String, Object, Object)Creates a new namespace code construct and inserts the code in the correct location.
Public methodAddStruct(String, Object, Object, Object, Object, vsCMAccess) (Inherited from CodeModel2.)
Public methodAddStruct(String, Object, Object, Object, Object, vsCMAccess)Creates a new structure code construct and inserts the code in the correct location.
Public methodAddTypedefAdds a typedef element to a specific file.
Public methodAddUnionAdds a union element to the VCCodeModel object.
Public methodAddUsingAdds a #using element to a specific file.
Public methodAddVariable(String, Object, Object, Object, vsCMAccess) (Inherited from CodeModel2.)
Public methodAddVariable(String, Object, Object, Object, vsCMAccess)Creates a new variable code construct and inserts the code in the correct location.
Public methodCodeElementFromFullNameGets a collection of the specified code elements for the object.
Public methodCodeElementFromFullName2Gets a collection of the specified code elements for the object. It is identical to CodeElementFromFullName, except that it ignores namespaces during lookup.
Public methodCodeTypeFromFullName(String) (Inherited from CodeModel2.)
Public methodCodeTypeFromFullName(String)Returns a code element based on a fully qualified name.
Public methodCodeTypeFromFullName2Returns a code element based on a fully qualified name. It is identical to CodeTypeFromFullName except that it will attempt typedef resolution.
Public methodCommitTransactionCommits the current transaction for the object.
Public methodCreateCodeTypeRef(Object) (Inherited from CodeModel2.)
Public methodCreateCodeTypeRef(Object)A CodeTypeRef object based on the data type indicator passed.
Public methodDotNetNameFromLanguageSpecific(String) (Inherited from CodeModel2.)
Public methodDotNetNameFromLanguageSpecific(String)Translates the namespace to a .NET form.
Public methodElementFromID(String) (Inherited from CodeModel2.)
Public methodElementFromID(String)Not implemented.
Public methodIsValidID(String) (Inherited from CodeModel2.)
Public methodIsValidID(String)Returns whether a specified name is a valid programmatic identifier for the current language.
Public methodLanguageSpecificNameFromDotNet(String) (Inherited from CodeModel2.)
Public methodLanguageSpecificNameFromDotNet(String)Translates from the fully qualified name to an unmanaged namespace form.
Public methodRemove(Object) (Inherited from CodeModel2.)
Public methodRemove(Object)Removes the specified project from the solution.
Public methodRemoveExRemoves the specified project from the solution.
Public methodStartTransactionBegins a transaction.
Public methodSynchronize() (Inherited from CodeModel2.)
Public methodSynchronize()Synchronizes all code model objects in the solution with edits made to source files.
Public methodSynchronizeCancellableDisplays a dialog box that has a progress bar. The user can cancel waiting and unblock the thread.
Public methodSynchronizeFilesEnsures that the FileCodeModel property on a project file is not null.
Public methodValidateMemberValidates that the proposed name is a valid C++ name for the kind given in the context of the parent object.
Top

The VCCodeModel object provides code model functionality to various languages supported by Visual Studio (including Visual C++) at the project level.

Primarily, this object is used to find any code element accessible within a project (given a fully-qualified name). In addition, the object specifies the programming language in which the project is written.

NoteNote

A large part of the functionality of this object is provided by the Visual Studio CodeModel2 object.

When using a VCCodeModel object within a managed project, include Microsoft.VisualStudio.VCCodeModel.dll as a reference. For more information about adding references to a managed project, see How to: Add or Remove References in Visual Studio.

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

This function returns the VCCodeModel object representing the first project in a solution.

Function GetVCCodeModel() As VCCodeModel
    GetVCCodeModel = Nothing
    Dim codeModel As CodeModel
    Dim vcCodeModel As VCCodeModel
    Dim solution As Solution
    solution = DTE.Solution
    If (solution Is Nothing) Then
        MsgBox("A Solution is not open")
        Exit Function
    Else
        If (DTE.Solution.Count <> 0) Then
            codeModel = DTE.Solution.Item(1).CodeModel
            vcCodeModel = CType(codeModel, VCCodeModel)
            If (vcCodeModel Is Nothing) Then
                MsgBox("The first project is not a VC++ project.")
                Exit Function
            Else
                GetVCCodeModel = vcCodeModel
            End If
        End If
    End If
End Function

Community Additions

ADD
Show:
© 2016 Microsoft