/*===========================================================================
 *
 * File:	BuildInfo.H
 * Author:	Dave Humphrey (uesp@m0use.net)
 * Created On:	Friday, December 08, 2000
 *
 * Defines the CBuildInfo class used for defining custom build information
 * not supplied by the compiler.
 *
 *=========================================================================*/
#ifndef __BUILDINFO_H
#define __BUILDINFO_H

	/* Required Includes */
#include "genutil.h"


/*===========================================================================
 *
 * Begin Defines
 *
 *=========================================================================*/

	/* Maximum line length for build info files */
  #define BUILDINFO_LINE_SIZE 255

	/* Default build file extension */
  #define BUILDINFO_EXTENSION "bif"

/*===========================================================================
 *		End of Defines
 *=========================================================================*/


/*===========================================================================
 *
 * Begin Class CBuildInfo Definition
 *
 * Allows the use of custom build information to a project which is not
 * supplied by the compiler.
 *
 *=========================================================================*/
class CBuildInfo {

  /*---------- Begin Protected Class Members --------------------*/
protected:
  char* pBuildFile;		/* The build filename */
  int	BuildNumber;		/* The number of builds for the project */
  int   ReleaseBuilds;
  int   DebugBuilds;


  /*---------- Begin Protected Class Methods --------------------*/
protected:

	/* Parses a line input from the build info file */
  boolean ParseLine   (char* pString);
  boolean ParseDefine (char* pString);


  /*---------- Begin Public Class Methods -----------------------*/
public:

	/* Class Constructors/Destructors */
  CBuildInfo();
  virtual ~CBuildInfo();
  virtual void Destroy (void);

	/* Get build class members */
  int   GetBuildNumber (void) { return (BuildNumber); }
  char* GetFilename    (void) { return (pBuildFile); }

	/* Check for a valid filename for the build info object */
  boolean HasFilename (void) { return ((pBuildFile == NULL || *pBuildFile == NULL_CHAR) ? FALSE : TRUE); }

	/* Increase the build number by one */
  void IncrementBuild         (void) { BuildNumber++; }
  void IncrementReleaseBuilds (void) { ReleaseBuilds++; }
  void IncrementDebugBuilds   (void) { DebugBuilds++; }

	/* Attempt to load and parse a build information file */
  boolean LoadBuild (const char* pFilename = NULL);

	/* Attempt to save a build information file */
  boolean SaveBuild (const char* pFilename = NULL);

	/* Set build class members */
  void SetBuildNumber (const int Value) { BuildNumber = Value; }
  IMPLEMENT_SETSTRING(SetFilename, pBuildFile);
  
 };
/*===========================================================================
 *		End of Class CBuildInfo Definition
 *=========================================================================*/


#endif
/*===========================================================================
 *		End of File BuildInfo.H
 *=========================================================================*/