Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding left over commit from #331 #334

Merged
merged 1 commit into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions include/cgimap/api06/changeset_close_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ namespace api06 {

class changeset_close_responder : public text_responder {
public:
changeset_close_responder(mime::type, data_update &, osm_changeset_id_t,
const std::string &,
std::optional<osm_user_id_t>);
changeset_close_responder(mime::type,
data_update &,
osm_changeset_id_t,
const std::string &,
std::optional<osm_user_id_t>);
};

class changeset_close_handler : public payload_enabled_handler {
Expand All @@ -33,7 +35,7 @@ class changeset_close_handler : public payload_enabled_handler {
responder_ptr_t responder(data_selection &x) const override;

responder_ptr_t responder(data_update &,
const std::string &payload,
const std::string &payload,
std::optional<osm_user_id_t> user_id) const override;
bool requires_selection_after_update() const override;

Expand Down
5 changes: 3 additions & 2 deletions include/cgimap/api06/changeset_create_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ namespace api06 {

class changeset_create_responder : public text_responder {
public:
changeset_create_responder(mime::type, data_update &,
changeset_create_responder(mime::type,
data_update &,
const std::string &,
std::optional<osm_user_id_t>);
};
Expand All @@ -33,7 +34,7 @@ class changeset_create_handler : public payload_enabled_handler {
responder_ptr_t responder(data_selection &x) const override;

responder_ptr_t responder(data_update &,
const std::string &payload,
const std::string &payload,
std::optional<osm_user_id_t> user_id) const override;
bool requires_selection_after_update() const override;
};
Expand Down
12 changes: 6 additions & 6 deletions include/cgimap/api06/changeset_update_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ namespace api06 {
class changeset_update_responder : public text_responder {
public:
changeset_update_responder(mime::type,
data_update &,
osm_changeset_id_t id_,
data_update &,
osm_changeset_id_t id_,
const std::string & payload,
std::optional<osm_user_id_t> user_id);
std::optional<osm_user_id_t> user_id);
};

class changeset_update_sel_responder : public osm_current_responder {
public:
changeset_update_sel_responder(mime::type,
data_selection & sel,
osm_changeset_id_t id_);
data_selection & sel,
osm_changeset_id_t id_);
private:
data_selection& sel;
};
Expand All @@ -45,7 +45,7 @@ class changeset_update_handler : public payload_enabled_handler {
responder_ptr_t responder(data_selection &x) const override;

responder_ptr_t responder(data_update &,
const std::string &payload,
const std::string &payload,
std::optional<osm_user_id_t> user_id) const override;
bool requires_selection_after_update() const override;

Expand Down
2 changes: 1 addition & 1 deletion include/cgimap/api06/changeset_upload/node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef NODE_HPP
#define NODE_HPP

#include "osmobject.hpp"
#include "cgimap/api06/changeset_upload/osmobject.hpp"

#include <iostream>
#include <optional>
Expand Down
1 change: 0 additions & 1 deletion include/cgimap/api06/changeset_upload/node_updater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include "cgimap/api06/changeset_upload/osmchange_tracking.hpp"

#include <map>
#include <set>
#include <string>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define OSMCHANGE_TRACKING_HPP

#include <map>
#include <set>
#include <string>
#include <vector>

Expand Down
3 changes: 1 addition & 2 deletions include/cgimap/api06/changeset_upload/parser_callback.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace api06 {
class Parser_Callback {

public:
virtual ~Parser_Callback() = default;

virtual void start_document() = 0;

Expand All @@ -32,8 +33,6 @@ class Parser_Callback {
virtual void process_way(const Way &, operation op, bool if_unused) = 0;

virtual void process_relation(const Relation &, operation op, bool if_unused) = 0;

virtual ~Parser_Callback() = default;
};

} // namespace api06
Expand Down
6 changes: 4 additions & 2 deletions include/cgimap/api06/changeset_upload/relation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef RELATION_HPP
#define RELATION_HPP

#include "osmobject.hpp"
#include "cgimap/api06/changeset_upload/osmobject.hpp"
#include "cgimap/types.hpp"
#include "cgimap/util.hpp"

Expand All @@ -26,7 +26,9 @@ class RelationMember {
RelationMember() = default;

RelationMember(const std::string &m_type, osm_nwr_signed_id_t m_ref, const std::string &m_role) :
m_role(m_role), m_ref(m_ref), m_type(m_type) {};
m_role(m_role),
m_ref(m_ref),
m_type(m_type) {}

void set_type(const std::string &type) {

Expand Down
1 change: 0 additions & 1 deletion include/cgimap/api06/changeset_upload/relation_updater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "cgimap/api06/changeset_upload/relation.hpp"

#include <map>
#include <set>
#include <string>
#include <vector>

Expand Down
17 changes: 10 additions & 7 deletions include/cgimap/api06/changeset_upload/way_updater.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
#include "cgimap/api06/changeset_upload/osmchange_tracking.hpp"

#include <map>
#include <set>
#include <string>
#include <vector>



namespace api06 {

using TagList = std::map<std::string, std::string>;
Expand All @@ -36,15 +34,20 @@ class Way_Updater {
virtual ~Way_Updater() = default;

virtual void add_way(osm_changeset_id_t changeset_id,
osm_nwr_signed_id_t old_id, const WayNodeList &nodes,
osm_nwr_signed_id_t old_id,
const WayNodeList &nodes,
const TagList &tags) = 0;

virtual void modify_way(osm_changeset_id_t changeset_id, osm_nwr_id_t id,
osm_version_t version, const WayNodeList &nodes,
virtual void modify_way(osm_changeset_id_t changeset_id,
osm_nwr_id_t id,
osm_version_t version,
const WayNodeList &nodes,
const TagList &tags) = 0;

virtual void delete_way(osm_changeset_id_t changeset_id, osm_nwr_id_t id,
osm_version_t version, bool if_unused) = 0;
virtual void delete_way(osm_changeset_id_t changeset_id,
osm_nwr_id_t id,
osm_version_t version,
bool if_unused) = 0;

virtual void process_new_ways() = 0;

Expand Down
2 changes: 1 addition & 1 deletion include/cgimap/api06/changeset_upload_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class changeset_upload_handler : public payload_enabled_handler {
responder_ptr_t responder(data_selection &x) const override;

responder_ptr_t responder(data_update &,
const std::string &payload,
const std::string &payload,
std::optional<osm_user_id_t> user_id) const override;
bool requires_selection_after_update() const override;

Expand Down
4 changes: 2 additions & 2 deletions include/cgimap/api06/handler_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
#include "cgimap/types.hpp"
#include "cgimap/request.hpp"
#include "cgimap/api06/id_version.hpp"

#include <vector>
#include <string_view>

namespace api06 {

std::vector<id_version> parse_id_list_params(const request &req,
std::string_view param_name);
std::vector<id_version> parse_id_list_params(const request &req, std::string_view param_name);
}

#endif /* API06_HANDLER_UTILS_HPP */
3 changes: 2 additions & 1 deletion include/cgimap/api06/relations_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
#include "cgimap/data_selection.hpp"
#include "cgimap/request.hpp"
#include "cgimap/api06/id_version.hpp"

#include <string>
#include <list>
#include <vector>

namespace api06 {

Expand Down
2 changes: 2 additions & 0 deletions include/cgimap/api06/way_history_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "cgimap/osm_current_responder.hpp"
#include "cgimap/request.hpp"

#include <string>

namespace api06 {

class way_history_responder : public osm_current_responder {
Expand Down
1 change: 1 addition & 0 deletions include/cgimap/api06/way_relations_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "cgimap/handler.hpp"
#include "cgimap/osm_current_responder.hpp"
#include "cgimap/request.hpp"

#include <string>

namespace api06 {
Expand Down
1 change: 1 addition & 0 deletions include/cgimap/api06/way_version_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "cgimap/handler.hpp"
#include "cgimap/osm_current_responder.hpp"
#include "cgimap/request.hpp"

#include <string>

namespace api06 {
Expand Down
3 changes: 2 additions & 1 deletion include/cgimap/api06/ways_handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
#include "cgimap/request_helpers.hpp"
#include "cgimap/request.hpp"
#include "cgimap/api06/id_version.hpp"

#include <string>
#include <list>
#include <vector>

namespace api06 {

Expand Down
8 changes: 5 additions & 3 deletions include/cgimap/data_selection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include <chrono>
#include <memory>
#include <sstream>
#include <vector>
#include <string>

class Transaction_Owner_Base;

Expand Down Expand Up @@ -171,8 +171,10 @@ class data_selection {
// is user currently blocked?
virtual bool is_user_blocked(const osm_user_id_t) = 0;

virtual bool get_user_id_pass(const std::string& display_name, osm_user_id_t &,
std::string & pass_crypt, std::string & pass_salt) = 0;
virtual bool get_user_id_pass(const std::string& display_name,
osm_user_id_t &,
std::string & pass_crypt,
std::string & pass_salt) = 0;

// is user status confirmed or active?
virtual bool is_user_active(const osm_user_id_t) = 0;
Expand Down
4 changes: 2 additions & 2 deletions include/cgimap/data_update.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@

class data_update {
public:
virtual ~data_update() = default;

data_update() = default;

virtual ~data_update() = default;

data_update(const data_update&) = delete;
data_update& operator=(const data_update&) = delete;

Expand Down
8 changes: 6 additions & 2 deletions include/cgimap/handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <set>
#include <string>
#include <memory>
#include <optional>


/**
Expand Down Expand Up @@ -63,6 +64,7 @@ class handler {
handler(mime::type default_type = mime::unspecified_type,
http::method methods = default_methods);
virtual ~handler() = default;

virtual std::string log_name() const = 0;
virtual responder_ptr_t responder(data_selection &) const = 0;

Expand All @@ -89,10 +91,12 @@ using handler_ptr_t = std::unique_ptr<handler>;
class payload_enabled_handler : public handler {
public:
payload_enabled_handler(mime::type default_type = mime::unspecified_type,
http::method methods = http::method::POST | http::method::OPTIONS);
http::method methods = http::method::POST | http::method::OPTIONS);

// Responder used to update the database
virtual responder_ptr_t responder(data_update &, const std::string & payload, std::optional<osm_user_id_t> user_id) const = 0;
virtual responder_ptr_t responder(data_update &,
const std::string & payload,
std::optional<osm_user_id_t> user_id) const = 0;

// Optional responder to return XML response back to caller of the API method
responder_ptr_t responder(data_selection &) const override = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/cgimap/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef LOGGER_HPP
#define LOGGER_HPP

#include <fmt/core.h>
#include <string>

/**
* Contains support for logging.
Expand Down
5 changes: 3 additions & 2 deletions include/cgimap/osm_current_responder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class osm_current_responder : public osm_responder {
public:
// construct, passing the mime type down to the responder.
// optional bounds are stored at this level, but available to derived classes.
osm_current_responder(mime::type, data_selection &s,
std::optional<bbox> bounds = std::optional<bbox>());
osm_current_responder(mime::type,
data_selection &s,
std::optional<bbox> bounds = {});

// writes whatever is in the tmp_nodes/ways/relations tables to the given
// formatter.
Expand Down
3 changes: 1 addition & 2 deletions include/cgimap/osm_responder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class osm_responder : public responder {
public:
// construct, passing the mime type down to the responder.
// optional bounds are stored at this level, but available to derived classes.
explicit osm_responder(mime::type,
std::optional<bbox> bounds = {});
explicit osm_responder(mime::type, std::optional<bbox> bounds = {});

~osm_responder() override = default;

Expand Down
4 changes: 3 additions & 1 deletion include/cgimap/request_helpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@
#include <string>
#include "cgimap/request.hpp"
#include "cgimap/http.hpp"
#include <memory>

/**
* Lookup a string from the request environment. Throws 500 error if the
* string isn't there and no default value is given.
*/
std::string fcgi_get_env(const request &req, const char *name,
std::string fcgi_get_env(const request &req,
const char *name,
const char *default_value = nullptr);

/**
Expand Down
Loading
Loading