Object Setup

SOM_Scope BOOL SOMLINK pwfolder_wpSetup(PWFolder *somSelf,
                                        PSZ pszSetupString)
{
    CHAR  pszInitPword[20];                     /* Buffer for password   */
    BOOL  bFound;                               /* Success flag          */
    ULONG ulRetLength;

    PWFolderData *somThis =                     /* Get instance data     */
                 PWFolderGetData(somSelf);
    PWFolderMethodDebug("PWFolder",             /* Set debug info        */
                        "pwfolder_wpSetup");

    if (pszSetupString != NULL)                 /* If string is present  */
       {
       bFound=_wpScanSetupString(somSelf,        /* Scan setup string to */
                                 pszSetupString, /* find keyword         */
                                 "PASSWORD"
                                 pszInitPword,
                                 &RetLength);

       if (bFound)                              /* If parameter present  */
          {
          strcpy(_szPassword,                   /* Copy p'word to folder */
                 pszInitPword);                 /* p'word and current    */
          strcpy(_szCurrentPassword,            /* p'word - initialize   */
                 pszInitPword);                 /* in unlocked state     */
          }
       }
    return (parent_wpSetup(somSelf,             /* Allow default proc to */
                           pszSetupString));    /* occur                 */
}

This example shows an overridden _wpSetup method which parses the setup string to extract class-specific parameters.


[Back: Creating an Object]
[Next: Initializing Instance Data]