/*
 *=======================================================================================
 * Name        :Vss5_Fct.h
 *
 * Author      :Vincent lhullier             Date :15/04/97
 *
 * Description : header file for OLE function using Vss5
 *=======================================================================================
 * Modification -> Author :                  Date :
 * Description :
 *=======================================================================================
 */

#ifndef __VSS5_FCT_H__
#define __VSS5_FCT_H__

#include "ssapi.h"
#include "Tree_Fct.h"

 
 /*
 *=======================================================================================
 * CONSTANTS
 *=======================================================================================
 */
#define VSSITEM_PROJECT			0
#define VSSITEM_FILE			1

#define C_cSearchForProject		1
#define C_cSearchForFile		2
#define C_cSearchForAll			3

#define VSSFILE_ERROR			-1
#define VSSFILE_NOTCHECKEDOUT	0
#define VSSFILE_CHECKEDOUT		1
#define VSSFILE_CHECKEDOUT_ME	2
#define VSSFILE_NOTFOUND		3


#define VSSFLAG_USERRONO			1
#define VSSFLAG_USERROYES			2
#define VSSFLAG_TIMENOW				4
#define VSSFLAG_TIMEMOD				8
#define VSSFLAG_TIMEUPD				12
#define VSSFLAG_EOLCR				16
#define VSSFLAG_EOLLF				32
#define VSSFLAG_EOLCRLF				48
#define VSSFLAG_REPASK				64
#define VSSFLAG_REPREPLACE			128
#define VSSFLAG_REPSKIP				192
#define VSSFLAG_REPMERGE			256
#define VSSFLAG_CMPFULL				512
#define VSSFLAG_CMPTIME				1024
#define VSSFLAG_CMPCHKSUM			1536
#define VSSFLAG_CMPFAIL				2048
#define VSSFLAG_RECURSNO			4096
#define VSSFLAG_RECURSYES			8192
#define VSSFLAG_FORCEDIRNO			16384
#define VSSFLAG_FORCEDIRYES			32768
#define VSSFLAG_KEEPNO				65536
#define VSSFLAG_KEEPYES				131072
#define VSSFLAG_DELNO				262144
#define VSSFLAG_DELYES				524288
#define VSSFLAG_DELNOREPLACE		786432
#define VSSFLAG_BINTEST				1048576
#define VSSFLAG_BINBINARY			2097152
#define VSSFLAG_BINTEXT				3145728
#define VSSFLAG_DELTAYES			4194304
#define VSSFLAG_DELTANO				8388608
#define VSSFLAG_UPDASK				16777216
#define VSSFLAG_UPDUPDATE			33554432
#define VSSFLAG_UPDUNCH				50331648
#define VSSFLAG_GETYES				67108864
#define VSSFLAG_GETNO				134217728
#define VSSFLAG_CHKEXCLUSIVEYES		268435456
#define VSSFLAG_CHKEXCLUSIVENO		536870912
#define VSSFLAG_HISTIGNOREFILES		1073741824

#define C_Vss_cUpdateError			0
#define C_Vss_cUpdateAdd			1
#define C_Vss_cUpdateModify			2
#define C_Vss_cUpdateNothing		3

/*
 *=======================================================================================
 * GLOBALS
 * I put this in extern but try to not use it outside vss5_fct module
 *=======================================================================================
 */
extern IVSSDatabase	OLE_g_oDatabase; 

extern char			g_cNbUsers;
extern char			g_a_szUserName[10][20];

/*
 *=======================================================================================
 * FUNCTIONS
 *=======================================================================================
 */

void fn_vTransformSpec				( char *_szSpec );

BOOL OLE_fn_bGetItemContent			( IVSSItem *_p_oItem, IVSSItems *_p_oContent );
BOOL OLE_fn_bGetContentItem			( IVSSItems *_p_oContent, int iItem, IVSSItem *_p_oItem );
BOOL OLE_fn_bGetLocalItem			( char *_szSpec, IVSSItem *_p_oItem, IVSSItem *_p_oLocalItem, char _cType = C_cSearchForAll );
BOOL OLE_fn_bDoesLocalItemExist		( char *_szSpec, IVSSItem *_p_oItem, char _cType = C_cSearchForAll );
BOOL OLE_fn_bGetLocalFile			( char *_szFileSpec, IVSSItem *_p_oItem, IVSSItem *_p_oLocalItem );
BOOL OLE_fn_bGetLocalProject		( char *_szProjectSpec, IVSSItem *_p_oItem, IVSSItem *_p_oLocalItem );
BOOL OLE_fn_bDoesLocalFileExist		( char *_szFileSpec, IVSSItem *_p_oItem );
BOOL OLE_fn_bDoesLocalProjectExist	( char *_szProjectSpec, IVSSItem *_p_oItem );
BOOL OLE_fn_bGetRootProject			(IVSSItem *_p_oItem );
BOOL OLE_fn_bGetExistantItem		( char *_szSpec, IVSSItem *_p_oItem );


BOOL OLE_fn_bDoesProjectExist		( char *_szProjSpec, IVSSItem *_p_oVssItem );
BOOL OLE_fn_bCreateVssProject		( char *_szProjSpec );
BOOL OLE_fn_bAddFile				( char *_szInProj, char *_szLocalFile );
BOOL OLE_fn_bCheckoutFile			( char *_szFileSpec, char *_szLocalFile, int iFlags );
BOOL OLE_fn_bUndoCheckoutFile		( char *_szFileSpec, char *_szLocalFile, int _iFlags );
BOOL OLE_fn_bCheckinFile			( char *_szFileSpec, char *_szLocalFile, int iFlags );
BOOL OLE_fn_bGetFile				( char *_szSpec, char *_szLocalPath, int _iFlags, BOOL _bFile, BOOL *_bObtained );
char OLE_fn_cUpdateFile				( char *_szSpec, char *_szLocalName );
BOOL OLE_fn_bDeleteFile				( char *_szSpec );
BOOL OLE_fn_bDestroyFile			( char *_szSpec );

BOOL OLE_fn_bGetItemLastVersion		( char *_szFileSpec, IVSSVersion *_p_oVersion );
BOOL OLE_fn_bGetItemLastVersionDate	( char *_szFileSpec, COleDateTime *p_oOleDate );
BOOL OLE_fn_bGetItemLastVersionUserName( char *_szFileSpec );

/*
 ----------------------------------------------------------------------------------------
  Description   : initialize vss database
  Returns (BOOL) TRUE if success, FALSE otherwise
 ----------------------------------------------------------------------------------------
 */
BOOL OLE_fn_bInitVss( void );

/*
 ----------------------------------------------------------------------------------------
  Description   : open vss database
  _szIniFile		-> name of initialisation file (with full path)
  Returns (BOOL) : TRUE if success, FALSE otherwise
 ----------------------------------------------------------------------------------------
 */
BOOL OLE_fn_bOpenVss( char *_szVssDatabase, char *_szUserName, char *_szPassword );
BOOL OLE_fn_bVssLogin( CWnd *p_oFather );

/*
 ----------------------------------------------------------------------------------------
  Description   : get content of vss project
  _p_stVssProj        -> project to fill
  _szProjSpec         -> name of vss project
  _bOnlyProject       -> if TRUE get only project else get files and project
  Returns (BOOL) TRUE if sucess
 ----------------------------------------------------------------------------------------
 */
BOOL OLE_fn_bGetVssProjectContent( IVSSItem *_p_oVssItem, tdstProject *_p_stVssProj, BOOL _bOnlyProject, BOOL _bRecurse );

/*
 ----------------------------------------------------------------------------------------
  Description   : get project tree from vss
  _bOnlyProject        -> if TRUE get only project name else get project and file
  Returns (BOOL ) TRUE if success, FALSE otherwise
 ----------------------------------------------------------------------------------------
 */
BOOL OLE_fn_bGetVssProjectTree( BOOL _bOnlyProject, HWND _hProjectWindow );

/*
 ----------------------------------------------------------------------------------------
  Description   : refresh given vss project
  _szSpec             -> name of project
  _bRecurse           -> TRUE if refresh recursively
  _hProjectWindow     -> window were to put current project name
  Returns (BOOL ) TRUE if refresh success, FALSE else
 ----------------------------------------------------------------------------------------
 */
BOOL fn_bRefreshVssProjectTree( char *_szSpec, BOOL _bRecurse, HWND _hProjectWindow );


/*
 ----------------------------------------------------------------------------------------
  Description   : Get file status
  _szFileSpec         -> name of file
  Returns (char ) status of file
 ----------------------------------------------------------------------------------------
 */
char OLE_fn_cGetVssFileStatus( char *_szFileSpec );


#endif /*__VSS5_FCT_H__*/