strfunc.h

Engine/source/persistence/rapidjson/internal/strfunc.h

More...

Namespaces:

Detailed Description

 1
 2#ifndef RAPIDJSON_INTERNAL_STRFUNC_H_
 3#define RAPIDJSON_INTERNAL_STRFUNC_H_
 4
 5namespace rapidjson {
 6namespace internal {
 7
 8//! Custom strlen() which works on different character types.
 9/*!   \tparam Ch Character type (e.g. char, wchar_t, short)
10   \param s Null-terminated input string.
11   \return Number of characters in the string. 
12   \note This has the same semantics as strlen(), the return value is not number of Unicode codepoints.
13*/
14template <typename Ch>
15inline SizeType StrLen(const Ch* s) {
16   const Ch* p = s;
17   while (*p != '\0')
18      ++p;
19   return SizeType(p - s);
20}
21
22} // namespace internal
23} // namespace rapidjson
24
25#endif // RAPIDJSON_INTERNAL_STRFUNC_H_
26