/*!
  @header FTVersionImpl
  @abstract Module of FT
 
  @availability OS X, GNUstep
  @copyright 2004, 2005, 2006 Free Software Foundation, Inc.
  
  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  04.10.05 ola     initial version
  23.08.06 ola     license changed
  -------------------------------------------------------------------------
  </pre>
*/

#if !defined(__FTVersionImpl_H)
#define __FTVersionImpl_H

#include <Foundation/Foundation.h>
#include <FT/FTObject.h>
#include <FT/FTVersion.h>

/*!
 * @class FTVersionImpl
 * @abstract Default implementation for representation of version numbers.
 */
@interface FTVersionImpl : FTObject <FTVersion> {
  @private
    unsigned major;
    unsigned minor;
    unsigned build;
    
    ft_releaseState_t state;
    
    NSString *versionString;
}

/*!
 * @method initWithMajor
 * @abstract Initializes with the given version information
 * @param aMajorNr major version number
 * @param aMinorNr minor version number
 * @param aState state of the build
 * @result self
 */
- initWithMajor: (unsigned) aMajorNr withMinor: (unsigned) aMinorNr
  withBuild: (unsigned) aBuildNr asState: (ft_releaseState_t) aState;
- (void) dealloc;


/*!
 * @method build
 * @result build number
 */
- (unsigned) build;


/*!
 * @method characterForState 
 * @abstract determines the representing character for the given state
 * @result representing character for the given state
 */
+ (char) characterForState: (ft_releaseState_t) aState;


/*!
 * @method createVersionString
 * @abstract creates the version string based on the internal settings
 * @param aMajorNr major number
 * @param aMinorNr minor number
 * @param aBuildNr build number
 * @param aState state of the artefact.
 * @result self
 */
+ (NSString *) createVersionStringForMajor: (unsigned) aMajorNr
  forMinor: (unsigned) aMinorNr forBuild: (unsigned) aBuildNr
  forState: (ft_releaseState_t) aState;


/*!
 * @method description
 * @result Returns an NSString object that describes the contents of the 
 * receiver. The debugger’s print-object command indirectly invokes this method 
 * to produce a textual description of an object.
 */
- (NSString *) description;


/*!
 * @method hash
 * @result Returns an integer that can be used as a table address in a hash 
 * table structure
 */
- (unsigned) hash;


/*!
 * @method isEqual
 * @result Returns YES if the receiver and anObject are equal, NO otherwise.
 */
- (BOOL) isEqual: (id) anObject;


/*!
 * @method major 
 * @result major version number
 */
- (unsigned) major;


/*!
 * @method minor
 * @result returns minor version number
 */
- (unsigned) minor;


/*!
 * @method releaseState
 * @result state of the release
 */
- (ft_releaseState_t) releaseState;


/*!
 * @method versionString
 * @abstract Used to create a unique string representation of the version.
 * @result string representation of the version
 */
- (NSString *) versionString;

@end
#endif
