共用方式為


tag_name

Apply this attribute to a method in a request handler to expose it as a replacement method associated with a tag name.

[ tag_name(
      name,
   parse_func
) ]

Parameters

  • name
    A string specifying the tag name for the replacement handler that will invoke this method.

  • parse_func (optional)
    Specifies the name of the function used to parse arguments passed to the method.

Remarks

This attribute is used to classify a method as a replacement method. A method may have multiple tag_name attributes.

If parse_func is specified, the parse function should have the following signature:

HTTP_CODE parse_func(IAtlMemMgr* pMemoryManager, LPCSTR szArg, Type** ppArg);

The replacement method should have a corresponding signature:

HTTP_CODE methodFunc(Type* pArg);

If parse_func is omitted, the method should have a signature in one of the following forms:

HTTP_CODE MethodName();
HTTP_CODE MethodName(Type* pArg);

Where Type can be one of the types listed:

Type

Parsing algorithm

bool

DefaultParseBool

char

DefaultParseString

unsigned char

DefaultParseUChar

short

DefaultParseShort

unsigned short

DefaultParseUShort

int

DefaultParseInt

unsigned int

DefaultParseUInt

__int64

DefaultParseInt64

unsigned __int64

DefaultParseUInt64

double

DefaultParseDouble

float

DefaultParseFloat

Use of this attribute corresponds to the REPLACEMENT_METHOD_ENTRY macro when the method does not have a parameter, and it corresponds to REPLACEMENT_METHOD_ENTRY_EX when the method does have a parameter.

Requirements

Attribute Context

Applies to

Method

Repeatable

Yes

Required attributes

None

Invalid attributes

None

For more information about the attribute contexts, see Attribute Contexts.

Attribute Requirements

Header

atlstencil.h

Project

EXE, DLL

Compiler

/D "_ATL_ATTRIBUTES"

For more information about the meaning of the requirements, see Attribute Requirements.

See Also

Concepts

COM Attributes

Method Attributes

ATL Samples