37 #include "StDbFieldI.h"
39 #include "StDataException.h"
41 using namespace TxLogging;
44 StRecord::StRecord() : fFields()
49 StRecord::StRecord(
const FieldList &fields) : fFields(fields) {
52 if ( fields.empty() ) {
54 StDataException::RECORD);
61 StRecord::StRecord(
const StRecord &r) : fFields() {
67 if (!fFields.empty()) { }
81 void StRecord::copy(
const StRecord& r) {
82 if (!fFields.empty()) clearList();
85 for ( FieldList::const_iterator iter = r.
getFields().begin();
94 void StRecord::clearList() {
95 for (FieldList::iterator iter = fFields.begin();
96 iter != fFields.end();
106 static std::string recordStr;
109 for (FieldList::const_iterator iter = fFields.begin();
110 iter != fFields.end();
112 recordStr += string(
"|") + (*iter)->fieldAsString();
115 return recordStr.c_str() ;
132 for (FieldList::const_iterator iter = fFields.begin();
133 !field && (iter != fFields.end()) ;
135 if (
string(name) == (*iter)->getName()) field = *iter;
145 ( col > 0 && col <= fFields.size() ) ? fFields[col-1] : 0;
159 for (FieldList::iterator iter = fFields.begin();
160 iter != fFields.end();
162 if (
string(name) == (*iter)->getName()) {
174 FieldList::iterator iter;
176 for (iter = fFields.begin(), i=0; iter != fFields.end(); i++, iter++)
186 void StRecord::printHeader()
const
188 FieldList::const_iterator it = fFields.begin();
189 for (; it != fFields.end(); ++it) {
190 cout << (*it)->getName() <<
" | " ;
193 for (; it != fFields.end(); ++it) {
194 cout << (*it)->getTypeAsString() <<
" | " ;
200 void StRecord::print()
const
202 FieldList::const_iterator it = fFields.begin();
203 for (; it != fFields.end(); ++it) {
204 cout << (*it)->getValueAsString() <<
" | " ;
StDbFieldI * getField(const char *name) const
TxLogging::RecordList & getRecords()
const StRecord & operator=(const StRecord &)
Copy constructor.
void removeField(const char *name)
virtual ~StRecord()
Assignment.
const char * toString() const
Deconstructor.
TxLogging::FieldList & getFields()