MapApi::Insert( const StrPtr &, MapType )

Adds a new entry to the mapping.

Virtual?

No

 

Class

MapApi

Arguments

StrPtr & lr

the path to which the entry applies

 

MapType t

the mapping type (by default, MapInclude)

Returns

Notes

This Insert() overload is a convenience function that adds an entry with identical left and right sides. It is meant to represent mappings whose sole purpose is to include and exclude files, such as protection tables and label views.

Example

The following example demonstrates the construction and use of a protection table mapping.

MapApi protect;
protect.Insert( StrRef( "//..." ) );
protect.Insert( StrRef( "//private/..." ), MapExclude );

StrBuf to;
StrBuf file1( "//depot/file.txt" );
StrBuf file2( "//private/file.txt" );

printf( "%s - access %d\n", file1.Text(), protect.Translate( file1, to ) );

printf( "%s - access %d\n", file2.Text(), protect.Translate( file2, to ) );

This produces the following output:

//depot/file.txt - access 1
//private/file.txt - access 0