966
|
1 |
"{ Package: 'stx:goodies/monticello' }"
"{ NameSpace: Smalltalk }"
Object subclass:#MCReader
instanceVariableNames:'stream'
classVariableNames:''
poolDictionaries:''
category:'SCM-Monticello-Storing'
!
|
34
|
2 |
|
|
3 |
|
|
4 |
!MCReader class methodsFor:'instance creation'!
|
|
5 |
|
523
|
6 |
on: aStringOrStream
|
|
7 |
^ self new stream: aStringOrStream readStream
|
|
8 |
|
|
9 |
"Modified: / 25-11-2011 / 16:57:41 / cg"
|
34
|
10 |
!
|
|
11 |
|
|
12 |
on: aStream name: aFileName
|
|
13 |
| class |
|
237
|
14 |
class := self readerClassForFileNamed: aFileName.
|
34
|
15 |
^ class
|
|
16 |
ifNil: [self error: 'Unsupported format: ', aFileName]
|
|
17 |
ifNotNil: [class on: aStream]
|
|
18 |
! !
|
|
19 |
|
|
20 |
!MCReader class methodsFor:'testing'!
|
|
21 |
|
|
22 |
canReadFileNamed: fileName
|
|
23 |
^ (fileName endsWith: self extension)
|
|
24 |
!
|
|
25 |
|
|
26 |
concreteSubclasses
|
966
|
27 |
"must make sure that the package is fully loaded;
|
|
28 |
otherwise, subclasses are not found"
|
|
29 |
|
|
30 |
self projectDefinitionClass ensureFullyLoaded.
|
|
31 |
^ self allSubclasses reject: [:c | c isAbstract]
|
34
|
32 |
!
|
|
33 |
|
|
34 |
isAbstract
|
|
35 |
^ (self respondsTo: #extension) not
|
|
36 |
!
|
|
37 |
|
|
38 |
readerClassForFileNamed: fileName
|
|
39 |
^ self concreteSubclasses
|
|
40 |
detect: [:c | c canReadFileNamed: fileName]
|
|
41 |
ifNone: [nil]
|
|
42 |
! !
|
|
43 |
|
|
44 |
!MCReader methodsFor:'accessing'!
|
|
45 |
|
|
46 |
stream: aStream
|
237
|
47 |
stream := aStream
|
34
|
48 |
! !
|
|
49 |
|
|
50 |
!MCReader class methodsFor:'documentation'!
|
|
51 |
|
|
52 |
version
|
966
|
53 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCReader.st,v 1.6 2015-02-07 11:09:03 cg Exp $'
|
237
|
54 |
!
|
|
55 |
|
|
56 |
version_CVS
|
966
|
57 |
^ '$Header: /cvs/stx/stx/goodies/monticello/MCReader.st,v 1.6 2015-02-07 11:09:03 cg Exp $'
|
237
|
58 |
!
|
|
59 |
|
|
60 |
version_SVN
|
966
|
61 |
^ '$Id: MCReader.st,v 1.6 2015-02-07 11:09:03 cg Exp $'
|
34
|
62 |
! !
|
966
|
63 |
|