~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/util/string.h

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

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>
39
40
#include <string>
 
41
#include <vector>
 
42
 
40
43
#include <boost/algorithm/string/predicate.hpp>
41
44
#include <boost/functional/hash.hpp>
 
45
#include <boost/shared_ptr.hpp>
42
46
 
43
47
namespace drizzled
44
48
{
46
50
namespace util
47
51
{
48
52
 
 
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
 
49
60
struct insensitive_equal_to : std::binary_function<std::string, std::string, bool>
50
61
{
51
62
  bool operator()(std::string const& x, std::string const& y) const
70
81
  }
71
82
};
72
83
 
 
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
 
73
99
} /* namespace util */
74
100
} /* namespace drizzled */
75
101