# HG changeset patch # User Claus Gittinger # Date 930321306 -7200 # Node ID fdc4454013e435d4046f46a1d12b9ac028b7d27b # Parent 91cf6653901e9a4b48b72b910e436d25c6710620 checkin from browser diff -r 91cf6653901e -r fdc4454013e4 PrintConv.st --- a/PrintConv.st Sat Jun 19 00:52:33 1999 +0200 +++ b/PrintConv.st Fri Jun 25 16:35:06 1999 +0200 @@ -309,6 +309,12 @@ aTypeSymbol == #date ifTrue:[ self initForDate ]. + aTypeSymbol == #time ifTrue:[ + self initForTime + ]. + aTypeSymbol == #timeOrNil ifTrue:[ + self initForTimeOrNil + ]. aTypeSymbol == #float ifTrue:[ self initForFloat ]. @@ -416,6 +422,22 @@ stringToValueBlock := [:string | string] ! +initForTime + "initialize to convert to/from a time + - if the string is empty or invalid, convert to the current time" + + valueToStringBlock := [:time | time printString]. + stringToValueBlock := [:string | Time readFromString:string onError:[Time now]] +! + +initForTimeOrNil + "initialize to convert to/from a time + - if the string is empty or invalid, convert to nil" + + valueToStringBlock := [:time | time printString]. + stringToValueBlock := [:string | Time readFromString:string onError:nil] +! + initForYesNo "initialize to convert a 'yes'/'no' string to/from a boolean The string is supposed to be in the current Language @@ -441,5 +463,5 @@ !PrintConverter class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview2/Attic/PrintConv.st,v 1.16 1997-02-11 19:08:41 ca Exp $' + ^ '$Header: /cvs/stx/stx/libview2/Attic/PrintConv.st,v 1.17 1999-06-25 14:35:06 cg Exp $' ! ! diff -r 91cf6653901e -r fdc4454013e4 PrintConverter.st --- a/PrintConverter.st Sat Jun 19 00:52:33 1999 +0200 +++ b/PrintConverter.st Fri Jun 25 16:35:06 1999 +0200 @@ -309,6 +309,12 @@ aTypeSymbol == #date ifTrue:[ self initForDate ]. + aTypeSymbol == #time ifTrue:[ + self initForTime + ]. + aTypeSymbol == #timeOrNil ifTrue:[ + self initForTimeOrNil + ]. aTypeSymbol == #float ifTrue:[ self initForFloat ]. @@ -416,6 +422,22 @@ stringToValueBlock := [:string | string] ! +initForTime + "initialize to convert to/from a time + - if the string is empty or invalid, convert to the current time" + + valueToStringBlock := [:time | time printString]. + stringToValueBlock := [:string | Time readFromString:string onError:[Time now]] +! + +initForTimeOrNil + "initialize to convert to/from a time + - if the string is empty or invalid, convert to nil" + + valueToStringBlock := [:time | time printString]. + stringToValueBlock := [:string | Time readFromString:string onError:nil] +! + initForYesNo "initialize to convert a 'yes'/'no' string to/from a boolean The string is supposed to be in the current Language @@ -441,5 +463,5 @@ !PrintConverter class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview2/PrintConverter.st,v 1.16 1997-02-11 19:08:41 ca Exp $' + ^ '$Header: /cvs/stx/stx/libview2/PrintConverter.st,v 1.17 1999-06-25 14:35:06 cg Exp $' ! !