RequiresProvidesDirectiveProcessor 클래스

requires/provides라는 디자인 패턴을 정의하고 구현하는 지시문 프로세서의 추상 기본 클래스입니다.

상속 계층 구조

System.Object
  Microsoft.VisualStudio.TextTemplating.DirectiveProcessor
    Microsoft.VisualStudio.TextTemplating.RequiresProvidesDirectiveProcessor

네임스페이스:  Microsoft.VisualStudio.TextTemplating
어셈블리:  Microsoft.VisualStudio.TextTemplating.10.0(Microsoft.VisualStudio.TextTemplating.10.0.dll)

구문

‘선언
Public MustInherit Class RequiresProvidesDirectiveProcessor _
    Inherits DirectiveProcessor
public abstract class RequiresProvidesDirectiveProcessor : DirectiveProcessor
public ref class RequiresProvidesDirectiveProcessor abstract : public DirectiveProcessor
[<AbstractClass>]
type RequiresProvidesDirectiveProcessor =  
    class
        inherit DirectiveProcessor
    end
public abstract class RequiresProvidesDirectiveProcessor extends DirectiveProcessor

RequiresProvidesDirectiveProcessor 형식에서는 다음과 같은 멤버를 노출합니다.

생성자

  이름 설명
Protected 메서드 RequiresProvidesDirectiveProcessor 파생 클래스에서 재정의되는 경우 RequiresProvidesDirectiveProcessor 클래스의 새 인스턴스를 초기화합니다.

위쪽

속성

  이름 설명
Protected 속성 Errors 지시문을 처리하는 동안 발생한 오류를 가져옵니다. (DirectiveProcessor에서 상속됨)
Protected 속성 FriendlyName 파생 클래스에서 재정의되는 경우 지시문 프로세서의 이름을 가져옵니다.
Protected 속성 Host 이 지시문 프로세서와 연결된 호스트를 가져옵니다.

위쪽

메서드

  이름 설명
Public 메서드 Equals 지정한 Object가 현재 Object와 같은지 여부를 확인합니다. (Object에서 상속됨)
Protected 메서드 Finalize 가비지 수집에서 회수하기 전에 개체에서 리소스를 해제하고 다른 정리 작업을 수행할 수 있게 합니다. (Object에서 상속됨)
Public 메서드 FinishProcessingRun 일련의 지시문 처리를 완료합니다. (DirectiveProcessor.FinishProcessingRun()을(를) 재정의함)
Protected 메서드 GeneratePostInitializationCode 파생 클래스에서 재정의되는 경우 생성된 변환 클래스의 초기화 코드에 코드를 추가합니다.이 코드는 기본 클래스가 초기화된 후에 추가됩니다.
Protected 메서드 GeneratePreInitializationCode 파생 클래스에서 재정의되는 경우 생성된 변환 클래스의 초기화 코드에 코드를 추가합니다.이 코드는 기본 클래스가 초기화되기 전에 추가됩니다.
Protected 메서드 GenerateTransformCode 파생 클래스에서 재정의되는 경우 생성된 변환 클래스에 코드를 추가합니다.
Public 메서드 GetClassCodeForProcessingRun 생성된 변환 클래스에 추가할 코드를 가져옵니다. (DirectiveProcessor.GetClassCodeForProcessingRun()을(를) 재정의함)
Public 메서드 GetHashCode 특정 형식에 대한 해시 함수 역할을 합니다. (Object에서 상속됨)
Public 메서드 GetImportsForProcessingRun 생성된 변환 클래스로 가져올 네임스페이스를 가져옵니다. (DirectiveProcessor.GetImportsForProcessingRun()을(를) 재정의함)
Public 메서드 GetPostInitializationCodeForProcessingRun 가장 최근 처리 실행의 결과로, 생성된 변환 클래스가 초기화될 때 초기화할 코드를 가져옵니다. (DirectiveProcessor.GetPostInitializationCodeForProcessingRun()을(를) 재정의함)
Public 메서드 GetPreInitializationCodeForProcessingRun 가장 최근 처리 실행의 결과로, 생성된 변환 클래스가 초기화될 때 초기화할 코드를 가져옵니다. (DirectiveProcessor.GetPreInitializationCodeForProcessingRun()을(를) 재정의함)
Public 메서드 GetReferencesForProcessingRun 생성된 변환 클래스의 컴파일러에 전달할 참조를 가져옵니다. (DirectiveProcessor.GetReferencesForProcessingRun()을(를) 재정의함)
Public 메서드 GetType 현재 인스턴스의 Type을 가져옵니다. (Object에서 상속됨)
Public 메서드 Initialize 지시문 프로세서의 인스턴스를 초기화합니다. (DirectiveProcessor.Initialize(ITextTemplatingEngineHost)을(를) 재정의함)
Protected 메서드 InitializeProvidesDictionary 파생 클래스에서 재정의되는 경우 각 지시문의 provides 매개 변수를 지정합니다.
Protected 메서드 InitializeRequiresDictionary 파생 클래스에서 재정의되는 경우 각 지시문의 requires 매개 변수를 지정합니다.
Public 메서드 IsDirectiveSupported 파생 클래스에서 재정의된 경우 지시문 프로세서가 지정된 지시문을 지원하는지 여부를 결정합니다. (DirectiveProcessor에서 상속됨)
Protected 메서드 MemberwiseClone 현재 Object의 단순 복사본을 만듭니다. (Object에서 상속됨)
Protected 메서드 PostProcessArguments 파생 클래스에서 재정의되는 경우 파생 클래스가 제공하고 필요로 하는 매개 변수를 해당 클래스에서 수정할 수 있도록 합니다.
Public 메서드 ProcessDirective 텍스트 템플릿 파일의 단일 지시문을 처리합니다. (DirectiveProcessor.ProcessDirective(String, IDictionary<String, String>)을(를) 재정의함)
Protected 메서드 ProvideUniqueId 지시문 프로세서에 대한 호출을 식별하는 ID를 제공합니다.
Public 메서드 StartProcessingRun 지시문 프로세서를 시작합니다. (DirectiveProcessor.StartProcessingRun(CodeDomProvider, String, CompilerErrorCollection)을(를) 재정의함)
Public 메서드 ToString 현재 개체를 나타내는 문자열을 반환합니다. (Object에서 상속됨)

위쪽

설명

사용자 지정 지시문 프로세서를 만들려면 DirectiveProcessor 또는 RequiresProvidesDirectiveProcessor에서 상속하는 클래스를 만듭니다.

DirectiveProcessor는 사용자로부터 매개 변수를 캡처하는 데 필요한 인터페이스를 구현하며 생성된 변환 클래스를 위한 기능을 제공합니다. RequiresProvidesDirectiveProcessor RequiresProvidesDirectiveProcessor는 디자인 패턴을 구현하고, 지시문 프로세서를 요구/제공합니다. RequiresProvidesDirectiveProcessor는 사용자로부터 매개 변수를 캡처하는 추가 기능을 제공하며 특정 속성 이름을 사용하여 생성된 변환 클래스에 대한 기능을 제공합니다.

자세한 내용은 사용자 지정 텍스트 템플릿 지시문 프로세서 만들기을 참조하십시오.

변환 엔진은 모든 필수 RequiresProvidesDirectiveProcessor 클래스에 대한 singleton을 보관합니다.

RequiresProvidesDirectiveProcessor는 상태 시스템을 구현합니다.

예를 들어, 텍스트 템플릿에 동일한 지시문 프로세서에 대한 세 지시문 호출이 있으면 엔진은 다음 순서로 다음 메서드를 호출합니다.

예제

다음 예제에서는 RequiresProvidesDirectiveProcessor를 사용하는 방법을 보여 줍니다.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualStudio.TextTemplating;
using System.Xml;
using System.IO;
using System.Globalization;

namespace Microsoft.Samples.VisualStudio.TextTemplating.DirectiveProcessors
{
public class DomDirectiveProcessor : RequiresProvidesDirectiveProcessor
{

// Name of the tag that this directive processor supports.
private const string DomDirectiveTag = "dom";

//Name of the parameter that must be provided for this directive processor to load an XML file
private const string XmlFileRequiredParameterName = "XmlFile";

// Default name of the property that this provider adds to the generated transform class.
private const string DomProvidedParameterName = "Dom";

// Set up the dictionary of items that this directive processor will provide.
protected override void InitializeProvidesDictionary(string directiveName, IDictionary<string, string> providesDictionary)
{
if (StringComparer.InvariantCultureIgnoreCase.Compare(directiveName, DomDirectiveTag) == 0)
{
// Populate the dictionary with defualt names.
providesDictionary[DomProvidedParameterName] = DomProvidedParameterName;
}
}

// Set up the dictionary of items that this directive processor requires to complete.
protected override void InitializeRequiresDictionary(string directiveName, IDictionary<string, string> requiresDictionary)
{
if (StringComparer.InvariantCultureIgnoreCase.Compare(directiveName, DomDirectiveTag) == 0)
{
// Initialize the dictionary with nulls for each required parameter.
requiresDictionary[XmlFileRequiredParameterName] = null;
}
}
}
}

스레드로부터의 안전성

이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.

참고 항목

참조

Microsoft.VisualStudio.TextTemplating 네임스페이스

DirectiveProcessor

기타 리소스

사용자 지정 텍스트 템플릿 지시문 프로세서 만들기