equal
deleted
inserted
replaced
511 model value:value] |
511 model value:value] |
512 |
512 |
513 updateBlock: [:m :a :p | true] |
513 updateBlock: [:m :a :p | true] |
514 |
514 |
515 |
515 |
|
516 ! |
|
517 |
|
518 literal |
|
519 "setup the converter to convert from a string to a literal |
|
520 and vice versa. Invalid symbols (i.e. empty) are converted to nil; |
|
521 nil values are converted to an empty string. |
|
522 true, false, Numbers are parsed" |
|
523 |
|
524 self |
|
525 getBlock:[:model | |
|
526 |val s| |
|
527 |
|
528 val := model value. |
|
529 (val isLiteral and:[val notNil]) ifTrue:[ |
|
530 val isSymbol ifTrue:[ |
|
531 "print 'special' symbols as symbols i.e. as #'symbol'" |
|
532 (s := val storeString) second == $' ifTrue:[ |
|
533 s |
|
534 ] ifFalse:[ |
|
535 val printString |
|
536 ] |
|
537 ] ifFalse:[ |
|
538 val storeString |
|
539 ]. |
|
540 ] ifFalse:[ |
|
541 ''. |
|
542 ]] |
|
543 |
|
544 putBlock: |
|
545 [:model :string | |
|
546 |
|
547 |value s| |
|
548 |
|
549 string size == 0 ifTrue:[ |
|
550 value := nil |
|
551 ] ifFalse:[ |
|
552 s := string withoutSeparators. |
|
553 value := Object readFrom:s onError:[ |
|
554 s asSymbol |
|
555 ]. |
|
556 ]. |
|
557 model value:value] |
|
558 |
|
559 updateBlock: [:m :a :p | true] |
|
560 |
|
561 "Created: / 21.2.1997 / 18:58:38 / cg" |
|
562 "Modified: / 26.5.1998 / 15:06:06 / cg" |
516 ! |
563 ! |
517 |
564 |
518 number |
565 number |
519 "setup the converter to convert from a string to a number |
566 "setup the converter to convert from a string to a number |
520 and vice versa. Invalid numbers are converted to nil." |
567 and vice versa. Invalid numbers are converted to nil." |
1110 ! ! |
1157 ! ! |
1111 |
1158 |
1112 !TypeConverter class methodsFor:'documentation'! |
1159 !TypeConverter class methodsFor:'documentation'! |
1113 |
1160 |
1114 version |
1161 version |
1115 ^ '$Header: /cvs/stx/stx/libview2/TypeConverter.st,v 1.36 2001-03-28 17:45:00 cg Exp $' |
1162 ^ '$Header: /cvs/stx/stx/libview2/TypeConverter.st,v 1.37 2001-04-02 09:04:11 stefan Exp $' |
1116 ! ! |
1163 ! ! |