Skip to content

Commit

Permalink
Moved to Tonel 3
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Jun 18, 2024
1 parent b0030b3 commit 96009c6
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 87 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
Class {
#name : #ConfigurationOfXmlDomVisitor,
#superclass : #ConfigurationOf,
#category : 'ConfigurationOfXmlDomVisitor'
#name : 'ConfigurationOfXmlDomVisitor',
#superclass : 'ConfigurationOf',
#category : 'ConfigurationOfXmlDomVisitor',
#package : 'ConfigurationOfXmlDomVisitor'
}

{ #category : #baselines }
{ #category : 'baselines' }
ConfigurationOfXmlDomVisitor >> baseline_0_1_0: spec [
<version: '0.1.0-baseline'>
spec
Expand All @@ -22,7 +23,7 @@ ConfigurationOfXmlDomVisitor >> baseline_0_1_0: spec [
spec group: 'default' with: #('XML-DOM-Visitor') ]
]

{ #category : #'symbolic versions' }
{ #category : 'symbolic versions' }
ConfigurationOfXmlDomVisitor >> development: spec [
<symbolicVersion: #development>
spec for: #common version: '0.1.0-baseline'
Expand Down
2 changes: 1 addition & 1 deletion repository/ConfigurationOfXmlDomVisitor/package.st
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Package { #name : #ConfigurationOfXmlDomVisitor }
Package { #name : 'ConfigurationOfXmlDomVisitor' }
4 changes: 2 additions & 2 deletions repository/XML-DOM-Visitor/XMLCData.extension.st
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #XMLCData }
Extension { #name : 'XMLCData' }

{ #category : #'*XML-DOM-Visitor-visitor' }
{ #category : '*XML-DOM-Visitor-visitor' }
XMLCData >> accept: aVisitor [
aVisitor visitCData: self
]
22 changes: 12 additions & 10 deletions repository/XML-DOM-Visitor/XMLDOMElementVisitor.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,51 @@ I am a DOM visitor that visits elements and delegates the visition to pluggable
e.g. upon visiting `<ActorRoles>` element the `elementVisitor visitActorRoles:` method will be called.
"
Class {
#name : #XMLDOMElementVisitor,
#superclass : #XMLDOMVisitor,
#name : 'XMLDOMElementVisitor',
#superclass : 'XMLDOMVisitor',
#instVars : [
'elementVisitor',
'ignoredElements'
],
#category : 'XML-DOM-Visitor-Visitor'
#category : 'XML-DOM-Visitor-Visitor',
#package : 'XML-DOM-Visitor',
#tag : 'Visitor'
}

{ #category : #accessing }
{ #category : 'accessing' }
XMLDOMElementVisitor >> elementVisitor [
^ elementVisitor
]

{ #category : #accessing }
{ #category : 'accessing' }
XMLDOMElementVisitor >> elementVisitor: aVisitor [
elementVisitor := aVisitor
]

{ #category : #accessing }
{ #category : 'accessing' }
XMLDOMElementVisitor >> ignoredElements [
^ ignoredElements ifNil: [ #() ]
]

{ #category : #accessing }
{ #category : 'accessing' }
XMLDOMElementVisitor >> ignoredElements: aCollection [
ignoredElements := aCollection
]

{ #category : #testing }
{ #category : 'testing' }
XMLDOMElementVisitor >> isIgnored: anElement [
^ self ignoredElements includes: anElement name
]

{ #category : #visiting }
{ #category : 'visiting' }
XMLDOMElementVisitor >> visitElement: anElement [
(self isIgnored: anElement)
ifTrue: [ ^ self ].
elementVisitor perform: (self visitSelectorFor: anElement localName) with: anElement.
super visitElement: anElement
]

{ #category : #visitor }
{ #category : 'visitor' }
XMLDOMElementVisitor >> visitSelectorFor: aNodeName [
^ ('visit' , aNodeName capitalized , ':') asSymbol
]
10 changes: 6 additions & 4 deletions repository/XML-DOM-Visitor/XMLDOMElementVisitorTest.class.st
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Class {
#name : #XMLDOMElementVisitorTest,
#superclass : #TestCase,
#category : 'XML-DOM-Visitor-Tests'
#name : 'XMLDOMElementVisitorTest',
#superclass : 'TestCase',
#category : 'XML-DOM-Visitor-Tests',
#package : 'XML-DOM-Visitor',
#tag : 'Tests'
}

{ #category : #tests }
{ #category : 'tests' }
XMLDOMElementVisitorTest >> testVisitSelectorFor [
self
assert: (XMLDOMElementVisitor new visitSelectorFor: 'someName')
Expand Down
18 changes: 10 additions & 8 deletions repository/XML-DOM-Visitor/XMLDOMTestVisitor.class.st
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
Class {
#name : #XMLDOMTestVisitor,
#superclass : #XMLDOMVisitor,
#name : 'XMLDOMTestVisitor',
#superclass : 'XMLDOMVisitor',
#instVars : [
'entries'
],
#category : 'XML-DOM-Visitor-Visitor'
#category : 'XML-DOM-Visitor-Visitor',
#package : 'XML-DOM-Visitor',
#tag : 'Visitor'
}

{ #category : #accessing }
{ #category : 'accessing' }
XMLDOMTestVisitor >> entries [
^ entries
]

{ #category : #initialization }
{ #category : 'initialization' }
XMLDOMTestVisitor >> initialize [
super initialize.
entries := OrderedCollection new
]

{ #category : #visiting }
{ #category : 'visiting' }
XMLDOMTestVisitor >> visitDocument: aDocument [
entries add: 'version' -> aDocument version.
entries add: 'encoding' -> aDocument encoding.
super visitDocument: aDocument
]

{ #category : #visiting }
{ #category : 'visiting' }
XMLDOMTestVisitor >> visitElement: anElement [
entries add: anElement name -> anElement name.
super visitElement: anElement
]

{ #category : #visiting }
{ #category : 'visiting' }
XMLDOMTestVisitor >> visitString: aStringNode [
entries add: #string -> aStringNode string
]
38 changes: 20 additions & 18 deletions repository/XML-DOM-Visitor/XMLDOMTypedElement.class.st
Original file line number Diff line number Diff line change
@@ -1,80 +1,82 @@
Class {
#name : #XMLDOMTypedElement,
#superclass : #XMLElement,
#category : 'XML-DOM-Visitor-DOM'
#name : 'XMLDOMTypedElement',
#superclass : 'XMLElement',
#category : 'XML-DOM-Visitor-DOM',
#package : 'XML-DOM-Visitor',
#tag : 'DOM'
}

{ #category : #'typed attribute accessing' }
{ #category : 'typed attribute accessing' }
XMLDOMTypedElement >> booleanAt: aName [
^ self booleanFrom: (self attributeAt: aName)
]

{ #category : #'private - converting' }
{ #category : 'private - converting' }
XMLDOMTypedElement >> booleanFrom: aString [
^ #('1' 'true' 'yes') includes: aString
]

{ #category : #'typed value accessing' }
{ #category : 'typed value accessing' }
XMLDOMTypedElement >> booleanValue [
^ self booleanFrom: self rawContentString
]

{ #category : #'typed attribute accessing' }
{ #category : 'typed attribute accessing' }
XMLDOMTypedElement >> dateAt: aName [
^ self dateFrom: (self attributeAt: aName)
]

{ #category : #'private - converting' }
{ #category : 'private - converting' }
XMLDOMTypedElement >> dateFrom: aString [
^ DateAndTime fromString: aString
]

{ #category : #'typed value accessing' }
{ #category : 'typed value accessing' }
XMLDOMTypedElement >> dateValue [
^ self dateFrom: self rawContentString
]

{ #category : #'typed value accessing' }
{ #category : 'typed value accessing' }
XMLDOMTypedElement >> isEmptyValue [
^ self rawContentString isEmpty
]

{ #category : #'typed attribute accessing' }
{ #category : 'typed attribute accessing' }
XMLDOMTypedElement >> numberAt: aName [
^ (self attributeAt: aName) asNumber
]

{ #category : #'typed value accessing' }
{ #category : 'typed value accessing' }
XMLDOMTypedElement >> numberValue [
^ self rawContentString asNumber
]

{ #category : #'typed attribute accessing' }
{ #category : 'typed attribute accessing' }
XMLDOMTypedElement >> stringAt: aName [
^ self attributeAt: aName
]

{ #category : #'typed value accessing' }
{ #category : 'typed value accessing' }
XMLDOMTypedElement >> stringValue [
^ self rawContentString
]

{ #category : #'typed attribute accessing' }
{ #category : 'typed attribute accessing' }
XMLDOMTypedElement >> symbolAt: aName [
^ (self attributeAt: aName) asSymbol
]

{ #category : #'typed value accessing' }
{ #category : 'typed value accessing' }
XMLDOMTypedElement >> symbolValue [
^ self rawContentString asSymbol
]

{ #category : #'typed attribute accessing' }
{ #category : 'typed attribute accessing' }
XMLDOMTypedElement >> uuidAt: aName [
^ UUID fromString: (self attributeAt: aName)
]

{ #category : #'typed value accessing' }
{ #category : 'typed value accessing' }
XMLDOMTypedElement >> uuidValue [
^ UUID fromString: self rawContentString
]
Loading

0 comments on commit 96009c6

Please sign in to comment.