User Guide
Chapter 18: Building Custom CFAPI Tags 303
You are not responsible for freeing the memory allocated for the returned string set (it
will be freed automatically by ColdFusion after the request is completed).
Example
The following example retrieves the list of attributes and then iterates over the list,
writing each attribute and its value back to the user.
LPCSTR lpszName, lpszValue ;
CCFXStringSet* pAttribs = pRequest->GetAttributeList() ;
int nNumAttribs = pAttribs->GetCount() ;
for( int i=1; i<=nNumAttribs; i++ )
{
lpszName = pAttribs->GetString( i ) ;
lpszValue = pRequest->GetAttribute( lpszName ) ;
pRequest->Write( lpszName ) ;
pRequest->Write( " = " ) ;
pRequest->Write( lpszValue ) ;
pRequest->Write( "<BR>" ) ;
}
CCFXRequest::GetCustomData
LPVOID CCFXRequest::GetCustomData(void)
Gets the custom (tag specific) data for the request. This member is typically used from
within subroutines of your tag implementation to extract tag specific data from within
the request.
Returns a pointer to the custom data or returns
NULL if no custom data has been set
during this request using CCFXRequest::SetCustomData.
Example
The following example retrieves a pointer to a request specific data structure of
hypothetical type MYTAGDATA:
void DoSomeGruntWork( CCFXRequest* pRequest )
{
MYTAGDATA* pTagData =
(MYTAGDATA*)pRequest->GetCustomData() ;
... remainder of procedure ...
}
CCFXRequest::GetQuery
CCFXQuery* CCFXRequest::GetQuery(void)
Retrieves the query that was passed to the tag. To pass a query to a custom tag, you use
the
QUERY attribute. This attribute should be set to the name of an existing query