Overriding an Existing Method

SOM_Scope BOOL SOMLINK pwfolder_wpSetTitle(PWFolder *somSelf,
                                           PSZ pszNewTitle)
{
    CHAR szBuf[100];                            /* Character buffer      */

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

    strcpy(szBuf,pszNewTitle);                  /* Get current title     */

    if ((strcmp(_szCurrentPassword,             /* If folder is locked   */
                _szPassword)) != 0)
        if((strstr(szBuf,"LOCKED")) == NULL )   /* and <LOCKED> not in   */
                                                /* current title         */
          strcat(szBuf," <LOCKED>");            /* Add <LOCKED> to title */

    return(parent_wpSetTitle(somSelf,           /* Allow default proc to */
                              szBuf));          /* occur                 */
}

This example shows the _wpSetTitle method being overridden to add the word "LOCKED" to the end of the title of a locked password-protected folder.


[Back: Invoking a Method]
[Next: Adding a New Method]