replace boost::optional with mapbox::util::optional

This commit is contained in:
Dennis Luxen 2014-08-29 11:27:51 +02:00
parent e938bd3481
commit 282800e6b1
4 changed files with 13 additions and 16 deletions

View File

@ -61,13 +61,12 @@ void ExtractorCallbacks::ProcessNode(const osmium::Node &osm_input_node,
} }
void ExtractorCallbacks::ProcessRestriction( void ExtractorCallbacks::ProcessRestriction(
const boost::optional<InputRestrictionContainer> &restriction) const mapbox::util::optional<InputRestrictionContainer> &restriction)
{ {
if (!restriction.is_initialized()) if (restriction)
{ {
return; external_memory.restrictions_list.push_back(restriction.get());
} }
external_memory.restrictions_list.push_back(restriction.get());
} }
/** warning: caller needs to take care of synchronization! */ /** warning: caller needs to take care of synchronization! */
void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, ExtractionWay &parsed_way) void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, ExtractionWay &parsed_way)

View File

@ -31,10 +31,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ExtractionWay.h" #include "ExtractionWay.h"
#include "../typedefs.h" #include "../typedefs.h"
#include <boost/optional.hpp>
#include <osmium/osm.hpp> #include <osmium/osm.hpp>
#include <variant/optional.hpp>
#include <string> #include <string>
#include <unordered_map> #include <unordered_map>
@ -59,7 +59,7 @@ class ExtractorCallbacks
void ProcessNode(const osmium::Node &current_node, const ExtractionNode &result_node); void ProcessNode(const osmium::Node &current_node, const ExtractionNode &result_node);
// warning: caller needs to take care of synchronization! // warning: caller needs to take care of synchronization!
void ProcessRestriction(const boost::optional<InputRestrictionContainer> &restriction); void ProcessRestriction(const mapbox::util::optional<InputRestrictionContainer> &restriction);
// warning: caller needs to take care of synchronization! // warning: caller needs to take care of synchronization!
void ProcessWay(const osmium::Way &current_way, ExtractionWay &result_way); void ProcessWay(const osmium::Way &current_way, ExtractionWay &result_way);

View File

@ -89,12 +89,12 @@ void RestrictionParser::ReadRestrictionExceptions()
} }
} }
boost::optional<InputRestrictionContainer> RestrictionParser::TryParse(osmium::Relation &relation) const mapbox::util::optional<InputRestrictionContainer> RestrictionParser::TryParse(osmium::Relation &relation) const
{ {
// return if turn restrictions should be ignored // return if turn restrictions should be ignored
if (!use_turn_restrictions) if (!use_turn_restrictions)
{ {
return boost::optional<InputRestrictionContainer>(); return mapbox::util::optional<InputRestrictionContainer>();
} }
osmium::tags::KeyPrefixFilter filter(false); osmium::tags::KeyPrefixFilter filter(false);
@ -108,7 +108,7 @@ boost::optional<InputRestrictionContainer> RestrictionParser::TryParse(osmium::R
// if it's a restriction, continue; // if it's a restriction, continue;
if (std::distance(fi_begin, fi_end) == 0) if (std::distance(fi_begin, fi_end) == 0)
{ {
return boost::optional<InputRestrictionContainer>(); return mapbox::util::optional<InputRestrictionContainer>();
} }
// check if the restriction should be ignored // check if the restriction should be ignored
@ -117,7 +117,7 @@ boost::optional<InputRestrictionContainer> RestrictionParser::TryParse(osmium::R
{ {
if (ShouldIgnoreRestriction(except)) if (ShouldIgnoreRestriction(except))
{ {
return boost::optional<InputRestrictionContainer>(); return mapbox::util::optional<InputRestrictionContainer>();
} }
} }
@ -198,7 +198,7 @@ boost::optional<InputRestrictionContainer> RestrictionParser::TryParse(osmium::R
// << restriction_container.restriction.via.node << "->" << restriction_container.restriction.to.node // << restriction_container.restriction.via.node << "->" << restriction_container.restriction.to.node
// << ">"; // << ">";
return boost::optional<InputRestrictionContainer>(restriction_container); return mapbox::util::optional<InputRestrictionContainer>(restriction_container);
} }
bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_string) const bool RestrictionParser::ShouldIgnoreRestriction(const std::string &except_tag_string) const

View File

@ -30,12 +30,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "../DataStructures/Restriction.h" #include "../DataStructures/Restriction.h"
#include <boost/optional.hpp>
#include <osmium/osm.hpp> #include <osmium/osm.hpp>
#include <osmium/tags/regex_filter.hpp> #include <osmium/tags/regex_filter.hpp>
#include <variant/optional.hpp>
#include <string> #include <string>
#include <vector> #include <vector>
@ -48,7 +46,7 @@ class RestrictionParser
public: public:
RestrictionParser(ScriptingEnvironment &scripting_environment); RestrictionParser(ScriptingEnvironment &scripting_environment);
boost::optional<InputRestrictionContainer> TryParse(osmium::Relation& relation) const; mapbox::util::optional<InputRestrictionContainer> TryParse(osmium::Relation& relation) const;
void ReadUseRestrictionsSetting(); void ReadUseRestrictionsSetting();
void ReadRestrictionExceptions(); void ReadRestrictionExceptions();