~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/util/string.h

  • Committer: patrick crews
  • Date: 2010-09-29 15:15:19 UTC
  • mfrom: (1099.4.188 drizzle)
  • Revision ID: gleebix@gmail.com-20100929151519-6mrmzd1ciw2p9nws
Tags: 2010.09.1802
Update translations

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
 
}
58
 
 
59
49
struct insensitive_equal_to : std::binary_function<std::string, std::string, bool>
60
50
{
61
51
  bool operator()(std::string const& x, std::string const& y) const
80
70
  }
81
71
};
82
72
 
83
 
struct sensitive_hash : std::unary_function< std::vector<char>, std::size_t>
84
 
{
85
 
  std::size_t operator()(std::vector<char> const& x) const
86
 
  {
87
 
    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
 
 
94
 
    return seed;
95
 
  }
96
 
};
97
 
 
98
73
} /* namespace util */
99
74
} /* namespace drizzled */
100
75