Harbour All Functions – H

HardCR

HBClass()

HB_ANSITOOEM()

hb_At

hb_cdpSelect

HB_ColorIndex

HB_DiskSpace

HB_EOL

HB_FEof

hb_FLock

hb_FUnlock

hb_gcAll
hb_gcAlloc
hb_gcCollectAll
hb_gcFree
hb_gcItemRef

hb_GetEnv

hb_HAllocate

hb_Hash
hb_HAutoAdd
hb_HBinary
hb_HCaseMatch
hb_HClone
hb_HCopy
hb_HDefault
hb_HDel
hb_HDelAt
hb_HEval
hb_HFill
hb_HGet
hb_HGetDef
hb_HHasKey
hb_HKeyAt
hb_HKeys
hb_HMerge
hb_HPairAt
hb_HPos
hb_HScan
hb_HSet

hb_HSetAutoAdd()
hb_HSetBinary() 
hb_HSetCaseMatch()

hb_HSort
hb_HValueAt
hb_HValues

hb_idleAdd
hb_idleDel
hb_idleState

hb_inetAddress
hb_inetCleanup
hb_inetClearError
hb_inetClearPeriodCallback
hb_inetClearTimeLimit
hb_inetClearTimeout
hb_inetClose
hb_inetConnect
hb_inetConnectIP
hb_inetCount
hb_inetCreate
hb_inetCRLF
hb_inetDataReady
hb_inetDGram
hb_inetDGramBind
hb_inetDGramRecv
hb_inetDGramSend
hb_inetErrorCode
hb_inetErrorDesc
hb_inetFD
hb_inetGetAlias
hb_inetGetHosts
hb_inetGetRcvBufSize
hb_inetGetSndBufSize
hb_inetInit
hb_inetIsSocket
hb_inetPeriodCallback
hb_inetPort
hb_inetRecv
hb_inetRecvAll
hb_inetRecvEndblock
hb_inetRecvLine
hb_inetSend
hb_inetSendAll
hb_inetServer
hb_inetSetRcvBufSize
hb_inetSetSndBufSize
hb_inetstatus
hb_inetTimeLimit
hb_inetTimeout

HB_IsByRef()

hb_keyPut

hb_langErrMsg
hb_langMessage
hb_langName
hb_langSelect

hb_mathErBlock
hb_mathErMode
hb_mathGetErrMode
hb_mathGetHandler
hb_mathGetLastError
hb_mathIsMathErr
hb_mathResetError
hb_mathSetErrMode
hb_mathSetHandler

hb_MemoRead
hb_MemoWrit

hb_RAt

hb_PIsByRef

hb_PValue

hb_SetKeyCheck
hb_SetKeyGet
hb_SetKeySave

hb_setListenerAdd

hb_setListenerNotify
hb_setListenerRemove

hb_SetMacro

hb_Translate

hb_ValToStr

Header

HexaToDec

METHOD

METHOD

Declare a METHOD for a class in the class header

Syntax

      METHOD <MethodName>( [<params,...>] ) [CONSTRUCTOR]

      METHOD <MethodName>( [<params,...>] ) INLINE <Code,...>

      METHOD <MethodName>( [<params,...>] ) BLOCK  <CodeBlock>

      METHOD <MethodName>( [<params,...>] ) EXTERN <NAME>([<args,...>])

      METHOD <MethodName>( [<params,...>] ) SETGET

      METHOD <MethodName>( [<params,...>] ) VIRTUAL

      METHOD <MethodName>( [<param>] )      OPERATOR <op>

      METHOD <MethodName>( [<params,...>] ) CLASS <ClassName>

Arguments

<MethodName> Name of the method to define

<params, …> Optional parameter list

Description

Methods are “class functions” which do the work of the class. All methods must be defined in the class header between the CLASS and ENDCLASS commands. If the body of a method is not fully defined here, the full body is written below the ENDCLASS command using this syntax:

METHOD <MethodName>( [<params, …>] ) CLASS <ClassName>

Methods can reference the current object with the keyword “Self:” or its shorthand version “::”.

CLAUSES:

CONSTRUCTOR Defines a special method Class Constructor method, used to create objects. This is usually the New() method. Constructors always return the new object.

INLINE Fast and easy to code, INLINE lets you define the code for the method immediately within the definition of the Class. Any methods not declared INLINE or BLOCK must be fully defined after the ENDCLASS command. The <Code, …> following INLINE receives a parameter of Self. If you need to receive more parameters, use the BLOCK clause instead.

BLOCK Use this clause when you want to declare fast ‘inline’ methods that need parameters. The first parameter to <CodeBlock> must be Self, as in:

METHOD <MethodName> BLOCK {| Self, <arg1>, <arg2>, …, <argN> | … }

EXTERN If an external function does what the method needs, use this clause to make an optimized call to that function directly.

SETGET For calculated Data. The name of the method can be manipulated like a Data element to Set or Get a value.

VIRTUAL Methods that do nothing. Useful for Base classes where the child class will define the method’s behavior, or when you are first creating and testing a Class.

OPERATOR Operator Overloading for classes. See example Tests/TestOp.prg for details.

CLASS <ClassName> Use this syntax only for defining a full method after the ENDCLASS command.

Examples

      CREATE CLASS TWindow
         VAR    hWnd, nOldProc
         METHOD New( ) CONSTRUCTOR
         METHOD Capture() INLINE  SetCapture( ::hWnd )
         METHOD End() BLOCK  {| Self, lEnd | iif( lEnd := ::lValid(),;
                                 ::PostMsg( WM_CLOSE ), ), lEnd }
         METHOD EraseBkGnd( hDC )
         METHOD cTitle( cNewTitle ) SETGET
         METHOD Close() VIRTUAL
      ENDCLASS

      METHOD New( ) CLASS TWindow
         local nVar, cStr
         ... <code> ...
         ... <code> ...
      RETURN Self

Tests

      TestOp.prg

Compliance

Harbour

Platforms

All

Seealso

HBClass(), Object Oriented Programming, DATA, CLASS

CLASS

 

CLASS

 

Define a Class for Object Oriented Programming

Syntax

      [CREATE] CLASS <ClassName> [ <FROM, INHERIT> <SuperClass1> [,<SuperClassN>] ]  [STATIC]

Arguments

<ClassName> Name of the class to define. By tradition, Harbour classes start with “T” to avoid collisions with user- created classes.

<SuperClass1…n> The Parent class(es) to use for inheritance. Harbour supports Multiple Inheritance.

STATIC This clause causes the class function to be declared as a static function. It will therefore not be available outside the current module.

Description

CLASS creates a class from which you can create objects. The CLASS command begins the class specification, in which the DATA elements (also known as instance variables) and METHODS of the class are named. The following scoping commands may also appear. They control the default scope of DATA and METHOD commands that follow them.

         EXPORTED:
         VISIBLE:
         HIDDEN:
         PROTECTED:

    The class specification ends with the END CLASS command.

Classes can inherit from multiple <SuperClasses>, and the chain of inheritance can extend to many levels.

A program uses a Class by calling the Class Constructor, usually the New() method, to create an object. That object is usually assigned to a variable, which is used to access the DATA elements and methods.

Harbour’s OOP syntax and implementation supports Scoping (Protect, Hidden and Readonly) and Delegating, and is largely compatible with Class(y)(tm), TopClass(tm) and Visual Objects(tm).

Examples

      CREATE CLASS TBColumn

         VAR Block      // Code block to retrieve data for the column
         VAR Cargo      // User-definable variable
         VAR ColorBlock // Code block that determines color of data items
         VAR ColSep     // Column separator character
         VAR DefColor   // Array of numeric indexes into the color table
         VAR Footing    // Column footing
         VAR FootSep    // Footing separator character
         VAR Heading    // Column heading
         VAR HeadSep    // Heading separator character
         VAR Width      // Column display width
         VAR ColPos     // Temporary column position on screen

         METHOD New()    // Constructor

      ENDCLASS

Compliance

Harbour

Platforms

All

Seealso

HBClass(), Object Oriented Programming, DATA, METHOD