diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-03 12:32:26 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-03 12:32:26 +0100 |
| commit | d003793402ee5e9c0ee2a5a7c96e03f67f7b84cc (patch) | |
| tree | 0818ee749cc393ec3c79130f16162fe669815a1e /src | |
| parent | 7cdb6a5253d1dcb0ebb8b1569dde5f5eb9c9df72 (diff) | |
Add ids_equal().
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.cc | 12 | ||||
| -rw-r--r-- | src/util.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index 80c3756b..3d37454f 100644 --- a/src/util.cc +++ b/src/util.cc @@ -40,6 +40,7 @@ #include <libxml++/document.h> #include <openssl/sha.h> #include <boost/filesystem.hpp> +#include <boost/algorithm/string.hpp> #include <stdexcept> #include <sstream> #include <iostream> @@ -58,6 +59,7 @@ using std::ostream; using boost::shared_ptr; using boost::optional; using boost::function; +using boost::algorithm::trim; using namespace dcp; /** Create a UUID. @@ -356,3 +358,13 @@ dcp::relative_to_root (boost::filesystem::path root, boost::filesystem::path fil return rel; } + +bool +dcp::ids_equal (string a, string b) +{ + transform (a.begin(), a.end(), a.begin(), ::tolower); + transform (b.begin(), b.end(), b.begin(), ::tolower); + trim (a); + trim (b); + return a == b; +} @@ -77,6 +77,7 @@ extern std::string content_kind_to_string (ContentKind kind); extern ContentKind content_kind_from_string (std::string kind); extern bool empty_or_white_space (std::string s); extern boost::shared_ptr<XYZFrame> decompress_j2k (uint8_t* data, int64_t size, int reduce); +extern bool ids_equal (std::string a, std::string b); extern void init (); |
