~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/util/data_ref.h

  • Committer: Mark Atwood
  • Date: 2011-10-14 15:59:08 UTC
  • mfrom: (2430.1.12 refactor3a)
  • Revision ID: me@mark.atwood.name-20111014155908-whqmrmaf2grpsg5c
mergeĀ lp:~olafvdspek/drizzle/refactor3

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#include <cstddef>
21
21
#include <cstring>
22
22
#include <ostream>
 
23
#include <string>
23
24
 
24
25
template <class T>
25
26
class data_ref_basic
96
97
  {
97
98
    return begin() == end();
98
99
  }
99
 
 
100
 
  friend std::ostream& operator<<(std::ostream& os, data_ref_basic<T> v)
101
 
  {
102
 
    os.write(v.data(), v.size());
103
 
    return os;
104
 
  }
105
100
private:
106
101
  T begin_;
107
102
  T end_;
109
104
 
110
105
typedef data_ref_basic<const unsigned char*> data_ref;
111
106
typedef data_ref_basic<const char*> str_ref;
 
107
 
 
108
inline std::ostream& operator<<(std::ostream& os, str_ref v)
 
109
{
 
110
  os.write(v.data(), v.size());
 
111
  return os;
 
112
}
 
113
 
 
114
inline std::string to_string(str_ref v)
 
115
{
 
116
  return std::string(v.data(), v.size());
 
117
}