__objDelMethod()

Template

Function

Name

__objDelMethod()

Category

API

Subcategory

Objects

Oneliner

Delete a METHOD from class

Syntax

      __objDelMethod( <oObject>,  <cSymbol> ) --> oObject

Arguments

<oObject> is the object to work on.

<cSymbol> is the symbol name of METHOD or INLINE method to be deleted (removed) from the object.

Returns

__objDelMethod() return a reference to <oObject>.

Description

__objDelMethod() is a low level class support function that deletes (removes) a METHOD or an INLINE method from an object. <oObject> is unchanged if a symbol with the name <cSymbol> does not exist in
<oObject>.

__objDelInline() is exactly the same as __objDelMethod().

Examples

      // create a new THappy class and add a Smile method
      oHappy := HBClass():New( "THappy" )
      __objAddMethod( oHappy,  "Smile",  @MySmile() )
      ? __objHasMethod( oHappy,  "Smile" )    // .T.
      // remove Smile method
      __objDelMethod( oHappy,  "Smile" )
      ? __objHasMethod( oHappy,  "Smile" )    // .F.

      STATIC FUNCTION MySmile( nType )
         LOCAL cSmile
         DO CASE
         CASE nType == 1
            cSmile := ":)"
         CASE nType == 2
            cSmile := ";)"
         ENDCASE
         RETURN cSmile

Compliance

Harbour

Files

Library is core

Seealso

__objAddInline(), __objAddMethod(), __objGetMethodList(), __objGetMsgList(), __objHasMethod(), __objModInline(), __objModMethod()

__objDelInline()

Template

Function

Name

__objDelInline()

Category

API

Subcategory

Objects

Oneliner

Delete a METHOD INLINE from class

Syntax

      __objDelInline( <oObject>,  <cSymbol> ) --> oObject

Arguments

<oObject> is the object to work on.

<cSymbol> is the symbol name of METHOD or INLINE method to be deleted (removed) from the object.

Returns

__objDelInMethod() return a reference to <oObject>.

Description

__objDelInMethod() is a low level class support function that delete (remove) a METHOD or an INLINE method from an object. <oObject> is unchanged if a symbol with the name <cSymbol> does not exist in <oObject>.

Examples

      // create a new THappy class and add a Smile method
      oHappy := HBClass():New( "THappy" )
      __objAddMethod( oHappy,  "Smile",  @MySmile() )
      ? __objHasMethod( oHappy,  "Smile" )    // .T.
      // remove Smile method
      __objDelInMethod( oHappy,  "Smile" )
      ? __objHasMethod( oHappy,  "Smile" )    // .F.

      STATIC FUNCTION MySmile( nType )
         LOCAL cSmile
         DO CASE
         CASE nType == 1
            cSmile := ":)"
         CASE nType == 2
            cSmile := ";)"
         ENDCASE
         RETURN cSmile

Compliance

Harbour

Files

Library is core

Seealso

__objAddInline(), __objAddMethod(), __objGetMethodList(), __objGetMsgList(), __objHasMethod(), __objModInline(), __objModMethod()

__objAddInline()

Template

Function

Name

__objAddInline()

Category

API

Subcategory

Objects

Oneliner

Add an INLINE to an already existing class

Syntax

      __objAddInline( <oObject>,  <cInlineName>,  <bInline> ) --> oObject

Arguments

<oObject> is the object to work on.

<cInlineName> is the symbol name of the new INLINE to add.

<bInline> is a code block to associate with the INLINE method.

Returns

__objAddInline() return a reference to <oObject>.

Description

__objAddInline() is a low level class support function that add a new INLINE method to an object. <oObject> is unchanged if a symbol with the name <cInlineName> already exist in <oObject>.

Examples

      // create a new THappy class and add a Smile INLINE method
      oHappy  := HBClass():New( "THappy" )
      bInline := {| nType | { ":)",  ";)",  "*SMILE*" }[ nType ] }
      __objAddInline( oHappy,  "Smile",  bInline )
      ? oHappy:Smile( 1 )       // :)
      ? oHappy:Smile( 2 )       // ;)
      ? oHappy:Smile( 3 )       // *SMILE*

Compliance

Harbour

Files

Library is core

Seealso

__objAddData(), __objAddMethod(), __objDelInline(), __objGetMethodList(), __objGetMsgList(), __objHasMethod() , __objModInline()