| 2218 |
sbetterm |
1 |
//## begin module%1.7%.codegen_version preserve=yes
|
|
|
2 |
// Read the documentation to learn more about C++ code generator
|
|
|
3 |
// versioning.
|
|
|
4 |
//## end module%1.7%.codegen_version
|
|
|
5 |
|
|
|
6 |
//## begin module%4209BA4C03B8.cm preserve=no
|
|
|
7 |
//## end module%4209BA4C03B8.cm
|
|
|
8 |
|
|
|
9 |
//## begin module%4209BA4C03B8.cp preserve=no
|
|
|
10 |
// C O P Y R I G H T N O T I C E
|
| 2226 |
sbetterm |
11 |
// This material is confidential to ERG and may not be
|
|
|
12 |
// disclosed in whole
|
|
|
13 |
// or in part to any third party nor used in any manner
|
|
|
14 |
// whatsoever other
|
|
|
15 |
// than for the purposes expressly consented to by ERG in
|
|
|
16 |
// writing.
|
| 2218 |
sbetterm |
17 |
//
|
| 2226 |
sbetterm |
18 |
// This material is also copyright and may not be
|
|
|
19 |
// reproduced, stored in a
|
|
|
20 |
// retrieval system or transmitted in any form or by any
|
|
|
21 |
// means in whole or
|
| 2218 |
sbetterm |
22 |
// in part without the express written consent of ERG.
|
|
|
23 |
//## end module%4209BA4C03B8.cp
|
|
|
24 |
|
|
|
25 |
//## Module: UdFileManifest%4209BA4C03B8; Pseudo Package body
|
|
|
26 |
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
|
|
|
27 |
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\UdFileManifest.cpp
|
|
|
28 |
|
|
|
29 |
//## begin module%4209BA4C03B8.additionalIncludes preserve=no
|
|
|
30 |
//## end module%4209BA4C03B8.additionalIncludes
|
|
|
31 |
|
|
|
32 |
//## begin module%4209BA4C03B8.includes preserve=yes
|
|
|
33 |
#pragma warn -com
|
|
|
34 |
#include <LoggingMacros.h>
|
|
|
35 |
#pragma warn +com
|
|
|
36 |
//## end module%4209BA4C03B8.includes
|
|
|
37 |
|
| 2226 |
sbetterm |
38 |
// UdFileManifest
|
|
|
39 |
#include "UdFileManifest.h"
|
| 2218 |
sbetterm |
40 |
// TransactionStream
|
|
|
41 |
#include "TransactionStream.h"
|
|
|
42 |
//## begin module%4209BA4C03B8.additionalDeclarations preserve=yes
|
|
|
43 |
|
| 2222 |
sbetterm |
44 |
#include <ctype>
|
| 2218 |
sbetterm |
45 |
/**
|
|
|
46 |
Example UD Manifest file. Lines starting with a # are comments and are
|
|
|
47 |
ignored.
|
| 2222 |
sbetterm |
48 |
|
| 2218 |
sbetterm |
49 |
#UD Manifest
|
|
|
50 |
#0000000101-SY1-903ECU-00000005
|
|
|
51 |
/afc/ergdce/var/DCE/ud/drained/CvXK71l0_903ECU.devud
|
|
|
52 |
/afc/ergdce/var/DCE/ud/drained/CvXLn1Y0_903ECU.devud
|
|
|
53 |
/afc/ergdce/var/DCE/ud/drained/CvXP49b0_903ECU.devud
|
|
|
54 |
/afc/ergdce/var/DCE/ud/drained/CvXtDCw0_903ECU.devud
|
|
|
55 |
/afc/ergdce/var/DCE/ud/drained/CvXtE0U0_903ECU.devud
|
|
|
56 |
/afc/ergdce/var/DCE/ud/drained/CvnNj8c0_903ECU.devud
|
|
|
57 |
/afc/ergdce/var/DCE/ud/drained/CvnRVA10_903ECU.devud
|
|
|
58 |
#total = 7
|
|
|
59 |
#end
|
|
|
60 |
*/
|
|
|
61 |
//## end module%4209BA4C03B8.additionalDeclarations
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
// Class UdFileManifest
|
|
|
65 |
|
|
|
66 |
//## Operation: UdFileManifest%4209BAA8031C
|
| 2226 |
sbetterm |
67 |
UdFileManifest::UdFileManifest (const std::string &folder, const std::string &prefix, const std::string &suffix, const std::string &pathmapTarget)
|
| 2218 |
sbetterm |
68 |
//## begin UdFileManifest::UdFileManifest%4209BAA8031C.hasinit preserve=no
|
|
|
69 |
: m_count(0),
|
|
|
70 |
m_folder(folder),
|
| 2226 |
sbetterm |
71 |
m_pathmapTarget(pathmapTarget),
|
| 2218 |
sbetterm |
72 |
m_prefix(prefix),
|
|
|
73 |
m_stream(0),
|
|
|
74 |
m_suffix(suffix)
|
|
|
75 |
//## end UdFileManifest::UdFileManifest%4209BAA8031C.hasinit
|
|
|
76 |
//## begin UdFileManifest::UdFileManifest%4209BAA8031C.initialization preserve=yes
|
|
|
77 |
//## end UdFileManifest::UdFileManifest%4209BAA8031C.initialization
|
|
|
78 |
{
|
|
|
79 |
//## begin UdFileManifest::UdFileManifest%4209BAA8031C.body preserve=yes
|
|
|
80 |
|
|
|
81 |
open();
|
|
|
82 |
|
|
|
83 |
//## end UdFileManifest::UdFileManifest%4209BAA8031C.body
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
UdFileManifest::~UdFileManifest()
|
|
|
88 |
{
|
|
|
89 |
//## begin UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body preserve=yes
|
|
|
90 |
|
|
|
91 |
close();
|
|
|
92 |
|
|
|
93 |
//## end UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body
|
|
|
94 |
}
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
//## Other Operations (implementation)
|
|
|
99 |
//## Operation: addUdFile%4209BAC703E7
|
|
|
100 |
void UdFileManifest::addUdFile (const std::string &file)
|
|
|
101 |
{
|
|
|
102 |
//## begin UdFileManifest::addUdFile%4209BAC703E7.body preserve=yes
|
|
|
103 |
|
| 2226 |
sbetterm |
104 |
if ( file.length() )
|
|
|
105 |
{
|
|
|
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( "/\\" );
|
| 2222 |
sbetterm |
110 |
|
| 2226 |
sbetterm |
111 |
(*m_stream) << m_pathmapTarget;
|
|
|
112 |
if ( where != std::string::npos )
|
| 2222 |
sbetterm |
113 |
{
|
| 2226 |
sbetterm |
114 |
if ( !slash )
|
|
|
115 |
{
|
|
|
116 |
(*m_stream) << '/';
|
|
|
117 |
}
|
|
|
118 |
(*m_stream) << file.substr( where + 1 );
|
| 2222 |
sbetterm |
119 |
}
|
|
|
120 |
else
|
|
|
121 |
{
|
| 2226 |
sbetterm |
122 |
if ( !slash )
|
|
|
123 |
{
|
|
|
124 |
(*m_stream) << '/';
|
|
|
125 |
}
|
|
|
126 |
(*m_stream) << file;
|
| 2222 |
sbetterm |
127 |
}
|
| 2226 |
sbetterm |
128 |
(*m_stream) << std::endl;
|
| 2218 |
sbetterm |
129 |
++m_count;
|
|
|
130 |
}
|
|
|
131 |
|
|
|
132 |
//## end UdFileManifest::addUdFile%4209BAC703E7.body
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
//## Operation: close%4209BAC10389
|
|
|
136 |
void UdFileManifest::close ()
|
|
|
137 |
{
|
|
|
138 |
//## begin UdFileManifest::close%4209BAC10389.body preserve=yes
|
|
|
139 |
|
|
|
140 |
if ( m_stream )
|
|
|
141 |
{
|
|
|
142 |
(*m_stream)
|
|
|
143 |
<< "#total = " << m_count << std::endl
|
|
|
144 |
<< "#end" << std::endl;
|
|
|
145 |
|
|
|
146 |
m_stream->close();
|
|
|
147 |
|
|
|
148 |
delete m_stream;
|
|
|
149 |
m_stream = 0;
|
|
|
150 |
}
|
|
|
151 |
|
|
|
152 |
//## end UdFileManifest::close%4209BAC10389.body
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
//## Operation: open%4209BAC10399
|
|
|
156 |
const bool UdFileManifest::open ()
|
|
|
157 |
{
|
|
|
158 |
//## begin UdFileManifest::open%4209BAC10399.body preserve=yes
|
|
|
159 |
|
|
|
160 |
close(); // Close the stream should it be open.
|
|
|
161 |
|
|
|
162 |
std::string filename;
|
|
|
163 |
TransactionStream::buildFileName(
|
|
|
164 |
filename,
|
|
|
165 |
m_folder,
|
|
|
166 |
m_prefix,
|
|
|
167 |
m_suffix,
|
|
|
168 |
"",
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
m_stream = new std::ofstream(
|
|
|
172 |
filename.c_str(),
|
|
|
173 |
std::ios_base::out );
|
|
|
174 |
if ( m_stream->is_open() )
|
|
|
175 |
{
|
|
|
176 |
(*m_stream)
|
|
|
177 |
<< "#UD Manifest" << std::endl
|
|
|
178 |
<< '#' << std::endl;
|
|
|
179 |
|
|
|
180 |
return ( true );
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
// When we can't open the file, then roll back.
|
|
|
184 |
delete m_stream;
|
|
|
185 |
m_stream = 0;
|
|
|
186 |
|
|
|
187 |
MERROR( "Cannot open \"" << filename << "\" for writing." );
|
|
|
188 |
return ( false );
|
|
|
189 |
|
|
|
190 |
//## end UdFileManifest::open%4209BAC10399.body
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
// Additional Declarations
|
|
|
194 |
//## begin UdFileManifest%4209BA4C03B8.declarations preserve=yes
|
|
|
195 |
//## end UdFileManifest%4209BA4C03B8.declarations
|
|
|
196 |
|
|
|
197 |
//## begin module%4209BA4C03B8.epilog preserve=yes
|
|
|
198 |
//## end module%4209BA4C03B8.epilog
|