Share via


VCCodeModel Interface

Definition

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

public interface class VCCodeModel : EnvDTE80::CodeModel2
public interface class VCCodeModel : EnvDTE80::CodeModel2
__interface VCCodeModel : EnvDTE80::CodeModel2
[System.Runtime.InteropServices.Guid("A590E96B-CC8C-48AF-9E8F-7C3FE7865586")]
[System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FDispatchable | System.Runtime.InteropServices.TypeLibTypeFlags.FDual)]
public interface VCCodeModel : EnvDTE80.CodeModel2
[<System.Runtime.InteropServices.Guid("A590E96B-CC8C-48AF-9E8F-7C3FE7865586")>]
[<System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FDispatchable | System.Runtime.InteropServices.TypeLibTypeFlags.FDual)>]
type VCCodeModel = interface
    interface CodeModel2
Public Interface VCCodeModel
Implements CodeModel2
Attributes
Implements

Examples

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  

Remarks

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.

Note

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 NIB How to: Add or Remove References By Using the Add Reference Dialog Box.

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

Properties

Attributes

Gets a collection of all of the attributes for the object.

Classes

Gets a collection of classes for the object.

CodeElements

Gets a collection of code elements.

Delegates

Gets a collection of delegates for the object.

DialogClasses[String]

Gets a collection of dialog classes.

DTE

Gets the top-level extensibility object.

Enums

Gets a collection of enumerations for the object.

Functions

Gets a collection of functions for the object.

IDLImports

Gets the collection of Import statements from the .idl file of the parent object.

IDLLibraries

Gets the collection of Library elements on the object.

Imports

Gets the collection of #import statements for the parent object.

Includes

Gets the collection of #include statements for the object.

Interfaces

Gets the collection of interfaces for the object.

IsCaseSensitive

Gets a value indicating whether a code element is case-sensitive.

IsSynchronized

Determines whether VCCodeModel is in sync with the source code for the solution.

Language

Gets the programming language used to author the code.

Macros

Gets the collection of macros (#define statements) for the object.

Maps

Gets the collection of maps for the object.

Namespaces

Gets the collection of namespaces for the object.

Parent

Gets the immediate parent object of a given object.

Structs

Gets the collection of structure elements for the object.

Typedefs

Gets the collection of Typedef elements for the object.

Unions

Gets the collection of Union elements for the object.

UsingAliases

Gets the collection of alias elements for the object.

Usings

Gets the collection of #using elements for the object.

Variables

Gets the collection of variables for the object.

Methods

AbortTransaction()

Cancels the current transaction.

AddAttribute(String, Object, String, Object)

Creates a new attribute code construct and inserts the code in the correct location.

AddClass(String, Object, Object, Object, Object, vsCMAccess)

Creates a new class code construct and inserts the code in the correct location.

AddDelegate(String, Object, Object, Object, vsCMAccess)

Creates a new delegate code construct and inserts the code in the correct location.

AddEnum(String, Object, Object, Object, vsCMAccess)

Creates a new enumeration code construct and inserts the code in the correct location.

AddFunction(String, Object, vsCMFunction, Object, Object, vsCMAccess)

Creates a new function code construct and inserts the code in the correct location.

AddIDLImport(String, Object, Object)

Adds a new import statement to a specific .idl file.

AddIDLLibrary(String, Object, Object)

Adds a new library statement to a specific .idl file.

AddImport(String, Object, Object, String)

Adds a #import element to a specific file.

AddInclude(String, Object, Object)

Adds a #include element to a specific file.

AddInterface(String, Object, Object, Object, vsCMAccess)

Creates a new interface code construct and inserts the code in the correct location.

AddMacro(String, Object, String, Object)

Adds a #define element to a specific file.

AddMap(String, Object, String, Object)

Adds a map entry to the object.

AddNamespace(String, Object, Object)

Creates a new namespace code construct and inserts the code in the correct location.

AddStruct(String, Object, Object, Object, Object, vsCMAccess)

Creates a new structure code construct and inserts the code in the correct location.

AddTypedef(String, Object, Object, Object, vsCMAccess)

Adds a typedef element to a specific file.

AddUnion(String, Object, Object, vsCMAccess)

Adds a union element to the VCCodeModel object.

AddUsing(String, Object, Object)

Adds a #using element to a specific file.

AddUsingAlias(String, Object, Object, Object, vsCMAccess)

Adds a using alias.

AddVariable(String, Object, Object, Object, vsCMAccess)

Creates a new variable code construct and inserts the code in the correct location.

CodeElementFromFullName(String)

Gets a collection of the specified code elements for the object.

CodeElementFromFullName2(String)

Gets a collection of the specified code elements for the object. It is identical to CodeElementFromFullName(String), except that it ignores namespaces during lookup.

CodeTypeFromFullName(String)

Returns a code element based on a fully qualified name.

CodeTypeFromFullName2(String)

Returns a code element based on a fully qualified name. It is identical to CodeTypeFromFullName(String) except that it will attempt typedef resolution.

CommitTransaction()

Commits the current transaction for the object.

CreateCodeTypeRef(Object)

A CodeTypeRef object based on the data type indicator passed.

DotNetNameFromLanguageSpecific(String)

Translates the namespace to a .NET form.

ElementFromID(String)

Not implemented.

GetClassesDerivedFrom(String)

Returns the classes derived from the specified class.

IsValidID(String)

Returns whether a specified name is a valid programmatic identifier for the current language.

LanguageSpecificNameFromDotNet(String)

Translates from the fully qualified name to an unmanaged namespace form.

Remove(Object)

Removes the specified project from the solution.

RemoveEx(Object, Int32)

Removes the specified project from the solution.

StartTransaction(String)

Begins a transaction.

Synchronize()

Synchronizes all code model objects in the solution with edits made to source files.

SynchronizeCancellable(String, String)

Displays a dialog box that has a progress bar. The user can cancel waiting and unblock the thread.

SynchronizeFiles()

Ensures that the FileCodeModel property on a project file is not null.

ValidateMember(String, vsCMElement, String)

Validates that the proposed name is a valid C++ name for the kind given in the context of the parent object.

ValidateMemberName(String, vsCMElement, vcCMNameValidationOption)

Validates the name of an element.

Applies to