LCOV - code coverage report
Current view: top level - xpcom/string - nsTDependentSubstring.h (source / functions) Hit Total Coverage
Test: output.info Lines: 22 22 100.0 %
Date: 2017-07-14 16:53:18 Functions: 16 20 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       6             : // IWYU pragma: private, include "nsString.h"
       7             : 
       8             : /**
       9             :  * nsTDependentSubstring_CharT
      10             :  *
      11             :  * A string class which wraps an external array of string characters. It
      12             :  * is the client code's responsibility to ensure that the external buffer
      13             :  * remains valid for a long as the string is alive.
      14             :  *
      15             :  * NAMES:
      16             :  *   nsDependentSubstring for wide characters
      17             :  *   nsDependentCSubstring for narrow characters
      18             :  */
      19      171684 : class nsTDependentSubstring_CharT : public nsTSubstring_CharT
      20             : {
      21             : public:
      22             : 
      23             :   typedef nsTDependentSubstring_CharT self_type;
      24             : 
      25             : public:
      26             : 
      27             :   void Rebind(const substring_type&, uint32_t aStartPos,
      28             :               uint32_t aLength = size_type(-1));
      29             : 
      30             :   void Rebind(const char_type* aData, size_type aLength);
      31             : 
      32             :   void Rebind(const char_type* aStart, const char_type* aEnd);
      33             : 
      34       54099 :   nsTDependentSubstring_CharT(const substring_type& aStr, uint32_t aStartPos,
      35             :                               uint32_t aLength = size_type(-1))
      36       54099 :     : substring_type()
      37             :   {
      38       54099 :     Rebind(aStr, aStartPos, aLength);
      39       54099 :   }
      40             : 
      41         260 :   nsTDependentSubstring_CharT(const char_type* aData, size_type aLength)
      42         260 :     : substring_type(const_cast<char_type*>(aData), aLength,
      43         260 :                      DataFlags(0), ClassFlags(0))
      44             :   {
      45         260 :   }
      46             : 
      47             :   nsTDependentSubstring_CharT(const char_type* aStart, const char_type* aEnd);
      48             : 
      49             : #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
      50             :   nsTDependentSubstring_CharT(char16ptr_t aData, size_type aLength)
      51             :     : nsTDependentSubstring_CharT(static_cast<const char16_t*>(aData), aLength)
      52             :   {
      53             :   }
      54             : 
      55             :   nsTDependentSubstring_CharT(char16ptr_t aStart, char16ptr_t aEnd);
      56             : #endif
      57             : 
      58             :   nsTDependentSubstring_CharT(const const_iterator& aStart,
      59             :                               const const_iterator& aEnd);
      60             : 
      61             :   // Create a nsTDependentSubstring to be bound later
      62       90491 :   nsTDependentSubstring_CharT()
      63       90491 :     : substring_type()
      64             :   {
      65       90491 :   }
      66             : 
      67             :   // auto-generated copy-constructor OK (XXX really?? what about base class copy-ctor?)
      68             : 
      69             : private:
      70             :   // NOT USED
      71             :   void operator=(const self_type&);  // we're immutable, you can't assign into a substring
      72             : };
      73             : 
      74             : inline const nsTDependentSubstring_CharT
      75       53831 : Substring(const nsTSubstring_CharT& aStr, uint32_t aStartPos,
      76             :           uint32_t aLength = uint32_t(-1))
      77             : {
      78       53831 :   return nsTDependentSubstring_CharT(aStr, aStartPos, aLength);
      79             : }
      80             : 
      81             : inline const nsTDependentSubstring_CharT
      82        9334 : Substring(const nsReadingIterator<CharT>& aStart,
      83             :           const nsReadingIterator<CharT>& aEnd)
      84             : {
      85        9334 :   return nsTDependentSubstring_CharT(aStart.get(), aEnd.get());
      86             : }
      87             : 
      88             : inline const nsTDependentSubstring_CharT
      89          56 : Substring(const CharT* aData, uint32_t aLength)
      90             : {
      91          56 :   return nsTDependentSubstring_CharT(aData, aLength);
      92             : }
      93             : 
      94             : const nsTDependentSubstring_CharT
      95             : Substring(const CharT* aStart, const CharT* aEnd);
      96             : 
      97             : inline const nsTDependentSubstring_CharT
      98         264 : StringHead(const nsTSubstring_CharT& aStr, uint32_t aCount)
      99             : {
     100         264 :   return nsTDependentSubstring_CharT(aStr, 0, aCount);
     101             : }
     102             : 
     103             : inline const nsTDependentSubstring_CharT
     104           3 : StringTail(const nsTSubstring_CharT& aStr, uint32_t aCount)
     105             : {
     106           3 :   return nsTDependentSubstring_CharT(aStr, aStr.Length() - aCount, aCount);
     107             : }

Generated by: LCOV version 1.13