updated to the new pikotools api: changed the way how child_spaces are created in Space class

This commit is contained in:
2021-05-21 17:17:17 +02:00
parent fe67b5d72a
commit f1b9d1b870
9 changed files with 277 additions and 262 deletions

View File

@@ -258,9 +258,10 @@ bool TimeZone::SetTzDst(pt::Space & year)
Dst dst;
int year_int = 0;
std::wstring * year_name = year.find_child_space_name();
if( year.name )
year_int = Toi(*year.name);
if( year_name )
year_int = Toi(*year_name);
if( year_int < 1970 || year_int > 10000 )
return false;
@@ -296,8 +297,10 @@ bool TimeZone::SetTz(pt::Space & space)
bool result = true;
name.clear();
if( space.name )
name = *space.name;
std::wstring * space_name = space.find_child_space_name();
if( space_name )
name = *space_name;
id = space.to_int(L"id", -1);
offset = GetOffset(space);
@@ -308,21 +311,24 @@ bool TimeZone::SetTz(pt::Space & space)
pt::Space * dst = space.find_child_space(L"dst");
if( dst && dst->child_spaces )
if( dst )
{
for(size_t i=0 ; i<dst->child_spaces->size() ; ++i)
{
pt::Space & year = *(*dst->child_spaces)[i];
pt::Space::TableType * child_table = dst->find_child_space_table();
if( !SetTzDst(year) )
if( child_table )
{
for(pt::Space * year : *child_table)
{
result = false;
break;
if( !SetTzDst(*year) )
{
result = false;
break;
}
}
}
}
return result;
return result;
}

View File

@@ -123,14 +123,15 @@ bool TimeZones::Empty() const
void TimeZones::ParseZones()
{
if( temp_space.child_spaces )
pt::Space::TableType * child_table = temp_space.find_child_space_table();
if( child_table )
{
for(size_t i=0 ; i<temp_space.child_spaces->size() ; ++i)
for(pt::Space * zone : *child_table)
{
pt::Space & zone = *((*temp_space.child_spaces)[i]);
temp_zone.Clear();
if( temp_zone.SetTz(zone) )
if( temp_zone.SetTz(*zone) )
{
if( !HasZone(temp_zone.id) )
{
@@ -154,7 +155,7 @@ void TimeZones::ParseZones()
else
{
log << log1 << "System: problem with reading time zone info from time zone: "
<< zone.name << " (skipping) " << logend;
<< zone->get_child_space_name() << " (skipping) " << logend;
}
}
}