CID#736937 Not restoring ostream format

Change-Id: I07b1d90258647453e498b574bc38c78872041c2d
This commit is contained in:
Caolán McNamara 2013-12-19 10:23:40 +00:00
parent 765f306398
commit bea15d037b

View File

@ -32,6 +32,7 @@
*/ */
#include "MorkParser.hxx" #include "MorkParser.hxx"
#include <boost/io/ios_state.hpp>
#include <stdlib.h> #include <stdlib.h>
#include <sstream> #include <sstream>
#include <string> #include <string>
@ -601,6 +602,11 @@ std::string &MorkParser::getColumn( int oid )
void MorkParser::retrieveLists(std::set<std::string>& lists) void MorkParser::retrieveLists(std::set<std::string>& lists)
{ {
#ifdef VERBOSE
boost::io::ios_all_saver ias(std::cout);
std::cout << std::hex << std::uppercase;
#endif
MorkTableMap* tables = getTables(defaultScope_); MorkTableMap* tables = getTables(defaultScope_);
if (!tables) return; if (!tables) return;
for (MorkTableMap::iterator TableIter = tables->begin(); for (MorkTableMap::iterator TableIter = tables->begin();
@ -609,7 +615,7 @@ void MorkParser::retrieveLists(std::set<std::string>& lists)
#ifdef VERBOSE #ifdef VERBOSE
std::cout << "\t Table:" std::cout << "\t Table:"
<< ( ( int ) TableIter->first < 0 ? "-" : " " ) << ( ( int ) TableIter->first < 0 ? "-" : " " )
<< std::hex << std::uppercase << TableIter->first << std::endl; << TableIter->first << std::endl;
#endif #endif
MorkRowMap* rows = getRows( defaultListScope_, &TableIter->second ); MorkRowMap* rows = getRows( defaultListScope_, &TableIter->second );
if (!rows) return; if (!rows) return;
@ -619,7 +625,7 @@ void MorkParser::retrieveLists(std::set<std::string>& lists)
#ifdef VERBOSE #ifdef VERBOSE
std::cout << "\t\t\t Row Id:" std::cout << "\t\t\t Row Id:"
<< ( ( int ) RowIter->first < 0 ? "-" : " ") << ( ( int ) RowIter->first < 0 ? "-" : " ")
<< std::hex << std::uppercase << RowIter->first << std::endl; << RowIter->first << std::endl;
std::cout << "\t\t\t\t Cells:\r\n"; std::cout << "\t\t\t\t Cells:\r\n";
#endif #endif
// Get cells // Get cells
@ -638,6 +644,11 @@ void MorkParser::retrieveLists(std::set<std::string>& lists)
void MorkParser::getRecordKeysForListTable(std::string& listName, std::set<int>& records) void MorkParser::getRecordKeysForListTable(std::string& listName, std::set<int>& records)
{ {
#ifdef VERBOSE
boost::io::ios_all_saver ias(std::cout);
std::cout << std::hex << std::uppercase;
#endif
MorkTableMap* tables = getTables(defaultScope_); MorkTableMap* tables = getTables(defaultScope_);
if (!tables) return; if (!tables) return;
for (MorkTableMap::iterator TableIter = tables->begin(); for (MorkTableMap::iterator TableIter = tables->begin();
@ -646,7 +657,7 @@ void MorkParser::getRecordKeysForListTable(std::string& listName, std::set<int>&
#ifdef VERBOSE #ifdef VERBOSE
std::cout << "\t Table:" std::cout << "\t Table:"
<< ( ( int ) TableIter->first < 0 ? "-" : " " ) << ( ( int ) TableIter->first < 0 ? "-" : " " )
<< std::hex << std::uppercase << TableIter->first << std::endl; << TableIter->first << std::endl;
#endif #endif
MorkRowMap* rows = getRows( 0x81, &TableIter->second ); MorkRowMap* rows = getRows( 0x81, &TableIter->second );
if (!rows) return; if (!rows) return;
@ -656,7 +667,7 @@ void MorkParser::getRecordKeysForListTable(std::string& listName, std::set<int>&
#ifdef VERBOSE #ifdef VERBOSE
std::cout << "\t\t\t Row Id:" std::cout << "\t\t\t Row Id:"
<< ( ( int ) RowIter->first < 0 ? "-" : " ") << ( ( int ) RowIter->first < 0 ? "-" : " ")
<< std::hex << std::uppercase << RowIter->first << std::endl; << RowIter->first << std::endl;
std::cout << "\t\t\t\t Cells:\r\n"; std::cout << "\t\t\t\t Cells:\r\n";
#endif #endif
// Get cells // Get cells
@ -686,6 +697,9 @@ void MorkParser::getRecordKeysForListTable(std::string& listName, std::set<int>&
void MorkParser::dump() void MorkParser::dump()
{ {
boost::io::ios_all_saver ias(std::cout);
std::cout << std::hex << std::uppercase;
std::cout << "Column Dict:\r\n"; std::cout << "Column Dict:\r\n";
std::cout << "=============================================\r\n\r\n"; std::cout << "=============================================\r\n\r\n";
@ -693,7 +707,7 @@ void MorkParser::dump()
for ( MorkDict::iterator iter = columns_.begin(); for ( MorkDict::iterator iter = columns_.begin();
iter != columns_.end(); ++iter ) iter != columns_.end(); ++iter )
{ {
std::cout << std::hex << std::uppercase << iter->first std::cout << iter->first
<< " : " << " : "
<< iter->second << iter->second
<< std::endl; << std::endl;
@ -710,7 +724,7 @@ void MorkParser::dump()
continue; continue;
} }
std::cout << std::hex << std::uppercase << iter->first std::cout << iter->first
<< " : " << " : "
<< iter->second << iter->second
<< "\r\n"; << "\r\n";
@ -724,21 +738,19 @@ void MorkParser::dump()
for ( TableScopeMap::iterator iter = mork_.begin(); for ( TableScopeMap::iterator iter = mork_.begin();
iter != mork_.end(); ++iter ) iter != mork_.end(); ++iter )
{ {
std::cout << "\r\n Scope:" << std::hex << std::uppercase std::cout << "\r\n Scope:" << iter->first << std::endl;
<< iter->first << std::endl;
for ( MorkTableMap::iterator TableIter = iter->second.begin(); for ( MorkTableMap::iterator TableIter = iter->second.begin();
TableIter != iter->second.end(); ++TableIter ) TableIter != iter->second.end(); ++TableIter )
{ {
std::cout << "\t Table:" std::cout << "\t Table:"
<< ( ( int ) TableIter->first < 0 ? "-" : " " ) << ( ( int ) TableIter->first < 0 ? "-" : " " )
<< std::hex << std::uppercase << TableIter->first << std::endl; << TableIter->first << std::endl;
for (RowScopeMap::iterator RowScopeIter = TableIter->second.begin(); for (RowScopeMap::iterator RowScopeIter = TableIter->second.begin();
RowScopeIter != TableIter->second.end(); ++RowScopeIter ) RowScopeIter != TableIter->second.end(); ++RowScopeIter )
{ {
std::cout << "\t\t RowScope:" std::cout << "\t\t RowScope:"
<< std::hex << std::uppercase
<< RowScopeIter->first << std::endl; << RowScopeIter->first << std::endl;
for (MorkRowMap::iterator RowIter = RowScopeIter->second.begin(); for (MorkRowMap::iterator RowIter = RowScopeIter->second.begin();
@ -746,7 +758,6 @@ void MorkParser::dump()
{ {
std::cout << "\t\t\t Row Id:" std::cout << "\t\t\t Row Id:"
<< ((int) RowIter->first < 0 ? "-" : " ") << ((int) RowIter->first < 0 ? "-" : " ")
<< std::hex << std::uppercase
<< RowIter->first << std::endl; << RowIter->first << std::endl;
std::cout << "\t\t\t\t Cells:" << std::endl; std::cout << "\t\t\t\t Cells:" << std::endl;
@ -755,10 +766,8 @@ void MorkParser::dump()
{ {
// Write ids // Write ids
std::cout << "\t\t\t\t\t" std::cout << "\t\t\t\t\t"
<< std::hex << std::uppercase
<< CellsIter->first << CellsIter->first
<< " : " << " : "
<< std::hex << std::uppercase
<< CellsIter->second << CellsIter->second
<< " => "; << " => ";