HierarchicalURI.st
changeset 1257 9e730dd97a7f
parent 1254 baf01931b9d6
child 1267 5e7f102e094d
equal deleted inserted replaced
1256:f452235ed554 1257:9e730dd97a7f
     1 "{ Package: 'stx:libbasic2' }"
     1 "{ Package: 'stx:libbasic2' }"
     2 
     2 
     3 URI subclass:#HierarchicalURI
     3 URI subclass:#HierarchicalURI
     4 	instanceVariableNames:'authority isAbsolute pathSegments query fragment'
     4 	instanceVariableNames:'authority isAbsolute isDirectory pathSegments query fragment'
     5 	classVariableNames:''
     5 	classVariableNames:''
     6 	poolDictionaries:''
     6 	poolDictionaries:''
     7 	category:'Resources'
     7 	category:'Resources'
     8 !
     8 !
     9 
     9 
   103 
   103 
   104 isAbsolute
   104 isAbsolute
   105     "return the value of the instance variable 'isAbsolute' (automatically generated)"
   105     "return the value of the instance variable 'isAbsolute' (automatically generated)"
   106 
   106 
   107     ^ isAbsolute
   107     ^ isAbsolute
       
   108 !
       
   109 
       
   110 isDirectory
       
   111     "return the value of the instance variable 'isDirectory' (automatically generated)"
       
   112 
       
   113     ^ isDirectory ? false
   108 !
   114 !
   109 
   115 
   110 pathSegements
   116 pathSegements
   111     "return the value of the instance variable 'pathSegements' (automatically generated)"
   117     "return the value of the instance variable 'pathSegements' (automatically generated)"
   112 
   118 
   286         i1 := aString indexOfAny:'/?#' startingAt:i+1.
   292         i1 := aString indexOfAny:'/?#' startingAt:i+1.
   287         i1 == 0 ifTrue:[ |path|
   293         i1 == 0 ifTrue:[ |path|
   288             path := aString copyFrom:i+1.
   294             path := aString copyFrom:i+1.
   289             path size ~~ 0 ifTrue:[
   295             path size ~~ 0 ifTrue:[
   290                 pathSegments add:path.
   296                 pathSegments add:path.
       
   297             ] ifFalse:[
       
   298                 (aString at:i) == $/ ifTrue:[
       
   299                     isDirectory := true
       
   300                 ].
   291             ].
   301             ].
   292             ^ self.
   302             ^ self.
   293         ] ifFalse:[
   303         ] ifFalse:[
   294             separator := aString at:i1.
   304             separator := aString at:i1.
   295             pathSegments add:(aString copyFrom:i+1 to:i1-1).
   305             pathSegments add:(aString copyFrom:i+1 to:i1-1).
   311     separator == $# ifTrue:[
   321     separator == $# ifTrue:[
   312         fragment := aString copyFrom:i+1.
   322         fragment := aString copyFrom:i+1.
   313     ].
   323     ].
   314         
   324         
   315     "
   325     "
   316      self new fromString:'//authority/path1/path2'
   326      self new fromString:'//authority/path1/path2/' 
   317      self new fromString:'//authority/path1/path2?query'
   327      self new fromString:'//authority/path1/path2?query'
   318      self new fromString:'//authority/path1/path2?query#fragment'
   328      self new fromString:'//authority/path1/path2?query#fragment'
   319      self new fromString:'/path1/path2?query#fragment'
   329      self new fromString:'/path1/path2?query#fragment'
   320      self new fromString:'/path1/path2#fragment'
   330      self new fromString:'/path1/path2#fragment'
   321      self new fromString:'path1/path2#fragment'
   331      self new fromString:'path1/path2#fragment'
   432 ! !
   442 ! !
   433 
   443 
   434 !HierarchicalURI class methodsFor:'documentation'!
   444 !HierarchicalURI class methodsFor:'documentation'!
   435 
   445 
   436 version
   446 version
   437     ^ '$Header: /cvs/stx/stx/libbasic2/HierarchicalURI.st,v 1.2 2003-06-24 14:10:39 tm Exp $'
   447     ^ '$Header: /cvs/stx/stx/libbasic2/HierarchicalURI.st,v 1.3 2003-07-09 12:51:46 tm Exp $'
   438 ! !
   448 ! !