summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/mork/MorkParser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/mork/MorkParser.cxx')
-rw-r--r--connectivity/source/drivers/mork/MorkParser.cxx106
1 files changed, 44 insertions, 62 deletions
diff --git a/connectivity/source/drivers/mork/MorkParser.cxx b/connectivity/source/drivers/mork/MorkParser.cxx
index 676488cb209d..60fec845815f 100644
--- a/connectivity/source/drivers/mork/MorkParser.cxx
+++ b/connectivity/source/drivers/mork/MorkParser.cxx
@@ -599,35 +599,27 @@ void MorkParser::retrieveLists(std::set<std::string>& lists)
MorkTableMap* tables = getTables(defaultScope_);
if (!tables) return;
- for (MorkTableMap::Map::iterator TableIter = tables->map.begin();
- TableIter != tables->map.end(); ++TableIter )
+ for (auto& rTable : tables->map)
{
#ifdef VERBOSE
std::cout << "\t Table:"
- << ( ( int ) TableIter->first < 0 ? "-" : " " )
- << TableIter->first << std::endl;
+ << ( ( int ) rTable.first < 0 ? "-" : " " )
+ << rTable.first << std::endl;
#endif
- MorkRowMap* rows = getRows( 0x81/*defaultListScope*/, &TableIter->second );
+ MorkRowMap* rows = getRows( 0x81/*defaultListScope*/, &rTable.second );
if (!rows) return;
- for ( MorkRowMap::Map::const_iterator RowIter = rows->map.begin();
- RowIter != rows->map.end(); ++RowIter )
+ for ( const auto& rRow : rows->map )
{
#ifdef VERBOSE
std::cout << "\t\t\t Row Id:"
- << ( ( int ) RowIter->first < 0 ? "-" : " ")
- << RowIter->first << std::endl;
+ << ( ( int ) rRow.first < 0 ? "-" : " ")
+ << rRow.first << std::endl;
std::cout << "\t\t\t\t Cells:\r\n";
#endif
// Get cells
- for ( MorkCells::const_iterator cellsIter = RowIter->second.begin();
- cellsIter != RowIter->second.end(); ++cellsIter )
- {
- if (cellsIter->first == 0xC1)
- {
- lists.insert(getValue( cellsIter->second ));
- break;
- }
- }
+ MorkCells::const_iterator cellsIter = rRow.second.find(0xC1);
+ if (cellsIter != rRow.second.end())
+ lists.insert(getValue( cellsIter->second ));
}
}
}
@@ -641,41 +633,38 @@ void MorkParser::getRecordKeysForListTable(std::string const & listName, std::se
MorkTableMap* tables = getTables(defaultScope_);
if (!tables) return;
- for (MorkTableMap::Map::iterator TableIter = tables->map.begin();
- TableIter != tables->map.end(); ++TableIter )
+ for (auto& rTable : tables->map)
{
#ifdef VERBOSE
std::cout << "\t Table:"
- << ( ( int ) TableIter->first < 0 ? "-" : " " )
- << TableIter->first << std::endl;
+ << ( ( int ) rTable.first < 0 ? "-" : " " )
+ << rTable.first << std::endl;
#endif
- MorkRowMap* rows = getRows( 0x81, &TableIter->second );
+ MorkRowMap* rows = getRows( 0x81, &rTable.second );
if (!rows) return;
- for ( MorkRowMap::Map::const_iterator RowIter = rows->map.begin();
- RowIter != rows->map.end(); ++RowIter )
+ for ( const auto& rRow : rows->map )
{
#ifdef VERBOSE
std::cout << "\t\t\t Row Id:"
- << ( ( int ) RowIter->first < 0 ? "-" : " ")
- << RowIter->first << std::endl;
+ << ( ( int ) rRow.first < 0 ? "-" : " ")
+ << rRow.first << std::endl;
std::cout << "\t\t\t\t Cells:\r\n";
#endif
// Get cells
bool isListFound = false;
- for ( MorkCells::const_iterator cellsIter = RowIter->second.begin();
- cellsIter != RowIter->second.end(); ++cellsIter )
+ for ( const auto& [rColumnId, rValueId] : rRow.second )
{
if (isListFound)
{
- if (cellsIter->first >= 0xC7)
+ if (rColumnId >= 0xC7)
{
- std::string value = getValue(cellsIter->second);
+ std::string value = getValue(rValueId);
int id = strtoul(value.c_str(), nullptr, 16);
records.insert(id);
}
}
- else if ((cellsIter->first == 0xC1) &&
- listName == getValue( cellsIter->second ))
+ else if ((rColumnId == 0xC1) &&
+ listName == getValue( rValueId ))
{
isListFound = true;
}
@@ -694,12 +683,11 @@ void MorkParser::dump()
std::cout << "=============================================\r\n\r\n";
//// columns dict
- for ( MorkDict::const_iterator iter = columns_.begin();
- iter != columns_.end(); ++iter )
+ for ( const auto& [rColumnId, rText] : columns_ )
{
- std::cout << iter->first
+ std::cout << rColumnId
<< " : "
- << iter->second
+ << rText
<< std::endl;
}
@@ -707,16 +695,15 @@ void MorkParser::dump()
std::cout << "\r\nValues Dict:\r\n";
std::cout << "=============================================\r\n\r\n";
- for ( MorkDict::const_iterator iter = values_.begin();
- iter != values_.end(); ++iter )
+ for ( const auto& [rValueId, rText] : values_ )
{
- if (iter->first >= nextAddValueId_) {
+ if (rValueId >= nextAddValueId_) {
continue;
}
- std::cout << iter->first
+ std::cout << rValueId
<< " : "
- << iter->second
+ << rText
<< "\r\n";
}
@@ -725,47 +712,42 @@ void MorkParser::dump()
<< std::endl << std::endl;
//// Mork data
- for ( TableScopeMap::Map::const_iterator iter = mork_.map.begin();
- iter != mork_.map.end(); ++iter )
+ for ( const auto& [rTableScopeId, rTableScope] : mork_.map )
{
- std::cout << "\r\n Scope:" << iter->first << std::endl;
+ std::cout << "\r\n Scope:" << rTableScopeId << std::endl;
- for ( MorkTableMap::Map::const_iterator TableIter = iter->second.map.begin();
- TableIter != iter->second.map.end(); ++TableIter )
+ for ( const auto& [rTableId, rTable] : rTableScope.map )
{
std::cout << "\t Table:"
- << ( TableIter->first < 0 ? "-" : " " )
- << TableIter->first << std::endl;
+ << ( rTableId < 0 ? "-" : " " )
+ << rTableId << std::endl;
- for (RowScopeMap::Map::const_iterator RowScopeIter = TableIter->second.map.begin();
- RowScopeIter != TableIter->second.map.end(); ++RowScopeIter )
+ for (const auto& [rRowScopeId, rRowScope] : rTable.map)
{
std::cout << "\t\t RowScope:"
- << RowScopeIter->first << std::endl;
+ << rRowScopeId << std::endl;
- for (MorkRowMap::Map::const_iterator RowIter = RowScopeIter->second.map.begin();
- RowIter != RowScopeIter->second.map.end(); ++RowIter )
+ for (const auto& [rRowId, rRow] : rRowScope.map)
{
std::cout << "\t\t\t Row Id:"
- << (RowIter->first < 0 ? "-" : " ")
- << RowIter->first << std::endl;
+ << (rRowId < 0 ? "-" : " ")
+ << rRowId << std::endl;
std::cout << "\t\t\t\t Cells:" << std::endl;
- for (MorkCells::const_iterator CellsIter = RowIter->second.begin();
- CellsIter != RowIter->second.end(); ++CellsIter )
+ for (const auto& [rColumnId, rValueId] : rRow)
{
// Write ids
std::cout << "\t\t\t\t\t"
- << CellsIter->first
+ << rColumnId
<< " : "
- << CellsIter->second
+ << rValueId
<< " => ";
- MorkDict::const_iterator FoundIter = values_.find( CellsIter->second );
+ MorkDict::const_iterator FoundIter = values_.find( rValueId );
if ( FoundIter != values_.end() )
{
// Write string values
- std::cout << columns_[ CellsIter->first ].c_str()
+ std::cout << columns_[ rColumnId ].c_str()
<< " : "
<< FoundIter->second.c_str()
<< std::endl;