MapApi::Join( MapApi *, MapApi * ) [static]
Joins two MapApi
s together to produce a combined
mapping.
Virtual? |
No |
|
Class |
||
Arguments |
|
the first mapping |
|
the second mapping |
|
Returns |
|
a new MapApi representing the joined maps |
Notes
This overload of Join()
links the right side of the first mapping to the left side of the second
mapping, as if the two mappings were laid out left to right and glued
together in the middle. The resulting MapApi
's left side
corresponds to the first mapping’s left side, and its right side
corresponds to the second mapping’s right side.
If the right side of the first mapping does not have anything in common with the left side of the second mapping, the resulting map is empty.
The other Join()
overload
allows more control over which side of each mapping is joined to the
other, and the direction of the resulting mapping.
This function allocates a new MapApi
object on the heap;
the caller is responsible for deleting it.
Example
The following example demonstrates a join between a branch view and a client view.
MapApi branchmap; branchmap.Insert( StrRef( "//depot/main/..." ), StrRef( "//depot/rel1/...") ); MapApi clientmap; clientmap.Insert( StrRef( "//depot/..." ), StrRef( "//client/depot/..." ) ); MapApi *branch_to_client = MapApi::Join( &branchmap, &clientmap ); StrBuf source( "//depot/main/file.c" ); StrBuf target; branch_to_client->Translate( source, target ); printf( "%s -> %s\n", source.Text(), target.Text() ); delete branch_to_client;
This produces the following output:
//depot/main/file.c -> //client/depot/rel1/file.c