/******************************************************************************* Copyright (c) 2003, Robert Cowham and Vaccaperna Systems Ltd. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL VACCAPERNA SYSTEMS LTD. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ /******************************************************************************* * Name: p4clientuser.h * * Author: Robert Cowham <robert@vaccaperna.co.uk> * * Description: * COM bindings for the Perforce API. User interface class * for getting Perforce results into COM. * ******************************************************************************/ #if !defined(AFX_p4clientuser_H__C7A92243_2012_4DCA_8EB2_2E73ACA85A30__INCLUDED_) #define AFX_p4clientuser_H__C7A92243_2012_4DCA_8EB2_2E73ACA85A30__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "stdafx.h" #ifndef _P4API_H_ #define _P4API_H_ #ifdef SetPort // Windows bug #undef SetPort #endif // P4 API files #include "PerforceAPI.h" # include "enviro.h" # include "signaler.h" # include "msgclient.h" # include "spec.h" # include "diff.h" #endif // _P4API_H_ #include "StrBufArray.h" #include <string> using std::wstring; class p4ClientUser : public ClientUser { public: p4ClientUser(); virtual ~p4ClientUser(); virtual void Reset(); virtual void HandleError(Error *err); virtual void ErrorPause(char *errBuf, Error *e); virtual void OutputInfo(char level, const char *data); virtual void OutputError(const char *errBuf); virtual void OutputWarning(const char *errBuf); virtual void OutputText(const char *data, int len); virtual void OutputBinary(const char *data, int len); virtual void Diff( FileSys *f1, FileSys *f2, int doPage, char *diffFlags, Error *e ); virtual void Prompt( const StrPtr &msg, StrBuf &rsp, int noEcho, Error *e ); virtual void OutputStat(StrDict *results); virtual void InputData(StrBuf *strbuf, Error *e); virtual BSTR GetVar(LPCSTR varName); virtual int VarExists(LPCSTR varName); virtual void SetVar(LPCSTR varName, BSTR newVal); void SetArrayVar(LPCSTR varName, StrBufArray *newVal); StrBufArray *GetArrayVar(LPCSTR varName); virtual void TranslateCharset(int newVal); virtual int TranslateCharset(); LPCSTR p4ClientUser::TranslateFromBSTR(BSTR bs); LPCSTR p4ClientUser::TranslateFromBSTR(wstring &bs); BSTR p4ClientUser::TranslateToBSTR(StrBuf *sb); StrBufArray *InfoArray() {return m_InfoArray;}; StrBufArray *ErrorArray() {return m_ErrorArray;}; StrBufArray *WarningArray() {return m_WarningArray;}; virtual StrBuf TextFileName() {return m_TextFileName;}; virtual StrBuf BinaryFileName() {return m_BinaryFileName;}; virtual void SetInput(StrBuf *newVal) {m_input.Set(*newVal);}; virtual void CloseFiles(); // closes open files (if there were any) protected: int m_TranslateCharset; private: SpecDataTable *m_specData; Spec *m_spec; StrBuf m_input; // Buffers for translations LPSTR m_tranbuf; StrBuf m_buf; // Arrays used to return text strings to VB functions StrBufArray *m_ErrorArray; StrBufArray *m_InfoArray; StrBufArray *m_WarningArray; // These are pointers to temporary files used by OutputText and OutputBinary StrBuf m_BinaryFileName; FileSys *m_BinaryFile; StrBuf m_TextFileName; FileSys *m_TextFile; void OutputData(FileSys ** OutFile, StrBuf& FileName, enum FileSysType FType, const char *data, int len); void AddToArray(const char *data, int len, StrBufArray *sba); void OutputDict(StrDict *dict); }; #endif // !defined(AFX_p4clientuser_H__C7A92243_2012_4DCA_8EB2_2E73ACA85A30__INCLUDED_)
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#7 | 7443 | Robert Cowham | Update for new API outputstat. | ||
#6 | 6050 | Robert Cowham |
- Use P4API 2007.2 - Added SetProg, SetVersion, SetProtocol and GetProtocol |
||
#5 | 5194 | Robert Cowham |
Changes (2005.1.0.0) Added Dropped() to detect dropped connections Added Input property to provide input e.g. for passwords Added FormatDateTime() as a convenience for calling C Runtime function (for VB use) Imported changes from p4ofc which made it more reliable. |
||
#4 | 4242 | Robert Cowham |
Fixed some String leaks. Fixed problem with writing to temporary files. Updated p4API to released version of 2003.2. Start of Delphi example. |
||
#3 | 4182 | Robert Cowham | Release 1.0.0.4 - put output of Diff in normal output array. | ||
#2 | 3614 | Robert Cowham | Fixed memory leak and hanging over of variables when using forms. | ||
#1 | 3525 | Robert Cowham | Initial release |