ClientUser::InputData( StrBuf *, Error * )
Provide data from stdin to p4 <
command> -i.
|
Virtual? |
Yes |
|
|
Class |
||
|
Arguments |
|
the |
|
|
an |
|
|
Returns |
|
Notes
Any command that edits a specification can take the -i option; this
method supplies the data for the specification. In the default
implementation, the data comes from stdin, but an alternate
implementation can accept the data from any source. This method is the
only way to send a specification to the server without first putting it
into a local file.
Example
The default implementation is called during a normal invocation of
p4 client -i.
p4 client -i < clispec.txt
In this example, clispec.txt is fed to the command as
stdin. Its contents are appended to the StrBuf
that is given as an argument to InputData(), and this
StrBuf is given to the server after InputData()
returns.
To read the data from a different source, create a subclass of
ClientUser with an alternate implementation of InputData().
For example, suppose that you want to be able to edit a client
specification without creating a local temp file. You’ve already written
a function which generates the new client specification and stores it as
a StrBuf variable in your ClientUser subclass.
To send your modified client specification to the server when running
p4 client -i with your modified
ClientUser, implement InputData() to read
data from that StrBuf.
The example below assumes that the subclass MyClientUser
has a variable called mySpec that already contains the valid
client specification before running p4 client -i.
void MyClientUser::InputData( StrBuf *buf, Error *e )
{
buf->Set( mySpec );
}