1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 * nsTDependentString_CharT
11 * Stores a null-terminated, immutable sequence of characters.
13 * Subclass of nsTString that restricts string value to an immutable
14 * character sequence. This class does not own its data, so the creator
15 * of objects of this type must take care to ensure that a
16 * nsTDependentString continues to reference valid memory for the
17 * duration of its use.
19 class nsTDependentString_CharT
: public nsTString_CharT
23 typedef nsTDependentString_CharT self_type
;
31 nsTDependentString_CharT(const char_type
* aStart
, const char_type
* aEnd
);
33 nsTDependentString_CharT(const char_type
* aData
, uint32_t aLength
)
34 : string_type(const_cast<char_type
*>(aData
), aLength
, F_TERMINATED
)
36 AssertValidDependentString();
39 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
40 nsTDependentString_CharT(char16ptr_t aData
, uint32_t aLength
)
41 : nsTDependentString_CharT(static_cast<const char16_t
*>(aData
), aLength
)
47 nsTDependentString_CharT(const char_type
* aData
)
48 : string_type(const_cast<char_type
*>(aData
),
49 uint32_t(char_traits::length(aData
)), F_TERMINATED
)
51 AssertValidDependentString();
54 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
56 nsTDependentString_CharT(char16ptr_t aData
)
57 : nsTDependentString_CharT(static_cast<const char16_t
*>(aData
))
62 nsTDependentString_CharT(const string_type
& aStr
, uint32_t aStartPos
)
65 Rebind(aStr
, aStartPos
);
68 // Create a nsTDependentSubstring to be bound later
69 nsTDependentString_CharT()
75 // auto-generated copy-constructor OK
76 // auto-generated copy-assignment operator OK
77 // auto-generated destructor OK
81 * allow this class to be bound to a different string...
84 using nsTString_CharT::Rebind
;
85 void Rebind(const char_type
* aData
)
87 Rebind(aData
, uint32_t(char_traits::length(aData
)));
90 void Rebind(const char_type
* aStart
, const char_type
* aEnd
);
91 void Rebind(const string_type
&, uint32_t aStartPos
);
96 nsTDependentString_CharT(const substring_tuple_type
&) = delete;