| 2263 |
kivins |
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%41FDA5210143.cm preserve=no
|
|
|
7 |
//## end module%41FDA5210143.cm
|
|
|
8 |
|
|
|
9 |
//## begin module%41FDA5210143.cp preserve=no
|
|
|
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
|
|
|
12 |
// or in part to any third party nor used in any manner whatsoever other
|
|
|
13 |
// than for the purposes expressly consented to by ERG in writing.
|
|
|
14 |
//
|
|
|
15 |
// This material is also copyright and may not be reproduced, stored in a
|
|
|
16 |
// retrieval system or transmitted in any form or by any means in whole or
|
|
|
17 |
// in part without the express written consent of ERG.
|
|
|
18 |
//## end module%41FDA5210143.cp
|
|
|
19 |
|
|
|
20 |
//## Module: TransactionFieldTemplate%41FDA5210143; Pseudo Package body
|
|
|
21 |
//## Subsystem: MASS::Dev::Tools::TxnTestManager::src%41F5A79001E4
|
|
|
22 |
//## Source file: Z:\MASS_Dev\Tools\TxnTestManager\src\TransactionFieldTemplate.cpp
|
|
|
23 |
|
|
|
24 |
//## begin module%41FDA5210143.additionalIncludes preserve=no
|
|
|
25 |
//## end module%41FDA5210143.additionalIncludes
|
|
|
26 |
|
|
|
27 |
//## begin module%41FDA5210143.includes preserve=yes
|
|
|
28 |
#pragma warn -com
|
|
|
29 |
#include <LoggingMacros.h>
|
|
|
30 |
#pragma warn +com
|
|
|
31 |
//## end module%41FDA5210143.includes
|
|
|
32 |
|
|
|
33 |
// TransactionFieldTemplate
|
|
|
34 |
#include "TransactionFieldTemplate.h"
|
|
|
35 |
//## begin module%41FDA5210143.additionalDeclarations preserve=yes
|
|
|
36 |
//## end module%41FDA5210143.additionalDeclarations
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
// Class TransactionFieldTemplate
|
|
|
40 |
|
|
|
41 |
//## Operation: TransactionFieldTemplate%41FF0D770177
|
|
|
42 |
TransactionFieldTemplate::TransactionFieldTemplate (const std::string ®ularExpression)
|
|
|
43 |
//## begin TransactionFieldTemplate::TransactionFieldTemplate%41FF0D770177.hasinit preserve=no
|
|
|
44 |
: m_compiledRegularExpression(0)
|
|
|
45 |
//## end TransactionFieldTemplate::TransactionFieldTemplate%41FF0D770177.hasinit
|
|
|
46 |
//## begin TransactionFieldTemplate::TransactionFieldTemplate%41FF0D770177.initialization preserve=yes
|
|
|
47 |
|
|
|
48 |
, m_regularExpression( regularExpression )
|
|
|
49 |
|
|
|
50 |
//## end TransactionFieldTemplate::TransactionFieldTemplate%41FF0D770177.initialization
|
|
|
51 |
{
|
|
|
52 |
//## begin TransactionFieldTemplate::TransactionFieldTemplate%41FF0D770177.body preserve=yes
|
|
|
53 |
//## end TransactionFieldTemplate::TransactionFieldTemplate%41FF0D770177.body
|
|
|
54 |
}
|
|
|
55 |
|
|
|
56 |
//## Operation: TransactionFieldTemplate%41FF272F013A
|
|
|
57 |
TransactionFieldTemplate::TransactionFieldTemplate (const std::string ®ularExpression, const std::string &value)
|
|
|
58 |
//## begin TransactionFieldTemplate::TransactionFieldTemplate%41FF272F013A.hasinit preserve=no
|
|
|
59 |
: m_compiledRegularExpression(0)
|
|
|
60 |
//## end TransactionFieldTemplate::TransactionFieldTemplate%41FF272F013A.hasinit
|
|
|
61 |
//## begin TransactionFieldTemplate::TransactionFieldTemplate%41FF272F013A.initialization preserve=yes
|
|
|
62 |
|
|
|
63 |
, m_regularExpression( regularExpression ),
|
|
|
64 |
m_value( value )
|
|
|
65 |
|
|
|
66 |
//## end TransactionFieldTemplate::TransactionFieldTemplate%41FF272F013A.initialization
|
|
|
67 |
{
|
|
|
68 |
//## begin TransactionFieldTemplate::TransactionFieldTemplate%41FF272F013A.body preserve=yes
|
|
|
69 |
//## end TransactionFieldTemplate::TransactionFieldTemplate%41FF272F013A.body
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
|
|
|
73 |
TransactionFieldTemplate::~TransactionFieldTemplate()
|
|
|
74 |
{
|
|
|
75 |
//## begin TransactionFieldTemplate::~TransactionFieldTemplate%41FDA5210143_dest.body preserve=yes
|
|
|
76 |
|
|
|
77 |
if ( m_compiledRegularExpression )
|
|
|
78 |
{
|
|
|
79 |
regfree( m_compiledRegularExpression );
|
|
|
80 |
|
|
|
81 |
delete m_compiledRegularExpression;
|
|
|
82 |
m_compiledRegularExpression = 0;
|
|
|
83 |
}
|
|
|
84 |
|
|
|
85 |
//## end TransactionFieldTemplate::~TransactionFieldTemplate%41FDA5210143_dest.body
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
//## Other Operations (implementation)
|
|
|
91 |
//## Operation: getValue%41FF21A6017E
|
|
|
92 |
const std::string & TransactionFieldTemplate::getValue () const
|
|
|
93 |
{
|
|
|
94 |
//## begin TransactionFieldTemplate::getValue%41FF21A6017E.body preserve=yes
|
|
|
95 |
|
|
|
96 |
return ( m_value );
|
|
|
97 |
|
|
|
98 |
//## end TransactionFieldTemplate::getValue%41FF21A6017E.body
|
|
|
99 |
}
|
|
|
100 |
|
|
|
101 |
//## Operation: isMatch%41FF654E035B
|
|
|
102 |
const bool TransactionFieldTemplate::isMatch (const std::string &xpath) const
|
|
|
103 |
{
|
|
|
104 |
//## begin TransactionFieldTemplate::isMatch%41FF654E035B.body preserve=yes
|
|
|
105 |
|
|
|
106 |
if ( !m_compiledRegularExpression )
|
|
|
107 |
{
|
|
|
108 |
m_compiledRegularExpression = new regex_t;
|
|
|
109 |
|
|
|
110 |
const int status = regcomp(
|
|
|
111 |
m_compiledRegularExpression,
|
|
|
112 |
m_regularExpression.c_str(),
|
|
|
113 |
REG_ICASE );
|
|
|
114 |
|
|
|
115 |
if ( status != 0 )
|
|
|
116 |
{
|
|
|
117 |
char message[ 1024 ];
|
|
|
118 |
regerror( status, m_compiledRegularExpression, message, sizeof( message ) );
|
|
|
119 |
|
|
|
120 |
MTHROW( std::runtime_error, \
|
|
|
121 |
message );
|
|
|
122 |
}
|
|
|
123 |
}
|
|
|
124 |
|
|
|
125 |
const int status = regexec(
|
|
|
126 |
m_compiledRegularExpression,
|
|
|
127 |
xpath.c_str(),
|
|
|
128 |
0,
|
|
|
129 |
0,
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
switch ( status )
|
|
|
133 |
{
|
|
|
134 |
case 0:
|
|
|
135 |
return ( true );
|
|
|
136 |
case REG_NOMATCH:
|
|
|
137 |
return ( false );
|
|
|
138 |
default:
|
|
|
139 |
{
|
|
|
140 |
char message[ 1024 ];
|
|
|
141 |
regerror( status, m_compiledRegularExpression, message, sizeof( message ) );
|
|
|
142 |
|
|
|
143 |
MTHROW( std::runtime_error, \
|
|
|
144 |
message );
|
|
|
145 |
}
|
|
|
146 |
}
|
|
|
147 |
|
|
|
148 |
//## end TransactionFieldTemplate::isMatch%41FF654E035B.body
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
//## Operation: setValue%41FF2F7C003C
|
|
|
152 |
const std::string & TransactionFieldTemplate::setValue (const std::string &value)
|
|
|
153 |
{
|
|
|
154 |
//## begin TransactionFieldTemplate::setValue%41FF2F7C003C.body preserve=yes
|
|
|
155 |
|
|
|
156 |
return ( m_value = value );
|
|
|
157 |
|
|
|
158 |
//## end TransactionFieldTemplate::setValue%41FF2F7C003C.body
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
// Additional Declarations
|
|
|
162 |
//## begin TransactionFieldTemplate%41FDA5210143.declarations preserve=yes
|
|
|
163 |
//## end TransactionFieldTemplate%41FDA5210143.declarations
|
|
|
164 |
|
|
|
165 |
//## begin module%41FDA5210143.epilog preserve=yes
|
|
|
166 |
//## end module%41FDA5210143.epilog
|