InlineObject.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 13 Jun 2018 14:39:23 +0000
branchjv
changeset 23108 77cd6e1625e1
parent 18461 bc3d3101c493
child 23547 c69c97cec351
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
     1
"{ Encoding: utf8 }"
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
     2
11912
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     3
"
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     4
 COPYRIGHT (c) 2009 by eXept Software AG
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     5
              All Rights Reserved
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     6
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     7
 This software is furnished under a license and may be used
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
     8
 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
     9
 inclusion of the above copyright notice.   This software may not
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    10
 be provided or otherwise made available to, or used by, any
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    11
 other person.  No title to or ownership of the software is
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    12
 hereby transferred.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    13
"
11444
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libbasic' }"
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    16
"{ NameSpace: Smalltalk }"
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    17
11444
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
Object subclass:#InlineObject
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	instanceVariableNames:''
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	classVariableNames:''
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	poolDictionaries:''
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	category:'Programming-Support'
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
11912
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    25
!InlineObject class methodsFor:'documentation'!
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
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    28
"
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    29
 COPYRIGHT (c) 2009 by eXept Software AG
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    30
              All Rights Reserved
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    31
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    32
 This software is furnished under a license and may be used
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    33
 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
    34
 inclusion of the above copyright notice.   This software may not
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    35
 be provided or otherwise made available to, or used by, any
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    36
 other person.  No title to or ownership of the software is
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    37
 hereby transferred.
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
!
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    40
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    41
documentation
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    42
"
11913
1fa1ac64239b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11912
diff changeset
    43
    WARNING: InlineObjects are an experimental feature.
1fa1ac64239b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11912
diff changeset
    44
1fa1ac64239b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11912
diff changeset
    45
    InlineObjects are written as literals of the form:
11912
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    46
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    47
    #{ 
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    48
        filedName1: value1.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    49
        filedName2: value2.
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
        filedNameN: valueN.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    52
    }
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
    For example:
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    55
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    56
    #{ 
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    57
        firstName: 'Peter'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    58
        lastName: 'Miller'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    59
        age: 25.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    60
    }
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    61
        
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    62
    All inlineObjects will be instances of an anonymous subclass of me,
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    63
    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
    64
    InlineObjects are immutable (no setters).
11912
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
! !
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
!InlineObject methodsFor:'printing & storing'!
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    69
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    70
storeOn:aStream
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    71
    aStream nextPutAll:'#{'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    72
    self class allInstVarNames keysAndValuesDo:[:i :nm |
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    73
        aStream nextPutAll:nm; nextPutAll:':'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    74
        (self instVarAt:i) storeOn:aStream.
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
    ].
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    77
    aStream nextPutAll:'}'.
846a85c9fcbf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11444
diff changeset
    78
! !
11444
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
!InlineObject class methodsFor:'documentation'!
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
1d3cf0e91729 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
version
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    83
    ^ '$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
    84
! !
18459
9906749677ea class: InlineObject
Claus Gittinger <cg@exept.de>
parents: 11913
diff changeset
    85