44 #include "StDbXmlWriter.h"
45 #include "StDbTable.h"
50 StDbXmlWriter::streamHeader(
const char* name){
51 *os <<
"<StDbName>"<<name<< endl;
57 StDbXmlWriter::streamAccessor(){
58 *os <<
"<StDbAccessor>" << endl;
64 StDbXmlWriter::endAccessor(){
65 *os <<
"</StDbAccessor>" << endl;
71 StDbXmlWriter::streamTail(){
72 *os <<
"</StDbName>" << endl;
78 StDbXmlWriter::streamRow(
int row){
79 *os <<
"<TabRow>" << row << endl;
85 StDbXmlWriter::streamEndRow(){
86 *os <<
"</TabRow>" << endl;
91 StDbXmlWriter::streamTableName(
const char* name){
92 *os <<
"<StDbTable>"<<name << endl;
97 StDbXmlWriter::streamEndTableName(){
98 *os <<
"</StDbTable>"<< endl;
104 StDbXmlWriter::ioTable(
StDbTable* table){
106 char * name = table->getName();
107 streamTableName(name);
delete [] name;
121 table->setRowNumber();
123 for(k=0;k<nrows;k++){
128 streamEndTableName();
134 StDbXmlWriter::pass(
char* name,
char*& i,
int& len){
135 *os <<
"<dbString> "<<name<<
" <value> "<< i <<
" </value> </dbString>" << endl;
141 StDbXmlWriter::pass(
char* name,
unsigned char& i,
int& len){
142 *os <<
"<dbUChar> "<<name<<
" <value> "<< (int)i <<
" </value> </dbUChar>" << endl;
148 StDbXmlWriter::pass(
char* name,
unsigned char*& i,
int& len){
149 *os <<
"<dbUCharArray> " << name <<
" <length> ";
150 *os << len <<
" </length>" << endl;
151 *os <<
"<value>" << endl;
154 for(
int j=0; j<len-1;j++){
155 *os << (int)i[j] <<
", ";
163 *os << (int)i[len-1] << endl;
164 *os <<
"</value> </dbUCharArray> " << endl;
171 StDbXmlWriter::pass(
char* name,
short& i,
int& len){
172 *os <<
"<dbShort> "<<name<<
" <value> "<< i <<
" </value> </dbShort>" << endl;
178 StDbXmlWriter::pass(
char* name,
short*& i,
int& len){
180 *os <<
"<dbShortArray> " << name <<
" <length> ";
181 *os << len <<
" </length>" << endl;
182 *os <<
"<value>" << endl;
185 for(
int j=0; j<len-1;j++){
194 *os << i[len-1] << endl;
195 *os <<
"</value> </dbShortArray> " << endl;
201 StDbXmlWriter::pass(
char* name,
unsigned short& i,
int& len){
202 *os <<
"<dbUShort> "<<name<<
" <value> "<< i <<
" </value> </dbUShort>" << endl;
208 StDbXmlWriter::pass(
char* name,
unsigned short*& i,
int& len){
210 *os <<
"<dbUShortArray> " << name <<
" <length> ";
211 *os << len <<
" </length>" << endl;
212 *os <<
"<value>" << endl;
215 for(
int j=0; j<len-1;j++){
224 *os << i[len-1] << endl;
225 *os <<
"</value> </dbUShortArray> " << endl;
231 StDbXmlWriter::pass(
char* name,
int& i,
int& len){
232 *os <<
"<dbInt> "<<name<<
" <value> "<< i <<
" </value> </dbInt>" << endl;
238 StDbXmlWriter::pass(
char* name,
int*& i,
int& len){
240 *os <<
"<dbIntArray> " << name <<
" <length> ";
241 *os << len <<
" </length>" << endl;
242 *os <<
"<value>" << endl;
245 for(
int j=0; j<len-1;j++){
254 *os << i[len-1] << endl;
255 *os <<
"</value> </dbIntArray> " << endl;
261 StDbXmlWriter::pass(
char* name,
unsigned int& i,
int& len){
262 *os <<
"<dbUInt> "<<name<<
" <value> "<< i <<
" </value> </dbUInt>" << endl;
268 StDbXmlWriter::pass(
char* name,
unsigned int*& i,
int& len){
270 *os <<
"<dbUIntArray> " << name <<
" <length> ";
271 *os << len <<
" </length>" << endl;
272 *os <<
"<value>" << endl;
275 for(
int j=0; j<len-1;j++){
284 *os << i[len-1] << endl;
285 *os <<
"</value> </dbUIntArray> " << endl;
291 StDbXmlWriter::pass(
char* name,
float& i,
int& len){
292 *os <<
"<dbFloat> "<<name<<
" <value> "<< i <<
" </value> </dbFloat>" << endl;
298 StDbXmlWriter::pass(
char* name,
float*& i,
int& len){
300 *os <<
"<dbFloatArray> " << name <<
" <length> ";
301 *os << len <<
" </length>" << endl;
302 *os <<
"<value>" << endl;
305 for(
int j=0; j<len-1;j++){
314 *os << i[len-1] << endl;
315 *os <<
"</value> </dbFloatArray> " << endl;
321 StDbXmlWriter::pass(
char* name,
double& i,
int& len){
322 *os <<
"<dbDouble> "<<name<<
" <value> "<< i <<
" </value> </dbDouble>" << endl;
328 StDbXmlWriter::pass(
char* name,
double*& i,
int& len){
330 *os <<
"<dbDoubleArray> " << name <<
" <length> ";
331 *os << len <<
" </length>" << endl;
332 *os <<
"<value>" << endl;
335 for(
int j=0; j<len-1;j++){
344 *os << i[len-1] << endl;
345 *os <<
"</value> </dbDoubleArray> " << endl;
350 StDbXmlWriter::pass(
char* name,
long& i,
int& len){
351 *os <<
"<dbLong> "<<name<<
" <value> "<< i <<
" </value> </dbLong>" << endl;
357 StDbXmlWriter::pass(
char* name,
long*& i,
int& len){
359 *os <<
"<dbLongArray> " << name <<
" <length> ";
360 *os << len <<
" </length>" << endl;
361 *os <<
"<value>" << endl;
364 for(
int j=0; j<len-1;j++){
373 *os << i[len-1] << endl;
374 *os <<
"</value> </dbLongArray> " << endl;
380 StDbXmlWriter::pass(
char* name,
unsigned long& i,
int& len){
381 *os <<
"<dbULong> "<<name<<
" <value> "<< i <<
" </value> </dbULong>" << endl;
384 StDbXmlWriter::pass(
char* name,
long long& i,
int& len){
385 *os <<
"<dbLongLong> "<<name<<
" <value> "<< i <<
" </value> </dbLongLong>" << endl;
391 StDbXmlWriter::pass(
char* name,
unsigned long*& i,
int& len){
393 *os <<
"<dbULongArray> " << name <<
" <length> ";
394 *os << len <<
" </length>" << endl;
395 *os <<
"<value>" << endl;
398 for(
int j=0; j<len-1;j++){
407 *os << i[len-1] << endl;
408 *os <<
"</value> </dbULongArray> " << endl;
413 StDbXmlWriter::pass(
char* name,
long long*& i,
int& len){
415 *os <<
"<dbLongLongArray> " << name <<
" <length> ";
416 *os << len <<
" </length>" << endl;
417 *os <<
"<value>" << endl;
420 for(
int j=0; j<len-1;j++){
429 *os << i[len-1] << endl;
430 *os <<
"</value> </dbLongLongArray> " << endl;