~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/util/string.h

  • Committer: Monty Taylor
  • Date: 2010-08-12 20:27:32 UTC
  • mto: (1720.1.5 build)
  • mto: This revision was merged to the branch mainline in revision 1722.
  • Revision ID: mordred@inaugust.com-20100812202732-9kzchbkvkyki4n3u
Merged libdrizzle directly into tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 * Copyright (C) 2010 Brian Aker
 
4
 * Copyright (c) 2010, Brian Aker
5
5
 * All rights reserved.
6
6
 *
7
7
 * Redistribution and use in source and binary forms, with or without
36
36
#ifndef DRIZZLED_UTIL_STRING_H
37
37
#define DRIZZLED_UTIL_STRING_H
38
38
 
39
 
#include <utility>
40
39
#include <string>
41
 
#include <vector>
42
 
 
43
40
#include <boost/algorithm/string/predicate.hpp>
44
41
#include <boost/functional/hash.hpp>
45
 
#include <boost/shared_ptr.hpp>
46
42
 
47
43
namespace drizzled
48
44
{
50
46
namespace util
51
47
{
52
48
 
53
 
 
54
 
namespace string {
55
 
typedef boost::shared_ptr<std::string> shared_ptr;
56
 
typedef boost::shared_ptr<const std::string> const_shared_ptr;
57
 
typedef std::vector< std::string > vector;
58
 
}
59
 
 
60
49
struct insensitive_equal_to : std::binary_function<std::string, std::string, bool>
61
50
{
62
51
  bool operator()(std::string const& x, std::string const& y) const
81
70
  }
82
71
};
83
72
 
84
 
struct sensitive_hash : std::unary_function< std::vector<char>, std::size_t>
85
 
{
86
 
  std::size_t operator()(std::vector<char> const& x) const
87
 
  {
88
 
    std::size_t seed = 0;
89
 
 
90
 
    for(std::vector<char>::const_iterator it = x.begin(); it != x.end(); ++it)
91
 
    {
92
 
      boost::hash_combine(seed, *it);
93
 
    }
94
 
 
95
 
    return seed;
96
 
  }
97
 
};
98
 
 
99
73
} /* namespace util */
100
74
} /* namespace drizzled */
101
75