~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/utf8/utf8.h

  • Committer: Monty Taylor
  • Date: 2010-06-03 20:42:25 UTC
  • mto: (1596.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1597.
  • Revision ID: mordred@inaugust.com-20100603204225-enon697al4spxe9a
Added unittests for utf8 header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
}
72
72
 
73
73
/**
74
 
 * Is this code unit (byte) a UTF-8 lead byte?
75
 
 * @param c 8-bit code unit (byte)
76
 
 * @return TRUE or FALSE
77
 
 */
78
 
template <class T>
79
 
bool is_lead(T c)
80
 
{
81
 
  return (static_cast<uint8_t>(c) - 0xc0) < 0x3e;
82
 
}
83
 
 
84
 
 
85
 
/**
86
 
 * Is this code unit (byte) a UTF-8 trail byte?
87
 
 * @param c 8-bit code unit (byte)
88
 
 * @return TRUE or FALSE
89
 
 */
90
 
template <class T>
91
 
bool is_trail(T c)
92
 
{
93
 
  return (static_cast<uint8_t>(c) & 0xc0) == 0x80;
94
 
}
95
 
 
96
 
/**
97
74
 * How many code units (bytes) are used for the UTF-8 encoding
98
75
 * of this Unicode code point?
99
76
 * @param c 32-bit code point