Subversion Repositories DevTools

Rev

Rev 2222 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2222 Rev 2226
Line 6... Line 6...
6
//## begin module%4209BA4C03B8.cm preserve=no
6
//## begin module%4209BA4C03B8.cm preserve=no
7
//## end module%4209BA4C03B8.cm
7
//## end module%4209BA4C03B8.cm
8
 
8
 
9
//## begin module%4209BA4C03B8.cp preserve=no
9
//## begin module%4209BA4C03B8.cp preserve=no
10
//	C O P Y R I G H T   N O T I C E
10
//	C O P Y R I G H T   N O T I C E
11
//	This material is confidential to ERG and may not be disclosed in whole
11
//	This material is confidential to ERG and may not be
-
 
12
//	disclosed in whole
12
//	or in part to any third party nor used in any manner whatsoever other
13
//	or in part to any third party nor used in any manner
-
 
14
//	whatsoever other
13
//	than for the purposes expressly consented to by ERG in writing.
15
//	than for the purposes expressly consented to by ERG in
-
 
16
//	writing.
14
//
17
//
15
//	This material is also copyright and may not be reproduced, stored in a
18
//	This material is also copyright and may not be
-
 
19
//	reproduced, stored in a
16
//	retrieval system or transmitted in any form or by any means in whole or
20
//	retrieval system or transmitted in any form or by any
-
 
21
//	means in whole or
17
//	in part without the express written consent of ERG.
22
//	in part without the express written consent of ERG.
18
//## end module%4209BA4C03B8.cp
23
//## end module%4209BA4C03B8.cp
19
 
24
 
20
//## Module: UdFileManifest%4209BA4C03B8; Pseudo Package body
25
//## Module: UdFileManifest%4209BA4C03B8; Pseudo Package body
21
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
26
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
Line 28... Line 33...
28
#pragma warn -com
33
#pragma warn -com
29
#include <LoggingMacros.h>
34
#include <LoggingMacros.h>
30
#pragma warn +com
35
#pragma warn +com
31
//## end module%4209BA4C03B8.includes
36
//## end module%4209BA4C03B8.includes
32
 
37
 
33
// TransactionStream
-
 
34
#include "TransactionStream.h"
-
 
35
// UdFileManifest
38
// UdFileManifest
36
#include "UdFileManifest.h"
39
#include "UdFileManifest.h"
-
 
40
// TransactionStream
-
 
41
#include "TransactionStream.h"
37
//## begin module%4209BA4C03B8.additionalDeclarations preserve=yes
42
//## begin module%4209BA4C03B8.additionalDeclarations preserve=yes
38
 
43
 
39
#include <ctype>
44
#include <ctype>
40
/**
45
/**
41
	Example UD Manifest file.  Lines starting with a # are comments and are
46
	Example UD Manifest file.  Lines starting with a # are comments and are
Line 57... Line 62...
57
 
62
 
58
 
63
 
59
// Class UdFileManifest 
64
// Class UdFileManifest 
60
 
65
 
61
//## Operation: UdFileManifest%4209BAA8031C
66
//## Operation: UdFileManifest%4209BAA8031C
62
UdFileManifest::UdFileManifest (const std::string &folder, const std::string &prefix, const std::string &suffix)
67
UdFileManifest::UdFileManifest (const std::string &folder, const std::string &prefix, const std::string &suffix, const std::string &pathmapTarget)
63
  //## begin UdFileManifest::UdFileManifest%4209BAA8031C.hasinit preserve=no
68
  //## begin UdFileManifest::UdFileManifest%4209BAA8031C.hasinit preserve=no
64
      : m_count(0),
69
      : m_count(0),
65
        m_folder(folder),
70
        m_folder(folder),
-
 
71
		m_pathmapTarget(pathmapTarget),
66
        m_prefix(prefix),
72
        m_prefix(prefix),
67
        m_stream(0),
73
        m_stream(0),
68
        m_suffix(suffix)
74
        m_suffix(suffix)
69
  //## end UdFileManifest::UdFileManifest%4209BAA8031C.hasinit
75
  //## end UdFileManifest::UdFileManifest%4209BAA8031C.hasinit
70
  //## begin UdFileManifest::UdFileManifest%4209BAA8031C.initialization preserve=yes
76
  //## begin UdFileManifest::UdFileManifest%4209BAA8031C.initialization preserve=yes
Line 93... Line 99...
93
//## Operation: addUdFile%4209BAC703E7
99
//## Operation: addUdFile%4209BAC703E7
94
void UdFileManifest::addUdFile (const std::string &file)
100
void UdFileManifest::addUdFile (const std::string &file)
95
{
101
{
96
  //## begin UdFileManifest::addUdFile%4209BAC703E7.body preserve=yes
102
  //## begin UdFileManifest::addUdFile%4209BAC703E7.body preserve=yes
97
 
103
 
98
	// TODO: specify a pathmap to replace the filepath.  For now, we just strip
-
 
99
	// any drive specification an cannonise the path.
-
 
100
 
-
 
101
	std::string cannonised;
-
 
102
	char const * p = const_cast< char * >( file.c_str() );
-
 
103
 
-
 
104
	// check if drive letter at start of filename
-
 
105
	if ( file.length() >= 3
104
	if ( file.length() )
106
			&& isalpha( file[ 0 ] ) != 0			// a-z or A-Z
-
 
107
			&& file[ 1 ] == ':' )					// :
-
 
108
	{
105
	{
109
		p += 2;
106
		const bool slash
-
 
107
			= m_pathmapTarget.find_last_of( "/\\" )
-
 
108
				== m_pathmapTarget.length() - 1;
-
 
109
		const std::string::size_type where = file.find_last_of( "/\\" );
110
	}
110
 
111
	while ( *p )
111
		(*m_stream) << m_pathmapTarget;
112
	{
-
 
113
		if ( *p != '\\' )
112
		if ( where != std::string::npos )
114
		{
113
		{
-
 
114
			if ( !slash )
-
 
115
			{
115
			cannonised += *p;
116
				(*m_stream) << '/';
-
 
117
			}
-
 
118
			(*m_stream) << file.substr( where + 1 );
116
		}
119
		}
117
		else
120
		else
118
		{
121
		{
-
 
122
			if ( !slash )
-
 
123
			{
119
			cannonised += '/';
124
				(*m_stream) << '/';
-
 
125
			}
-
 
126
			(*m_stream) << file;
120
		}
127
		}
121
		++p;
-
 
122
	}
-
 
123
 
-
 
124
	if ( cannonised.length() )
-
 
125
	{
-
 
126
		(*m_stream) << cannonised << std::endl;
128
		(*m_stream) << std::endl;
127
		++m_count;
129
		++m_count;
128
	}
130
	}
129
 
131
 
130
  //## end UdFileManifest::addUdFile%4209BAC703E7.body
132
  //## end UdFileManifest::addUdFile%4209BAC703E7.body
131
}
133
}