aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/enum.cxx
blob: b9a62047f46069427ca2b212fbda1e136f1b96d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// file      : odb/mysql/enums.cxx
// copyright : Copyright (c) 2005-2018 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#include <cstring> // std::memmove
#include <cassert>

#include <odb/mysql/enum.hxx>

namespace odb
{
  namespace mysql
  {
    void enum_traits::
    strip_value (const details::buffer& i, unsigned long& size)
    {
      char* d (const_cast<char*> (i.data ()));

      unsigned long p (0);
      for (; p < size && d[p] != ' '; ++p) ;
      assert (p != size);

      p++; // Skip space;
      size -= p;

      std::memmove (d, d + p, size);
    }
  }
}