Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #490 from hotosm/feature/relationsProcessing
Browse files Browse the repository at this point in the history
Feature/relations processing
  • Loading branch information
emi420 authored May 6, 2024
2 parents 22ca90f + b1ac29b commit ad61a24
Show file tree
Hide file tree
Showing 50 changed files with 3,007 additions and 681 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/bootstrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Bootstrap::start(const underpassconfig::UnderpassConfig &config) {

processWays();
processNodes();
// processRelations();
processRelations();

}

Expand Down Expand Up @@ -358,7 +358,7 @@ Bootstrap::threadBootstrapRelationTask(RelationTask relationTask)
BootstrapTask task;
int processed = 0;

// auto relationval = std::make_shared<std::vector<std::shared_ptr<ValidateStatus>>>();
auto relationval = std::make_shared<std::vector<std::shared_ptr<ValidateStatus>>>();

// Proccesing relations
for (size_t i = taskIndex * page_size; i < (taskIndex + 1) * page_size; ++i) {
Expand Down
58 changes: 22 additions & 36 deletions src/data/pq.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2020, 2021, 2023 Humanitarian OpenStreetMap Team
// Copyright (c) 2020, 2021, 2023, 2024 Humanitarian OpenStreetMap Team
//
// This file is part of Underpass.
//
Expand Down Expand Up @@ -160,48 +160,34 @@ Pq::query(const std::string &query)
std::string
Pq::escapedString(const std::string &s)
{
std::string newstr;
size_t i = 0;
while (i < s.size()) {
// Single quote (')
if (s[i] == '\'') {
newstr += "''";
// Slash (\)
} else if (s[i] == '\\') {
newstr += "\\\\";
} else {
newstr += s[i];
}
i++;
}
return sdb->esc(newstr);
return sdb->esc(s);
}

std::string
Pq::escapedJSON(const std::string &s) {
std::ostringstream o;
for (auto c = s.cbegin(); c != s.cend(); c++) {
switch (*c) {
case '\x00': o << "\\u0000"; break;
case '\x01': o << " "; break;
case '\x02': o << " "; break;
case '\x03': o << " "; break;
case '\x04': o << " "; break;
case '\x05': o << " "; break;
case '\x06': o << " "; break;
case '\x07': o << " "; break;
case '\x08': o << " "; break;
case '\x09': o << " "; break;
case '\x0a': o << "\\n"; break;
case '\x0b': o << " "; break;
case '\x0c': o << " "; break;
case '\x0d': o << " "; break;
case '\x0e': o << " "; break;
case '\xfe': o << " "; break;
case '\x1f': o << "\\u001f"; break;
case '\x22': o << "\\\""; break;
case '\x5c': o << "\\\\"; break;
default: o << *c;
case '\x00': o << "\\u0000"; break;
case '\x01': o << " "; break;
case '\x02': o << " "; break;
case '\x03': o << " "; break;
case '\x04': o << " "; break;
case '\x05': o << " "; break;
case '\x06': o << " "; break;
case '\x07': o << " "; break;
case '\x08': o << " "; break;
case '\x09': o << " "; break;
case '\x0a': o << "\n"; break;
case '\x0b': o << " "; break;
case '\x0c': o << " "; break;
case '\x0d': o << " "; break;
case '\x0e': o << " "; break;
case '\xfe': o << " "; break;
case '\x1f': o << "\\u001f"; break;
case '\x22': o << "\""; break;
case '\x5c': o << "\\"; break;
default: o << *c;
}
}
return o.str();
Expand Down
2 changes: 1 addition & 1 deletion src/osm/changeset.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2020, 2021, 2022, 2023 Humanitarian OpenStreetMap Team
// Copyright (c) 2020, 2021, 2022, 2023, 2024 Humanitarian OpenStreetMap Team
//
// This file is part of Underpass.
//
Expand Down
Loading

0 comments on commit ad61a24

Please sign in to comment.