LCOV - code coverage report
Current view: top level - xpcom/string - nsTDependentString.h (source / functions) Hit Total Coverage
Test: output.info Lines: 19 22 86.4 %
Date: 2017-07-14 16:53:18 Functions: 9 14 64.3 %
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             : 
       7             : 
       8             : /**
       9             :  * nsTDependentString_CharT
      10             :  *
      11             :  * Stores a null-terminated, immutable sequence of characters.
      12             :  *
      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.
      18             :  */
      19       73124 : class nsTDependentString_CharT : public nsTString_CharT
      20             : {
      21             : public:
      22             : 
      23             :   typedef nsTDependentString_CharT self_type;
      24             : 
      25             : public:
      26             : 
      27             :   /**
      28             :    * constructors
      29             :    */
      30             : 
      31             :   nsTDependentString_CharT(const char_type* aStart, const char_type* aEnd);
      32             : 
      33       14164 :   nsTDependentString_CharT(const char_type* aData, uint32_t aLength)
      34       14164 :     : string_type(const_cast<char_type*>(aData), aLength,
      35       14164 :                   DataFlags::TERMINATED, ClassFlags(0))
      36             :   {
      37       14164 :     AssertValidDependentString();
      38       14164 :   }
      39             : 
      40             : #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
      41             :   nsTDependentString_CharT(char16ptr_t aData, uint32_t aLength)
      42             :     : nsTDependentString_CharT(static_cast<const char16_t*>(aData), aLength)
      43             :   {
      44             :   }
      45             : #endif
      46             : 
      47             :   explicit
      48       62111 :   nsTDependentString_CharT(const char_type* aData)
      49       62111 :     : string_type(const_cast<char_type*>(aData),
      50       62111 :                   uint32_t(char_traits::length(aData)),
      51       62111 :                   DataFlags::TERMINATED, ClassFlags(0))
      52             :   {
      53       62111 :     AssertValidDependentString();
      54       62111 :   }
      55             : 
      56             : #if defined(CharT_is_PRUnichar) && defined(MOZ_USE_CHAR16_WRAPPER)
      57             :   explicit
      58             :   nsTDependentString_CharT(char16ptr_t aData)
      59             :     : nsTDependentString_CharT(static_cast<const char16_t*>(aData))
      60             :   {
      61             :   }
      62             : #endif
      63             : 
      64        1249 :   nsTDependentString_CharT(const string_type& aStr, uint32_t aStartPos)
      65        1249 :     : string_type()
      66             :   {
      67        1249 :     Rebind(aStr, aStartPos);
      68        1249 :   }
      69             : 
      70             :   // Create a nsTDependentSubstring to be bound later
      71          13 :   nsTDependentString_CharT()
      72          13 :     : string_type()
      73             :   {
      74          13 :   }
      75             : 
      76             :   // XXX are you sure??
      77             :   // auto-generated copy-constructor OK
      78             :   // auto-generated copy-assignment operator OK
      79             :   // auto-generated destructor OK
      80             : 
      81             : 
      82             :   /**
      83             :    * allow this class to be bound to a different string...
      84             :    */
      85             : 
      86             :   using nsTString_CharT::Rebind;
      87           0 :   void Rebind(const char_type* aData)
      88             :   {
      89           0 :     Rebind(aData, uint32_t(char_traits::length(aData)));
      90           0 :   }
      91             : 
      92             :   void Rebind(const char_type* aStart, const char_type* aEnd);
      93             :   void Rebind(const string_type&, uint32_t aStartPos);
      94             : 
      95             : private:
      96             : 
      97             :   // NOT USED
      98             :   nsTDependentString_CharT(const substring_tuple_type&) = delete;
      99             : };

Generated by: LCOV version 1.13