/*
* px *
Copyright (c) 2008 Shawn Hladky
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
Dumb class to bridge two client user classes.
It allows a command to inherit from the passthrough to intercept
and manipulate messages, but will ultimately passthrough to the
Caller's ClientUser implementation.
*/
class PassthroughClientUser : public ClientUser
{
public:
PassthroughClientUser(ClientUser* cu) { passthroughCU = cu;}
virtual ~PassthroughClientUser() {}
virtual void InputData( StrBuf *strbuf, Error *e )
{passthroughCU->InputData( strbuf, e );}
virtual void HandleError( Error *err )
{passthroughCU->HandleError( err );}
virtual void Message( Error *err )
{passthroughCU->Message( err );}
virtual void OutputError( const char *errBuf )
{passthroughCU->OutputError( errBuf );}
virtual void OutputInfo( char level, const char *data )
{passthroughCU->OutputInfo( level, data );}
virtual void OutputBinary( const char *data, int length )
{passthroughCU->OutputBinary( data, length );}
virtual void OutputText( const char *data, int length )
{passthroughCU->OutputText( data, length );}
virtual void OutputStat( StrDict *varList )
{passthroughCU->OutputStat( varList );}
virtual void Prompt( const StrPtr &msg, StrBuf &rsp, int noEcho, Error *e )
{passthroughCU->Prompt( msg, rsp, noEcho, e );}
virtual void ErrorPause( char *errBuf, Error *e )
{passthroughCU->ErrorPause( errBuf, e );}
virtual void Edit( FileSys *f1, Error *e )
{passthroughCU->Edit( f1, e );}
virtual void Diff( FileSys *f1, FileSys *f2, int doPage, char *diffFlags, Error *e )
{passthroughCU->Diff( f1, f2, doPage, diffFlags, e );}
virtual void Merge( FileSys *base, FileSys *leg1, FileSys *leg2, FileSys *result, Error *e )
{passthroughCU->Merge( base, leg1, leg2, result, e );}
virtual int Resolve( ClientMerge *m, Error *e )
{return passthroughCU->Resolve( m, e );}
virtual void Help( const char *const *help )
{passthroughCU->Help( help );}
virtual FileSys *File( FileSysType type )
{return passthroughCU->File( type );}
virtual void Finished()
{passthroughCU->Finished( );}
virtual void SetOutputCharset( int c )
{passthroughCU->SetOutputCharset( c );}
virtual int OutputError( char *errBuf )
{return passthroughCU->OutputError( errBuf );}
virtual int OutputInfo( char level, char *data )
{return passthroughCU->OutputInfo( level, data );}
virtual int OutputBinary( char *data, int length )
{return passthroughCU->OutputBinary( data, length );}
virtual int OutputText( char *data, int length )
{return passthroughCU->OutputText( data, length );}
virtual int Help( char *const *help )
{return passthroughCU->Help( help );}
protected:
ClientUser* passthroughCU;
};