#DOCUMENTATION by stefan
authorStefan Vogel <sv@exept.de>
Thu, 04 Jan 2018 01:12:44 +0100
changeset 22407 09eea6d44c0e
parent 22406 b94edbfd6aa7
child 22408 09eceae5d786
#DOCUMENTATION by stefan class: CharacterEncoderImplementations::ISO10646_to_XMLUTF8 removed: #isValidXMLunicode: comment/format in: #encodeString: #encodeString:on: changed: #encodeCharacter:on: class: CharacterEncoderImplementations::ISO10646_to_XMLUTF8 class added: #isValidXMLunicode: comment/format in: #documentation
CharacterEncoderImplementations__ISO10646_to_XMLUTF8.st
--- a/CharacterEncoderImplementations__ISO10646_to_XMLUTF8.st	Wed Jan 03 21:20:49 2018 +0100
+++ b/CharacterEncoderImplementations__ISO10646_to_XMLUTF8.st	Thu Jan 04 01:12:44 2018 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 2006 by eXept Software AG
 	      All Rights Reserved
@@ -46,7 +44,7 @@
     Not all UTF characters are valid in XML, whatever encoding
     is used. For a reference, see 
 
-      http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char   
+      https://www.w3.org/TR/xml/#NT-Char
 
     Invalid characters are replaced by ReplacementCharacter
     with $? as default.
@@ -59,7 +57,7 @@
     [class variables:]
 
     [see also:]
-        http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
+        https://www.w3.org/TR/xml/#NT-Char
 
 "
 ! !
@@ -74,6 +72,24 @@
     "Modified: / 30-06-2012 / 19:55:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!ISO10646_to_XMLUTF8 class methodsFor:'queries'!
+
+isValidXMLunicode: codePoint
+    "Returns true, if given codePoint (Integer!!!!!!) is
+     valid XML unicode."
+
+    codePoint == 16r0009 ifTrue:[ ^ true ].
+    codePoint == 16r000A ifTrue:[ ^ true ].
+    codePoint == 16r000D ifTrue:[ ^ true ].
+    (codePoint between: 16r0020  and: 16rD7FF  ) ifTrue:[ ^ true ].
+    (codePoint between: 16rE000  and: 16rFFFD  ) ifTrue:[ ^ true ].
+    (codePoint between: 16r10000 and: 16r10FFFF) ifTrue:[ ^ true ].
+
+    ^false.
+
+    "Created: / 30-06-2012 / 20:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !ISO10646_to_XMLUTF8 methodsFor:'encoding & decoding'!
 
 encodeCharacter:aUnicodeCharacter on:aStream
@@ -82,18 +98,18 @@
      characters. Invalid characters are replaced by a
      ReplacementCharacter. For details, please see
 
-     http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char"
-
+     https://www.w3.org/TR/xml/#NT-Char"
 
     |codePoint|
 
     codePoint := aUnicodeCharacter codePoint.
-    (self isValidXMLunicode:codePoint) ifFalse:[
+    (self class isValidXMLunicode:codePoint) ifFalse:[
         codePoint := ReplacementCharacter codePoint.
     ].
     aStream nextPutUtf8:codePoint.
 
     "Created: / 16-02-2017 / 17:29:24 / stefan"
+    "Modified: / 04-01-2018 / 01:10:28 / stefan"
 !
 
 encodeString:aUnicodeString
@@ -102,9 +118,7 @@
      characters. Invalid characters are replaced by a
      ReplacementCharacter. For details, please see
 
-     http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
-
-    "
+     https://www.w3.org/TR/xml/#NT-Char"
 
     |s|
 
@@ -130,7 +144,7 @@
     "
 
     "Created: / 30-06-2012 / 20:07:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified (comment): / 16-02-2017 / 17:27:31 / stefan"
+    "Modified (comment): / 04-01-2018 / 01:08:11 / stefan"
 !
 
 encodeString:aUnicodeString on:aStream
@@ -139,7 +153,7 @@
      characters. Invalid characters are replaced by a
      ReplacementCharacter. For details, please see
 
-     http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char  "
+     https://www.w3.org/TR/xml/#NT-Char"
 
     |sz "{Class: SmallInteger}"|
 
@@ -149,26 +163,11 @@
     ].
 
     "Created: / 16-02-2017 / 17:18:47 / stefan"
+    "Modified (comment): / 04-01-2018 / 01:07:32 / stefan"
 ! !
 
 !ISO10646_to_XMLUTF8 methodsFor:'queries'!
 
-isValidXMLunicode: codePoint
-    "Returns true, if given codePoint (Integer!!!!!!) is
-     valid XML unicode."
-
-    codePoint == 16r0009 ifTrue:[ ^ true ].
-    codePoint == 16r000A ifTrue:[ ^ true ].
-    codePoint == 16r000D ifTrue:[ ^ true ].
-    (codePoint between: 16r0020  and: 16rD7FF  ) ifTrue:[ ^ true ].
-    (codePoint between: 16rE000  and: 16rFFFD  ) ifTrue:[ ^ true ].
-    (codePoint between: 16r10000 and: 16r10FFFF) ifTrue:[ ^ true ].
-
-    ^false.
-
-    "Created: / 30-06-2012 / 20:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 nameOfEncoding
     ^ #'utf8-XML'
 ! !