Mozilla/vtable_hide/string/nsCharTraits.h
darin%meer.net ed54e4945c vtable_hide
git-svn-id: svn://10.0.0.236/trunk@149976 18797224-902f-48f8-a5cc-f745e15eee43
2003-12-03 07:50:05 +00:00

41 lines
1.2 KiB
C++

/* vim:set ts=2 sw=2 et cindent: */
#ifndef nsCharTraits_h__
#define nsCharTraits_h__
#include "types.h" // XXX temporary
#include <string.h>
template <class T> struct nsCharTraits {};
NS_SPECIALIZE_TEMPLATE
struct nsCharTraits<char>
{
public:
typedef char char_type;
typedef PRInt32 (* comparator_func)
(const char_type *a, const char_type *b, int n);
static const char_type *empty_string;
static PRInt32 case_sensitive_comparator(const char_type *a,
const char_type *b, int n)
{ return (PRInt32) memcmp(a, b, n); }
static PRUint32 length_of(const char_type *data)
{ return (PRUint32) ::strlen(data); }
static void copy(char_type *dest, const char_type *src, PRUint32 len)
{ ::memcpy(dest, src, len); }
static void move(char_type *dest, const char_type *src, PRUint32 len)
{ ::memmove(dest, src, len); }
static const char_type *find_char(const char_type *start,
const char_type *end,
char_type c)
{ return (const char_type *) ::memchr(start, c, end - start); }
};
#endif // nsCharTraits_h__