InlineObject.st
author Claus Gittinger <cg@exept.de>
Tue, 02 Apr 2019 10:50:28 +0200
branchjv
changeset 24091 691c182c3105
parent 23547 c69c97cec351
child 25421 c866181b2e34
permissions -rw-r--r--
#BUGFIX by cg class: CharacterArray changed: #, #asDenseUnicodeString (grafted from ba4c42171801ea3a46aea31504a621256655feae)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11912
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     1
"
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     2
 COPYRIGHT (c) 2009 by eXept Software AG
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     3
              All Rights Reserved
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     4
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     5
 This software is furnished under a license and may be used
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     6
 only in accordance with the terms of that license and with the
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     8
 be provided or otherwise made available to, or used by, any
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     9
 other person.  No title to or ownership of the software is
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    10
 hereby transferred.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    11
"
11444
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libbasic' }"
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    14
"{ NameSpace: Smalltalk }"
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    15
11444
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
Object subclass:#InlineObject
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:''
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Programming-Support'
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
11912
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    23
!InlineObject class methodsFor:'documentation'!
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    24
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    25
copyright
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    26
"
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    27
 COPYRIGHT (c) 2009 by eXept Software AG
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    28
              All Rights Reserved
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    29
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    30
 This software is furnished under a license and may be used
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    31
 only in accordance with the terms of that license and with the
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    33
 be provided or otherwise made available to, or used by, any
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    34
 other person.  No title to or ownership of the software is
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    35
 hereby transferred.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    36
"
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    37
!
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    38
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    39
documentation
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    40
"
11913
1fa1ac64239b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11912
diff changeset
    41
    WARNING: InlineObjects are an experimental feature.
1fa1ac64239b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11912
diff changeset
    42
1fa1ac64239b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11912
diff changeset
    43
    InlineObjects are written as literals of the form:
11912
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    44
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    45
    #{ 
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    46
        filedName1: value1.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    47
        filedName2: value2.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    48
        ...
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    49
        filedNameN: valueN.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    50
    }
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    51
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    52
    For example:
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    53
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    54
    #{ 
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    55
        firstName: 'Peter'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    56
        lastName: 'Miller'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    57
        age: 25.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    58
    }
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    59
        
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    60
    All inlineObjects will be instances of an anonymous subclass of me,
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    61
    and provide getter protocol for their fields (eg. firstName, lastName and age in the above example.
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    62
    InlineObjects are immutable (no setters).
11912
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    63
"
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    64
! !
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    65
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    66
!InlineObject methodsFor:'printing & storing'!
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    67
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    68
storeOn:aStream
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    69
    aStream nextPutAll:'#{'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    70
    self class allInstVarNames keysAndValuesDo:[:i :nm |
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    71
        aStream nextPutAll:nm; nextPutAll:':'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    72
        (self instVarAt:i) storeOn:aStream.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    73
        aStream nextPutAll:'. '.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    74
    ].
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    75
    aStream nextPutAll:'}'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    76
! !
11444
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
!InlineObject class methodsFor:'documentation'!
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
version
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    81
    ^ '$Header: /cvs/stx/stx/libbasic/InlineObject.st,v 1.4 2015-06-08 00:24:48 cg Exp $'
11444
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
! !
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    83