//## begin module%1.7%.codegen_version preserve=yes // Read the documentation to learn more about C++ code generator // versioning. //## end module%1.7%.codegen_version //## begin module%4209BA4C03B8.cm preserve=no //## end module%4209BA4C03B8.cm //## begin module%4209BA4C03B8.cp preserve=no // C O P Y R I G H T N O T I C E // This material is confidential to ERG and may not be // disclosed in whole // or in part to any third party nor used in any manner // whatsoever other // than for the purposes expressly consented to by ERG in // writing. // // This material is also copyright and may not be // reproduced, stored in a // retrieval system or transmitted in any form or by any // means in whole or // in part without the express written consent of ERG. //## end module%4209BA4C03B8.cp //## Module: UdFileManifest%4209BA4C03B8; Pseudo Package body //## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4 //## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\UdFileManifest.cpp //## begin module%4209BA4C03B8.additionalIncludes preserve=no //## end module%4209BA4C03B8.additionalIncludes //## begin module%4209BA4C03B8.includes preserve=yes #pragma warn -com #include #pragma warn +com //## end module%4209BA4C03B8.includes // UdFileManifest #include "UdFileManifest.h" // TransactionStream #include "TransactionStream.h" //## begin module%4209BA4C03B8.additionalDeclarations preserve=yes #include /** Example UD Manifest file. Lines starting with a # are comments and are ignored. #UD Manifest #0000000101-SY1-903ECU-00000005 /afc/ergdce/var/DCE/ud/drained/CvXK71l0_903ECU.devud /afc/ergdce/var/DCE/ud/drained/CvXLn1Y0_903ECU.devud /afc/ergdce/var/DCE/ud/drained/CvXP49b0_903ECU.devud /afc/ergdce/var/DCE/ud/drained/CvXtDCw0_903ECU.devud /afc/ergdce/var/DCE/ud/drained/CvXtE0U0_903ECU.devud /afc/ergdce/var/DCE/ud/drained/CvnNj8c0_903ECU.devud /afc/ergdce/var/DCE/ud/drained/CvnRVA10_903ECU.devud #total = 7 #end */ //## end module%4209BA4C03B8.additionalDeclarations // Class UdFileManifest //## Operation: UdFileManifest%4209BAA8031C UdFileManifest::UdFileManifest (const std::string &folder, const std::string &prefix, const std::string &suffix, const std::string &pathmapTarget) //## begin UdFileManifest::UdFileManifest%4209BAA8031C.hasinit preserve=no : m_count(0), m_folder(folder), m_pathmapTarget(pathmapTarget), m_prefix(prefix), m_stream(0), m_suffix(suffix) //## end UdFileManifest::UdFileManifest%4209BAA8031C.hasinit //## begin UdFileManifest::UdFileManifest%4209BAA8031C.initialization preserve=yes //## end UdFileManifest::UdFileManifest%4209BAA8031C.initialization { //## begin UdFileManifest::UdFileManifest%4209BAA8031C.body preserve=yes open(); //## end UdFileManifest::UdFileManifest%4209BAA8031C.body } UdFileManifest::~UdFileManifest() { //## begin UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body preserve=yes close(); //## end UdFileManifest::~UdFileManifest%4209BA4C03B8_dest.body } //## Other Operations (implementation) //## Operation: addUdFile%4209BAC703E7 void UdFileManifest::addUdFile (const std::string &file) { //## begin UdFileManifest::addUdFile%4209BAC703E7.body preserve=yes if ( file.length() ) { const bool slash = m_pathmapTarget.find_last_of( "/\\" ) == m_pathmapTarget.length() - 1; const std::string::size_type where = file.find_last_of( "/\\" ); (*m_stream) << m_pathmapTarget; if ( where != std::string::npos ) { if ( !slash ) { (*m_stream) << '/'; } (*m_stream) << file.substr( where + 1 ); } else { if ( !slash ) { (*m_stream) << '/'; } (*m_stream) << file; } (*m_stream) << std::endl; ++m_count; } //## end UdFileManifest::addUdFile%4209BAC703E7.body } //## Operation: close%4209BAC10389 void UdFileManifest::close () { //## begin UdFileManifest::close%4209BAC10389.body preserve=yes if ( m_stream ) { (*m_stream) << "#total = " << m_count << std::endl << "#end" << std::endl; m_stream->close(); delete m_stream; m_stream = 0; } //## end UdFileManifest::close%4209BAC10389.body } //## Operation: open%4209BAC10399 const bool UdFileManifest::open () { //## begin UdFileManifest::open%4209BAC10399.body preserve=yes close(); // Close the stream should it be open. std::string filename; TransactionStream::buildFileName( filename, m_folder, m_prefix, m_suffix, "", 0 ); m_stream = new std::ofstream( filename.c_str(), std::ios_base::out ); if ( m_stream->is_open() ) { (*m_stream) << "#UD Manifest" << std::endl << '#' << std::endl; return ( true ); } // When we can't open the file, then roll back. delete m_stream; m_stream = 0; MERROR( "Cannot open \"" << filename << "\" for writing." ); return ( false ); //## end UdFileManifest::open%4209BAC10399.body } // Additional Declarations //## begin UdFileManifest%4209BA4C03B8.declarations preserve=yes //## end UdFileManifest%4209BA4C03B8.declarations //## begin module%4209BA4C03B8.epilog preserve=yes //## end module%4209BA4C03B8.epilog