remove implicitly defined inline keywords from header-implemented functions in Util/ headers
This commit is contained in:
parent
1d25f41122
commit
f452e7f9d2
@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef EXTRACTION_NODE_H__
|
||||
#define EXTRACTION_NODE_H__
|
||||
#ifndef EXTRACTION_NODE_H
|
||||
#define EXTRACTION_NODE_H
|
||||
|
||||
struct ExtractionNode
|
||||
{
|
||||
@ -38,5 +38,4 @@ struct ExtractionNode
|
||||
bool traffic_lights;
|
||||
bool barrier;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif // EXTRACTION_NODE_H
|
||||
|
@ -43,7 +43,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <string>
|
||||
|
||||
// generate boost::program_options object for the routing part
|
||||
<<<<<<< HEAD
|
||||
bool GenerateDataStoreOptions(const int argc, const char *argv[], ServerPaths &paths)
|
||||
=======
|
||||
bool GenerateDataStoreOptions(const int argc, const char *argv[], ServerPaths &paths, bool & springclean)
|
||||
>>>>>>> remove implicitly defined inline keywords from header-implemented functions in Util/ headers
|
||||
{
|
||||
// declare a group of options that will be allowed only on command line
|
||||
boost::program_options::options_description generic_options("Options");
|
||||
|
@ -36,7 +36,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <string>
|
||||
|
||||
// support old capitalized option names by down-casing them with a regex replace
|
||||
inline std::string ReadIniFileAndLowerContents(const boost::filesystem::path &path)
|
||||
std::string ReadIniFileAndLowerContents(const boost::filesystem::path &path)
|
||||
{
|
||||
boost::filesystem::fstream config_stream(path);
|
||||
std::string ini_file_content((std::istreambuf_iterator<char>(config_stream)),
|
||||
|
@ -43,7 +43,7 @@ extern "C" {
|
||||
template <typename T> void LUA_print(T output) { std::cout << "[LUA] " << output << std::endl; }
|
||||
|
||||
// Check if the lua function <name> is defined
|
||||
inline bool lua_function_exists(lua_State *lua_state, const char *name)
|
||||
bool lua_function_exists(lua_State *lua_state, const char *name)
|
||||
{
|
||||
luabind::object globals_table = luabind::globals(lua_state);
|
||||
luabind::object lua_function = globals_table[name];
|
||||
@ -53,7 +53,7 @@ inline bool lua_function_exists(lua_State *lua_state, const char *name)
|
||||
// Add the folder contain the script to the lua load path, so script can easily require() other lua
|
||||
// scripts inside that folder, or subfolders.
|
||||
// See http://lua-users.org/wiki/PackagePath for details on the package.path syntax.
|
||||
inline void luaAddScriptFolderToLoadPath(lua_State *lua_state, const char *file_name)
|
||||
void luaAddScriptFolderToLoadPath(lua_State *lua_state, const char *file_name)
|
||||
{
|
||||
const boost::filesystem::path profile_path(file_name);
|
||||
std::string folder = profile_path.parent_path().string();
|
||||
|
@ -144,7 +144,7 @@ inline void populate_base_path(ServerPaths &server_paths)
|
||||
}
|
||||
|
||||
// generate boost::program_options object for the routing part
|
||||
inline unsigned GenerateServerProgramOptions(const int argc,
|
||||
unsigned GenerateServerProgramOptions(const int argc,
|
||||
const char *argv[],
|
||||
ServerPaths &paths,
|
||||
std::string &ip_address,
|
||||
|
@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// precision: position after decimal point
|
||||
// length: maximum number of digits including comma and decimals
|
||||
// work with negative values to prevent overflowing when taking -value
|
||||
template <int length, int precision> static inline char *printInt(char *buffer, int value)
|
||||
template <int length, int precision> static char *printInt(char *buffer, int value)
|
||||
{
|
||||
bool minus = true;
|
||||
if (value > 0)
|
||||
@ -76,7 +76,7 @@ inline void replaceAll(std::string &s, const std::string &sub, const std::string
|
||||
boost::replace_all(s, sub, other);
|
||||
}
|
||||
|
||||
inline std::string EscapeJSONString(const std::string &input)
|
||||
std::string EscapeJSONString(const std::string &input)
|
||||
{
|
||||
std::string output;
|
||||
output.reserve(input.size());
|
||||
@ -120,7 +120,7 @@ static std::string originals[] = {"&", "\"", "<", ">", "'", "[", "]", "\\"};
|
||||
static std::string entities[] = {
|
||||
"&", """, "<", ">", "'", "&91;", "&93;", " \"};
|
||||
|
||||
inline std::size_t URIDecode(const std::string &input, std::string &output)
|
||||
std::size_t URIDecode(const std::string &input, std::string &output)
|
||||
{
|
||||
auto src_iter = input.begin();
|
||||
output.resize(input.size() + 1);
|
||||
@ -144,7 +144,7 @@ inline std::size_t URIDecode(const std::string &input, std::string &output)
|
||||
return decoded_length;
|
||||
}
|
||||
|
||||
inline std::size_t URIDecodeInPlace(std::string &URI) { return URIDecode(URI, URI); }
|
||||
std::size_t URIDecodeInPlace(std::string &URI) { return URIDecode(URI, URI); }
|
||||
|
||||
// TODO: remove after switch to libosmium
|
||||
inline bool StringStartsWith(const std::string &input, const std::string &prefix)
|
||||
@ -152,7 +152,7 @@ inline bool StringStartsWith(const std::string &input, const std::string &prefix
|
||||
return boost::starts_with(input, prefix);
|
||||
}
|
||||
|
||||
inline std::string GetRandomString()
|
||||
std::string GetRandomString()
|
||||
{
|
||||
std::string s;
|
||||
s.resize(128);
|
||||
|
72
Util/range.hpp
Normal file
72
Util/range.hpp
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
|
||||
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice, this list
|
||||
of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice, this
|
||||
list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef RANGE_HPP_
|
||||
#define RANGE_HPP_
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
template <typename Iterator> class Range
|
||||
{
|
||||
public:
|
||||
Range(Iterator begin, Iterator end) : begin_(begin), end_(end) {}
|
||||
|
||||
Iterator begin() const { return begin_; }
|
||||
Iterator end() const { return end_; }
|
||||
|
||||
private:
|
||||
Iterator begin_;
|
||||
Iterator end_;
|
||||
};
|
||||
|
||||
// Convenience functions for template parameter inference,
|
||||
// akin to std::make_pair.
|
||||
|
||||
template <typename Iterator> Range<Iterator> range(Iterator begin, Iterator end)
|
||||
{
|
||||
return Range<Iterator>(begin, end);
|
||||
}
|
||||
|
||||
template <typename Reversable>
|
||||
Range<typename Reversable::reverse_iterator> reverse(Reversable *reversable)
|
||||
{
|
||||
return Range<typename Reversable::reverse_iterator>(reversable->rbegin(), reversable->rend());
|
||||
}
|
||||
|
||||
template <typename ConstReversable>
|
||||
Range<typename ConstReversable::const_reverse_iterator>
|
||||
const_reverse(const ConstReversable *const_reversable)
|
||||
{
|
||||
return Range<typename ConstReversable::const_reverse_iterator>(const_reversable->crbegin(),
|
||||
const_reversable->crend());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // RANGE_HPP_
|
42
Util/range_algorithms.hpp
Normal file
42
Util/range_algorithms.hpp
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
open source routing machine
|
||||
Copyright (C) Dennis Luxen, others 2010
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU AFFERO General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
or see http://www.gnu.org/licenses/agpl.txt.
|
||||
*/
|
||||
|
||||
#ifndef RANGE_ALGORITHMS_HPP
|
||||
#define RANGE_ALGORITHMS_HPP
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace osrm {
|
||||
|
||||
template<class Container>
|
||||
auto max_element(const Container & c) -> decltype(std::max_element(c.begin(), c.end()))
|
||||
{
|
||||
return std::max_element(c.begin(), c.end());
|
||||
}
|
||||
|
||||
template<class Container>
|
||||
auto max_element(const Container & c) -> decltype(std::max_element(c.cbegin(), c.cend()))
|
||||
{
|
||||
return std::max_element(c.cbegin(), c.cend());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif // RANGE_ALGORITHMS_HPP
|
Loading…
Reference in New Issue
Block a user