Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

C/C++ API Documentation | 2025.1

# ClientUser - I/O for P4 Server commands

The `ClientUser` class is used for all client-side input and output. This class implements methods that return output from the server to the user after a command is invoked, and gather input from the user when needed.

Member functions in this class are used to format and display server output, invoke external programs (such as text editors, diff tools, and merge tools), gather input for processing by the server, and to handle errors.

Customized functionality in a P4 Server application is most typically implemented by subclassing `ClientUser`. To enable such customization, nearly all of `ClientUser`'s methods are virtual. The default implementations are used in the `p4` command-line client.

## Subscribing to progress notifications

For the P4API to subscribe to notifications, the `ClientUser` class must be subclassed and several methods implemented:

Copy

    class ClientUser {
    public:
    ---snip---
        virtual ClientProgress *CreateProgress( int, P4INT64 );
        virtual ClientProgress *CreateProgress( int );
        virtual int ProgressIndicator();
        virtual int CanParallelProgress() { return 0; }
    ---snip---
    };

ClientUser::ProgressIndicator() must return `1` to subscribe to server-side progress notification.This doesn’t affect client-side notifications.

`ClientUser::CanParallelProgress()` must return `1` to subscribe to process notifications from child threads during parallel sync/submit/shelve/unshelve. If this feature is enabled, the `ClientProgress` notifications must be handled in a thread-safe manner because the callbacks will be called from the child threads as well as the main thread. This only applies to P4APIs built with threading support.

`ClientUser::CreateProgress( int, P4INT64 )` and `ClientUser::CreateProgress( int )` must return the new `ClientProgress` object.

`ClientUser::CreateProgress( int, P4INT64 )` is typically used by client-side file transfer callbacks. The `P4INT64` parameter is the total size of the file, which is used to decide if a progress notification is worth the overhead. If not implemented, the default behavior is to skip progress notifications if the size is less that `1024` bytes and call `ClientUser::CreateProgress( int )`.

The type parameter passed to both of these methods can influence whether the progress notification is of interest or how it should be handled.

These methods should return either `NULL` or a subclass of `ClientProgress`.

See also ClientProgress - progress indicators for P4 Server commands and ClientSSO - P4LOGINSSO behavior.

Your search for returned results