~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/util/string.h

  • Committer: Lee Bieber
  • Date: 2011-03-16 16:39:32 UTC
  • mfrom: (2239.1.11 includes)
  • mto: This revision was merged to the branch mainline in revision 2240.
  • Revision ID: kalebral@gmail.com-20110316163932-ckt3uulj4pimqs8b
Merge Olaf - refactor includes

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include <vector>
41
41
 
42
42
#include <boost/algorithm/string/predicate.hpp>
 
43
#include <boost/foreach.hpp>
43
44
#include <boost/functional/hash.hpp>
44
45
#include <boost/shared_ptr.hpp>
45
46
 
46
 
namespace drizzled
47
 
{
48
 
 
49
 
namespace util
50
 
{
51
 
 
52
 
 
53
 
namespace string {
54
 
typedef boost::shared_ptr<std::string> shared_ptr;
55
 
typedef boost::shared_ptr<const std::string> const_shared_ptr;
56
 
typedef std::vector< std::string > vector;
 
47
namespace drizzled {
 
48
namespace util {
 
49
 
 
50
namespace string 
 
51
{
 
52
  typedef boost::shared_ptr<std::string> shared_ptr;
 
53
  typedef boost::shared_ptr<const std::string> const_shared_ptr;
 
54
  typedef std::vector<std::string> vector;
57
55
}
58
56
 
59
57
struct insensitive_equal_to : std::binary_function<std::string, std::string, bool>
60
58
{
61
59
  bool operator()(std::string const& x, std::string const& y) const
62
60
  {
63
 
    return boost::algorithm::iequals(x, y, std::locale());
 
61
    return boost::algorithm::iequals(x, y);
64
62
  }
65
63
};
66
64
 
69
67
  std::size_t operator()(std::string const& x) const
70
68
  {
71
69
    std::size_t seed = 0;
72
 
    std::locale locale;
73
 
 
74
 
    for(std::string::const_iterator it = x.begin(); it != x.end(); ++it)
75
 
    {
76
 
      boost::hash_combine(seed, std::toupper(*it, locale));
77
 
    }
78
 
 
 
70
    BOOST_FOREACH(std::string::const_reference it, x)
 
71
      boost::hash_combine(seed, std::toupper(it));
79
72
    return seed;
80
73
  }
81
74
};
85
78
  std::size_t operator()(std::vector<char> const& x) const
86
79
  {
87
80
    std::size_t seed = 0;
88
 
 
89
 
    for(std::vector<char>::const_iterator it = x.begin(); it != x.end(); ++it)
90
 
    {
91
 
      boost::hash_combine(seed, *it);
92
 
    }
93
 
 
 
81
    BOOST_FOREACH(std::vector<char>::const_reference it, x)
 
82
      boost::hash_combine(seed, it);
94
83
    return seed;
95
84
  }
96
85
};