|
|
@ -23,17 +23,20 @@ distribution.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
#include "Export.h"
|
|
|
|
#include "Export.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <cctype>
|
|
|
|
#include <cctype>
|
|
|
|
#include <climits>
|
|
|
|
#include <climits>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <cstdio>
|
|
|
|
|
|
|
|
#include <iomanip>
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define DFHACK_FUNCTION_SIG __FUNCSIG__
|
|
|
|
#define DFHACK_FUNCTION_SIG __FUNCSIG__
|
|
|
@ -338,6 +341,24 @@ inline typename T::mapped_type map_find(
|
|
|
|
return (it == map.end()) ? defval : it->second;
|
|
|
|
return (it == map.end()) ? defval : it->second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <class T, typename Fn>
|
|
|
|
|
|
|
|
static void for_each_(std::vector<T> &v, Fn func)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::for_each(v.begin(), v.end(), func);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <class T, class V, typename Fn>
|
|
|
|
|
|
|
|
static void for_each_(std::map<T, V> &v, Fn func)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::for_each(v.begin(), v.end(), func);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <class T, class V, typename Fn>
|
|
|
|
|
|
|
|
static void transform_(const std::vector<T> &src, std::vector<V> &dst, Fn func)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::transform(src.begin(), src.end(), std::back_inserter(dst), func);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DFHACK_EXPORT bool prefix_matches(const std::string &prefix, const std::string &key, std::string *tail = NULL);
|
|
|
|
DFHACK_EXPORT bool prefix_matches(const std::string &prefix, const std::string &key, std::string *tail = NULL);
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
template<typename T>
|
|
|
|