gtpc2mhgC/C++ Language Support User's Guide

TO2_getMethodDocumentation-Copy Documentation for a Method

This function causes TPF collection support (TPFCS) to locate the specific method definition in storage and return the embedded method documentation in a temporary sequence collection. If there is no method documentation, the returned sequence collection will be empty.

Format

#include <c$to2.h>
long TO2_getMethodDocumentation (      TO2_PID_PTR pid_ptr,
                                       TO2_ENV_PTR env_ptr,
                                 const long       *class_namelength,
                                 const char        class_name[TO2_MAX_CLASS_NAME],
                                 const long       *method_namelength,
                                 const char        method_name[TO2_MAX_METHOD_NAME]);

pid_ptr
The pointer to a field where the temporary persistent identifier (PID) assigned to the sequence collection will be returned.

env_ptr
The pointer to the environment as returned by the TO2_createEnv function.

class_namelength
A pointer to a field that contains the length of the class name.

class_name
A pointer to a field that contains the class name.

method_namelength
A pointer to a field that contains the length of the method name.

method_name
A pointer to a field that contains the method name.

Normal Return

The normal return is a positive value. The returned sequence collection will be empty if no method documentation existed for the method.

Error Return

An error return is indicated by a zero. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.

The following error codes are common for this function:

TO2_ERROR_CLASS_NOTFOUND

TO2_ERROR_ENV

TO2_ERROR_METHOD_NOTFOUND

TO2_ERROR_NOT_INIT

Programming Considerations

The elements in the return collection will be of the following structure:

   struct TO2_method_doc_line
{
       char    text[80];          /* documentation text */
};
 

Examples

The following example copies the method documentation for class OBJECT method new.

#include <c$to2.h>                     /* Needed for TO2 API Functions    */
#include <stdio.h>                     /* APIs for standard I/O functions */
 
TO2_ENV_PTR      env_ptr;              /* Pointer to TO2 environment      */
TO2_PID          collectionPID;        /* return area for PID             */
 
char             class_name[]="OBJECT"; /* class name                     */
long             class_namelength=(sizeof "OBJECT")-1; /* length of       */
                                       /*  class name                     */
char             method_name[]="new";   /* method name                    */
long             method_namelength=(sizeof "new")-1;   /* length of       */
                                       /* method name                     */
TO2_ERR_CODE     to2_rc=1;             /* return code receiver            */
TO2_ERR_TEXT_PTR err_textPtr;          /* TO2 error code text pointer     */

  ·
  ·
  ·
{ if ((to2_rc = TO2_getMethodDocumentation(&collectionPID, env_ptr, &class_namelength, class_name, &method_namelength, method_name)) == TO2_ERROR) { to2_rc = TO2_getErrorCode(env_ptr); err_textPtr = TO2_getErrorText(env_ptr, to2_rc); printf ("TO2_getMethodDocumentation failed, error code - %d\n ", to2 _rc); printf ("TO2 Error Text is %s\n ", err_textPtr); } else printf("TO2_getMethodDocumentation successful\n"); }

Related Information

TO2_getClassDocumentation-Copy Documentation for a Class.