xpcom/string/public/nsTDependentString.h

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7
michael@0 8 /**
michael@0 9 * nsTDependentString_CharT
michael@0 10 *
michael@0 11 * Stores a null-terminated, immutable sequence of characters.
michael@0 12 *
michael@0 13 * Subclass of nsTString that restricts string value to an immutable
michael@0 14 * character sequence. This class does not own its data, so the creator
michael@0 15 * of objects of this type must take care to ensure that a
michael@0 16 * nsTDependentString continues to reference valid memory for the
michael@0 17 * duration of its use.
michael@0 18 */
michael@0 19 class nsTDependentString_CharT : public nsTString_CharT
michael@0 20 {
michael@0 21 public:
michael@0 22
michael@0 23 typedef nsTDependentString_CharT self_type;
michael@0 24
michael@0 25 public:
michael@0 26
michael@0 27 /**
michael@0 28 * constructors
michael@0 29 */
michael@0 30
michael@0 31 nsTDependentString_CharT( const char_type* start, const char_type* end )
michael@0 32 : string_type(const_cast<char_type*>(start), uint32_t(end - start), F_TERMINATED)
michael@0 33 {
michael@0 34 AssertValidDepedentString();
michael@0 35 }
michael@0 36
michael@0 37 nsTDependentString_CharT( const char_type* data, uint32_t length )
michael@0 38 : string_type(const_cast<char_type*>(data), length, F_TERMINATED)
michael@0 39 {
michael@0 40 AssertValidDepedentString();
michael@0 41 }
michael@0 42
michael@0 43 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
michael@0 44 nsTDependentString_CharT( char16ptr_t data, uint32_t length )
michael@0 45 : nsTDependentString_CharT(static_cast<const char16_t*>(data), length) {}
michael@0 46 #endif
michael@0 47
michael@0 48 explicit
michael@0 49 nsTDependentString_CharT( const char_type* data )
michael@0 50 : string_type(const_cast<char_type*>(data), uint32_t(char_traits::length(data)), F_TERMINATED)
michael@0 51 {
michael@0 52 AssertValidDepedentString();
michael@0 53 }
michael@0 54
michael@0 55 #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
michael@0 56 explicit
michael@0 57 nsTDependentString_CharT( char16ptr_t data )
michael@0 58 : nsTDependentString_CharT( static_cast<const char16_t*>(data)) {}
michael@0 59 #endif
michael@0 60
michael@0 61 nsTDependentString_CharT( const string_type& str, uint32_t startPos )
michael@0 62 : string_type()
michael@0 63 {
michael@0 64 Rebind(str, startPos);
michael@0 65 }
michael@0 66
michael@0 67 // Create a nsTDependentSubstring to be bound later
michael@0 68 nsTDependentString_CharT()
michael@0 69 : string_type() {}
michael@0 70
michael@0 71 // XXX are you sure??
michael@0 72 // auto-generated copy-constructor OK
michael@0 73 // auto-generated copy-assignment operator OK
michael@0 74 // auto-generated destructor OK
michael@0 75
michael@0 76
michael@0 77 /**
michael@0 78 * allow this class to be bound to a different string...
michael@0 79 */
michael@0 80
michael@0 81 using nsTString_CharT::Rebind;
michael@0 82 void Rebind( const char_type* data )
michael@0 83 {
michael@0 84 Rebind(data, uint32_t(char_traits::length(data)));
michael@0 85 }
michael@0 86
michael@0 87 void Rebind( const char_type* start, const char_type* end )
michael@0 88 {
michael@0 89 Rebind(start, uint32_t(end - start));
michael@0 90 }
michael@0 91
michael@0 92 void Rebind( const string_type&, uint32_t startPos );
michael@0 93
michael@0 94 private:
michael@0 95
michael@0 96 // NOT USED
michael@0 97 nsTDependentString_CharT( const substring_tuple_type& );
michael@0 98 };

mercurial