MCStXSnapshotPostReadTransformation.st
author Jan Vrany <jan.vrany@labware.com>
Tue, 20 Sep 2022 17:58:07 +0100
branchjv
changeset 1164 b2f0322f5c53
parent 1150 167bfe697a5d
permissions -rw-r--r--
Use separate porters when writing out / reading in snapshots

"
COPYRIGHT (c) 2021-2022 LabWare
"
"{ Package: 'stx:goodies/monticello' }"

"{ NameSpace: Smalltalk }"

MCStXSnapshotTransformation subclass:#MCStXSnapshotPostReadTransformation
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'SCM-Monticello-St/X Storing'
!

!MCStXSnapshotPostReadTransformation class methodsFor:'documentation'!

copyright
"
COPYRIGHT (c) 2021-2022 LabWare


"
!

documentation
"
    documentation to be added.

    [author:]
        Jan Vrany <jan.vrany@fit.cvut.cz>

    [instance variables:]

    [class variables:]

    [see also:]

"
! !

!MCStXSnapshotPostReadTransformation methodsFor:'visiting'!

visitClassComment: definition
    | comment source |

    comment := definition comment asStringWithNativeLineEndings."/ Make sure comment has native line endings
    comment := comment tabsToSpaces.                            "/ Make sure there are tabs and spaces used for indentation
                                                                "/ (as it is norm on Smalltalk/X)
    comment := comment asSingleByteStringIfPossible.            "/ Convert to single byte string
    definition comment: comment.

    source := definition source asStringWithNativeLineEndings.  "/ Make sure source has native line endings
    source := source tabsToSpaces.                              "/ Make sure there are tabs and spaces used for indentation
                                                                "/ (as it is norm on Smalltalk/X)
    source := source asSingleByteStringIfPossible.              "/ Convert to single byte string
    definition source: source.

    "Created: / 17-09-2021 / 12:02:36 / Jan Vrany <jan.vrany@labware.com>"
    "Modified (format): / 17-09-2021 / 15:14:03 / Jan Vrany <jan.vrany@labware.com>"
!

visitClassDefinition: definition
    | comment importer |

    comment := definition commentOrNil.
    comment notNil ifTrue: [
        comment := comment asStringWithNativeLineEndings.           "/ Make sure comment has native line endings
        comment := comment tabsToSpaces.                            "/ Make sure there are tabs and spaces used for indentation
                                                                    "/ (as it is norm on Smalltalk/X)
        comment := comment asSingleByteStringIfPossible.            "/ Convert to single byte string
        definition comment: comment.
    ].

    importer := original options importer.
    importer notNil ifTrue: [ definition accept: importer ]

    "Created: / 17-09-2021 / 15:14:50 / Jan Vrany <jan.vrany@labware.com>"
    "Modified: / 20-09-2022 / 16:57:14 / Jan Vrany <jan.vrany@labware.com>"
!

visitMethodDefinition: definition
    | source importer |

    source := definition source asStringWithNativeLineEndings.  "/ Make sure source has native line endings
    source := source tabsToSpaces.                              "/ Make sure there are tabs and spaces used for indentation
                                                                "/ (as it is norm on Smalltalk/X)
    source := source asSingleByteStringIfPossible.              "/ Convert to single byte string

    definition source: source.

    importer := original options importer.
    importer notNil ifTrue: [ definition accept: importer ].

    "Created: / 24-04-2015 / 16:02:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 20-09-2022 / 16:57:27 / Jan Vrany <jan.vrany@labware.com>"
! !

!MCStXSnapshotPostReadTransformation class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCStXSnapshotPostReadTransformation.st,v 1.1 2013-05-29 11:47:15 vrany Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/goodies/monticello/MCStXSnapshotPostReadTransformation.st,v 1.1 2013-05-29 11:47:15 vrany Exp $'
!

version_HG

    ^ '$Changeset: <not expanded> $'
! !