Ignore::RejectCheck( const StrPtr & )

Tests whether the provided path will be rejected when it is opened for add because it matches an ignore file entry.

Virtual?

No

 

Class

Ignore

 

Arguments

cont StrPtr &path

the path to check

Returns

int

nonzero if path is ignored

Notes

Calling RejectCheck(). provides a preview of what will happen the file is opened for add.

Use RejectCheck() when you have to test multiple paths that may be rejected. First call Reject() to parse the ignore file, and then call RejectCheck() for each additional path that needs to be checked.

Example

The following example demonstrates the usage of RejectCheck().

# include "clientapi.h"
# include "ignore.h"

int main()
{
    ClientApi client;
    StrBuf clientPath;

    client.SetIgnoreFile( ".p4ignore" );
    clientPath = "ignore.txt";
    if ( client->GetIgnore()->Reject( *clientPath,
                                      client->GetIgnoreFile() ) )
    {
        printf( "%s is to be ignored.\n", clientPath.Text() );
    }

    clientPath = "ignore2.txt";
    if ( client->GetIgnore()->Reject( *clientPath,
                                      client->GetIgnoreFile() ) )
    {
        printf( "%s is to be ignored.\n", clientPath.Text() );
    }
}