PackageId.st
author Claus Gittinger <cg@exept.de>
Fri, 18 Aug 2006 12:23:53 +0200
changeset 9571 01355270af5c
child 9577 03cce2fb9e0a
permissions -rw-r--r--
initial checkin

"
 COPYRIGHT (c) 2006 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

"{ Package: 'stx:libbasic3' }"

Object subclass:#PackageId
	instanceVariableNames:'packageIdString'
	classVariableNames:''
	poolDictionaries:''
	category:'System-Support-Projects'
!

!PackageId class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 2006 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    Represents packageID's.
    Knows the relationship between modules and directories in the package-organization.
"
! !

!PackageId class methodsFor:'instance creation'!

from: aStringOrSymbol
    ^ self new packageIdString:aStringOrSymbol

    "Created: / 18-08-2006 / 12:11:58 / cg"
! !

!PackageId methodsFor:'accessing'!

directory
    "return the directory component. Thats the rest after the colon.
     The module is typically used to define the project-path or project-id within its
     sourcecode repository (which is selected via the module)."

    ^ packageIdString copyFrom:(packageIdString indexOf:$:)+1

    "
     (PackageId from:'stx:libbasic') module  
     (PackageId from:'stx:libbasic') directory  
     (PackageId from:'stx:goodies/xml/stx') module  
     (PackageId from:'stx:goodies/xml/stx') directory  
    "

    "Created: / 18-08-2006 / 12:15:33 / cg"
!

module
    "return the module component. Thats the first component up to the colon.
     The module is typically used to select a corresponding sourcecode repository."

    ^ packageIdString upTo:$:

    "
     (PackageId from:'stx:libbasic') module  
     (PackageId from:'stx:libbasic') directory  
    "

    "Created: / 18-08-2006 / 12:13:53 / cg"
!

packageIdString:something
    packageIdString := something.

    "Created: / 18-08-2006 / 12:14:45 / cg"
!

string
    ^ packageIdString

    "Created: / 18-08-2006 / 12:20:54 / cg"
! !

!PackageId methodsFor:'comparing'!

= aPackageId
    ^ packageIdString = aPackageId asPackageId string

    "
     'stx:libbasic' asPackageId = 'stx:libbasic' asSymbol asPackageId  
     'stx:libbasic' asPackageId = 'stx:libbasic' asPackageId    
     'stx:libbasic2' asPackageId = 'stx:libbasic3' asPackageId  
    "

    "Created: / 18-08-2006 / 12:20:47 / cg"
!

hash
    ^ packageIdString hash

    "Created: / 18-08-2006 / 12:21:19 / cg"
! !

!PackageId methodsFor:'converting'!

asPackageId
    ^ self

    "Created: / 18-08-2006 / 12:22:10 / cg"
!

asString
    ^ packageIdString

    "Created: / 18-08-2006 / 12:12:22 / cg"
!

asSymbol
    ^ packageIdString asSymbol

    "Created: / 18-08-2006 / 12:12:29 / cg"
! !

!PackageId class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/PackageId.st,v 1.1 2006-08-18 10:23:53 cg Exp $'
! !