32#ifndef _RWSTD_RW_STRREF_H_INCLUDED
33#define _RWSTD_RW_STRREF_H_INCLUDED
35#ifndef _RWSTD_RW_ALLOCATOR_H_INCLUDED
39#ifndef _RWSTD_RW_MUTEX_H_INCLUDED
43#ifndef _RWSTD_RW_SPECIALIZED_H_INCLUDED
47#ifndef _RWSTD_RW_TRAITS_H_INCLUDED
52#if !defined(_RWSTD_STRING_REF_OFFSET)
53# define _RWSTD_STRING_REF_OFFSET 1
56#if !defined(_RWSTD_STRING_REF_INT)
57# define _RWSTD_STRING_REF_INT long
60#if !defined (_RWSTD_NO_ATOMIC_OPS) && !defined (_RWSTD_NO_STRING_ATOMIC_OPS)
62# ifndef _RWSTD_NO_STRING_MUTEX
63# define _RWSTD_NO_STRING_MUTEX
73#if !defined (_RWSTD_REENTRANT) || defined (_RWSTD_NO_STRING_MUTEX)
74# define _RWSTD_STRING_MUTEX(ignore) false
75#elif defined (_RWSTD_ONE_STRING_MUTEX)
76# define _RWSTD_STRING_MUTEX(ignore) __rw_string_mutex
78# define _RWSTD_STRING_MUTEX(pstr) pstr->_C_mutex
82template <
class _CharT,
83 class _Traits = char_traits<_CharT>,
84 class _Allocator = allocator<_CharT> >
94#if defined (_RWSTD_REENTRANT) \
95 && defined (_RWSTD_ONE_STRING_MUTEX) \
96 && !defined (_RWSTD_NO_STRING_MUTEX)
103template <
class _CharT,
class _Traits ,
class _Allocator>
106 typedef _CharT char_type;
107 typedef _Allocator allocator_type;
108 typedef typename allocator_type::size_type size_type;
109 typedef _STD::basic_string<_CharT, _Traits, _Allocator> string_type;
111#if defined (_RWSTD_REENTRANT) \
112 && !defined (_RWSTD_ONE_STRING_MUTEX) \
113 && !defined (_RWSTD_NO_STRING_MUTEX) \
114 && !defined (_RWSTD_NO_STATIC_MUTEX_INIT)
116 void _C_init (size_type __cap, size_type __size) {
119 _C_size._C_size = __size;
121# ifndef _RWSTD_NO_STRING_REF_COUNT
127 "synchronization error");
134# ifndef _RWSTD_NO_STRING_REF_COUNT
141 void _C_init (size_type __cap, size_type __size) {
143# ifndef _RWSTD_NO_STRING_REF_COUNT
148 _C_size._C_size = __size;
151 void _C_destroy () { }
157 int _C_get_ref ()
const {
159# ifndef _RWSTD_NO_STRING_REF_COUNT
173#ifndef _RWSTD_NO_STRING_REF_COUNT
176 if (
this != string_type::_C_nullref ())
184#ifndef _RWSTD_NO_STRING_REF_COUNT
186 return this == string_type::_C_nullref () ? 1 :
190 return 0 + (
this != string_type::_C_nullref ());
197#ifndef _RWSTD_NO_STRING_REF_COUNT
199 return this == string_type::_C_nullref () ? 1 :
205 return 0 + (
this == string_type::_C_nullref ());
210 size_type
size ()
const {
211 return _C_size._C_size;
214 size_type capacity ()
const {
222 const char_type*
data ()
const {
226#ifndef _RWSTD_NO_STRING_REF_COUNT
228# if defined (_RWSTD_REENTRANT) \
229 && !defined (_RWSTD_ONE_STRING_MUTEX) \
230 && !defined (_RWSTD_NO_STRING_MUTEX)
232 __rw_mutex_base _C_mutex;
255template <
class _CharT,
class _Traits ,
class _Allocator>
257 : __string_ref<_CharT, _Traits , _Allocator>
264#ifdef _RWSTD_NO_COLLAPSE_TEMPLATE_STATICS
#define _RWSTD_REINTERPRET_CAST(T, x)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_STRING_ATOMIC_PREDECREMENT(x, mutex)
#define _RWSTD_STRING_ATOMIC_PREINCREMENT(x, mutex)
#define _RWSTD_ERROR_RUNTIME_ERROR
#define _RWSTD_MUTEX_DESTROY(mutex)
#define _RWSTD_MUTEX_INIT(mutex)
#define _RWSTD_STRING_REF_OFFSET
#define _RWSTD_STRING_MUTEX(ignore)