VCCodeModel 介面

定義

物件,提供任何包含程式碼專案的專案層級存取權。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
屬性
實作

範例

此函式會傳回 VCCodeModel 代表方案中第一個專案的物件。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  

備註

VCCodeModel物件會提供程式碼模型功能給 Visual Studio 支援的各種語言 (包括專案層級的 Visual c + +) 。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.

注意

此物件的大部分功能都是由 Visual Studio CodeModel2 物件提供。A large part of the functionality of this object is provided by the Visual Studio CodeModel2 object.

使用 VCCodeModel managed 專案中的物件時,請將 Microsoft.VisualStudio.VCCodeModel.dll 納入為參考。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.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.

請參閱 如何:編譯 Visual c + + 程式碼模型 擴充性的範例程式碼,以取得如何編譯和執行此範例的相關資訊。See How to: Compile Example Code for Visual C++ Code Model Extensibility for information about how to compile and run this sample.

屬性

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

從父物件的 .idl 檔取得 Import 語句的集合。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

取得父物件的 #import 語句集合。Gets the collection of #import statements for the parent object.

Includes

取得物件的 #include 語句集合。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

判斷 VCCodeModel 是否與解決方案的原始程式碼同步。Determines whether VCCodeModel is in sync with the source code for the solution.

Language

取得用以撰寫程式碼的程式設計語言。Gets the programming language used to author the code.

Macros

取得宏的集合, (物件) 的 #define 語句。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

取得物件的 Typedef 元素集合。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

取得物件的 #using 元素集合。Gets the collection of #using elements for the object.

Variables

取得物件的變數集合。Gets the collection of variables for the object.

方法

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)

將新的 import 語句加入至特定的 .idl 檔案。Adds a new import statement to a specific .idl file.

AddIDLLibrary(String, Object, Object)

將新的連結 語句加入至特定的 .idl 檔案。Adds a new library statement to a specific .idl file.

AddImport(String, Object, Object, String)

#import 元素加入至特定檔案。Adds a #import element to a specific file.

AddInclude(String, Object, Object)

#include 專案加入至特定檔案。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)

#define 專案加入至特定檔案。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)

typedef 元素加入至特定檔案。Adds a typedef element to a specific file.

AddUnion(String, Object, Object, vsCMAccess)

union 元素加入至 VCCodeModel 物件。Adds a union element to the VCCodeModel object.

AddUsing(String, Object, Object)

#using 專案加入至特定檔案。Adds a #using element to a specific file.

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

新增 using 別名。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. 它與相同 CodeElementFromFullName(String) ,不同之處在于它會在查閱期間忽略命名空間。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. 它與 CodeTypeFromFullName(String) 會嘗試解析的不同 typedefIt is identical to CodeTypeFromFullName(String) except that it will attempt typedef resolution.

CommitTransaction()

認可物件的目前交易。Commits the current transaction for the object.

CreateCodeTypeRef(Object)

CodeTypeRef 傳遞的資料類型指標為基礎的物件。A CodeTypeRef object based on the data type indicator passed.

DotNetNameFromLanguageSpecific(String)

將命名空間轉譯為 .NET 表單。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()

確保專案檔上的 FileCodeModel 屬性不是 null。Ensures that the FileCodeModel property on a project file is not null.

ValidateMember(String, vsCMElement, String)

驗證提議的名稱是否為父物件內容中所指定之類型的有效 C++ 名稱。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.

適用於