ExternalLong.st
author Stefan Vogel <sv@exept.de>
Thu, 08 Jul 2010 16:12:50 +0200
changeset 2462 07457221fd73
parent 2330 2d8b961f62dc
child 2517 5a6c9b79c66a
permissions -rw-r--r--
added: #printOn:

"
 COPYRIGHT (c) 1998 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ Package: 'stx:libbasic2' }"

ExternalBytes subclass:#ExternalLong
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'System-Support'
!

!ExternalLong class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1998 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    mostly added for odbc
"
! !

!ExternalLong class methodsFor:'instance creation'!

new
    ^ super new:4

    "
     ExternalLong new
    "
!

unprotectedNew
    ^ super unprotectedNew:4

    "
     ExternalLong new
    "
! !

!ExternalLong methodsFor:'accessing'!

asBoolean
    |result|

    result := self byteAt:1.
    result = 0 ifTrue:[
        ^ false.
    ].
    ^ true.
!

asInteger
    ^ self signedWordAt:1 MSB:false

    "
     ODBCLibrary::ExternalLong new value:10
    "
!

asNullStatus
    |result|

    result := self wordAt:1 MSB:false.
    result = 0 ifTrue:[ ^ #SQL_NO_NULLS ].
    result = 1 ifTrue:[ ^ #SQL_NULLABLE ].
    ^ #SQL_NULLABLE_UNKNOWN
!

asPointer
    ^ ExternalAddress new setAddress:(self value)

    "
     (ExternalLong new value:10) asPointer
    "
!

boolean:bool
    bool ifTrue:[self byteAt:1 put:1].
    self byteAt:1 put:0.
!

value
    ^ self doubleWordAt:1

    "
     ExternalLong new value:10
    "

    "Modified: / 30.3.1998 / 17:07:57 / cg"
!

value:anInteger
    self doubleWordAt:1 put:anInteger
! !

!ExternalLong methodsFor:'printing & storing'!

printOn:aStream
    aStream nextPutAll:self className; nextPut:$(.
    self asInteger printOn:aStream.
    aStream nextPut:$)
! !

!ExternalLong class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic2/ExternalLong.st,v 1.7 2010-07-08 14:12:50 stefan Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libbasic2/ExternalLong.st,v 1.7 2010-07-08 14:12:50 stefan Exp $'
! !