/***************************************************************************
                          Project.h  -  description
                             -------------------
    begin                : jeu jui 3 2003
    copyright            : (C) 2003 by Alain Gibaud
    email                : alain.gibaud@univ-valenciennes.fr
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef PROJECT_H
#define PROJECT_H

#include <kconfig.h>

/**A class to organize  project data
  *@author Alain Gibaud
  */

class Project {
public:
  /** Creates an empty project */
	Project(const QString& projectfile);
	~Project();
  /** Returns the project base directory (extracted from the project file name)
 */
  QString projectPath();
  /** Simplify a path+file name, to make it relative to the project filename */
  QString projectRelative(const QString& filename);
  /** Returns the list of file names used int the project */
  QStringList getFiles();
  /** Returns the list of absolutes file names used int the project */
  QStringList getAbsFiles();
  /** Returns the project name 
(ie: naked project file name)
 */
  QString projectName();
  /** generates absolute filename from project relative filename */
  QString absFilename(const QString&) ;
  /** Returns true if absolute filename af is already in the project 
filename list. */
  bool absFileExists(const QString &af);
  /** No descriptions */
  QString getVersion();
  /** No descriptions */
  QString getType();
  
  /** No descriptions */
  QString getDescription();
  void setDescription(const QString &) ;
  
  /** No descriptions */
  QString getDevice();
  void setDevice(const QString &) ;
  
  /** No descriptions */
  QString getHexFormat();
  void setHexFormat(const QString &) ;
  
  /** No descriptions */
  QString getRadix();
  void setRadix(const QString &) ;
  
  /** No descriptions */
  QString getWarnLevel();
  void setWarnLevel(const QString &) ;
  
  /** No descriptions */
  QString getOtherOptions();
  void setOtherOptions(const QString &) ;
  
  /** No descriptions */
  QString getIncludeDir();
  void setIncludeDir(const QString &) ;

  /** No descriptions */
  QString getCIncludeDir();
  void setCIncludeDir(const QString &) ;

  /** No descriptions */
  QString getCLibsDir();
  void setCLibsDir(const QString &) ;

  /** No descriptions */
  QString getCCompiler();
  void setCCompiler(const QString &) ;

  /** No descriptions */
  bool getCSlb();
  void setCSlb(bool) ;

  /** No descriptions */
  bool getCAsm();
  void setCAsm(bool) ;

  /** No descriptions */
  bool getLinkDebug();
  void setLinkDebug(bool) ;
  
  /** No descriptions */
  bool getLinkMap();
  void setLinkMap(bool) ;
  
  /** No descriptions */
  bool getAsmList();
  void setAsmList(bool) ;
  
  /** No descriptions */
  QString getLibsDir();
  void setLibsDir(const QString &) ;

  /** Linker script file */
  QString getLinkScript();
  void setLinkScript(const QString &) ;
  
  /** No descriptions */
  QString getOtherLinkOptions();
  void setOtherLinkOptions(const QString &) ;

  /** No descriptions */
  QString getOtherCOptions();
  void setOtherCOptions(const QString &) ;

  /** No descriptions */
  QString projectPathFileName();
  /** Compute hex file name from project file name
 */
  QString getHexName();
  /** Compute asm file name from project file name
 */
  QString getAsmName();
  /** true if the project contains  C source file(s).  */
  bool isCproject();
private: // Private attributes

  /** The configuration object which manages the project data */
  KConfig *config;
  /** The name of the .pikprj file */
  QString projectFileName;
public slots: // Public slots
  /** Remove a file from the project */
  void removeFile(const QString& filename);
public slots: // Public slots
  /** Add a new file to this project */
  void addFile(const QString& filename);
  /** Set the version id for this project */
  void setVersion(const QString& id);
  /** Set the type (asm or C) for this project */
  void setType(const QString& t);
  /** Set the output (hex) file for this project */
  void setOutput(const QString& file);
  /** flush the current project to the project file */
  void commit();
  /** restore the current project from project file */
  void restore();

};

#endif
