Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/nsTSubstringTuple.h
Line
Count
Source
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
#ifndef nsTSubstringTuple_h
9
#define nsTSubstringTuple_h
10
11
#include "mozilla/Attributes.h"
12
#include "nsTStringRepr.h"
13
14
/**
15
 * nsTSubstringTuple
16
 *
17
 * Represents a tuple of string fragments.  Built as a recursive binary tree.
18
 * It is used to implement the concatenation of two or more string objects.
19
 *
20
 * NOTE: This class is a private implementation detail and should never be
21
 * referenced outside the string code.
22
 */
23
template <typename T>
24
class MOZ_TEMPORARY_CLASS nsTSubstringTuple
25
{
26
public:
27
28
  typedef T char_type;
29
  typedef nsCharTraits<char_type> char_traits;
30
31
  typedef nsTSubstringTuple<T> self_type;
32
  typedef mozilla::detail::nsTStringRepr<char_type> base_string_type;
33
  typedef uint32_t size_type;
34
35
public:
36
37
  nsTSubstringTuple(const base_string_type* aStrA,
38
                    const base_string_type* aStrB)
39
    : mHead(nullptr)
40
    , mFragA(aStrA)
41
    , mFragB(aStrB)
42
37.1k
  {
43
37.1k
  }
nsTSubstringTuple<char16_t>::nsTSubstringTuple(mozilla::detail::nsTStringRepr<char16_t> const*, mozilla::detail::nsTStringRepr<char16_t> const*)
Line
Count
Source
42
15
  {
43
15
  }
nsTSubstringTuple<char>::nsTSubstringTuple(mozilla::detail::nsTStringRepr<char> const*, mozilla::detail::nsTStringRepr<char> const*)
Line
Count
Source
42
37.1k
  {
43
37.1k
  }
44
45
  nsTSubstringTuple(const self_type& aHead,
46
                    const base_string_type* aStrB)
47
    : mHead(&aHead)
48
    , mFragA(nullptr) // this fragment is ignored when aHead != nullptr
49
    , mFragB(aStrB)
50
5.58k
  {
51
5.58k
  }
Unexecuted instantiation: nsTSubstringTuple<char16_t>::nsTSubstringTuple(nsTSubstringTuple<char16_t> const&, mozilla::detail::nsTStringRepr<char16_t> const*)
nsTSubstringTuple<char>::nsTSubstringTuple(nsTSubstringTuple<char> const&, mozilla::detail::nsTStringRepr<char> const*)
Line
Count
Source
50
5.58k
  {
51
5.58k
  }
52
53
  /**
54
   * computes the aggregate string length
55
   */
56
  size_type Length() const;
57
58
  /**
59
   * writes the aggregate string to the given buffer.  bufLen is assumed
60
   * to be equal to or greater than the value returned by the Length()
61
   * method.  the string written to |buf| is not null-terminated.
62
   */
63
  void WriteTo(char_type* aBuf, uint32_t aBufLen) const;
64
65
  /**
66
   * returns true if this tuple is dependent on (i.e., overlapping with)
67
   * the given char sequence.
68
   */
69
  bool IsDependentOn(const char_type* aStart, const char_type* aEnd) const;
70
71
private:
72
73
  const self_type*        const mHead;
74
  const base_string_type* const mFragA;
75
  const base_string_type* const mFragB;
76
};
77
78
template <typename T>
79
inline const nsTSubstringTuple<T>
80
operator+(const mozilla::detail::nsTStringRepr<T>& aStrA,
81
          const mozilla::detail::nsTStringRepr<T>& aStrB)
82
37.1k
{
83
37.1k
  return nsTSubstringTuple<T>(&aStrA, &aStrB);
84
37.1k
}
nsTSubstringTuple<char16_t> const operator+<char16_t>(mozilla::detail::nsTStringRepr<char16_t> const&, mozilla::detail::nsTStringRepr<char16_t> const&)
Line
Count
Source
82
15
{
83
15
  return nsTSubstringTuple<T>(&aStrA, &aStrB);
84
15
}
nsTSubstringTuple<char> const operator+<char>(mozilla::detail::nsTStringRepr<char> const&, mozilla::detail::nsTStringRepr<char> const&)
Line
Count
Source
82
37.1k
{
83
37.1k
  return nsTSubstringTuple<T>(&aStrA, &aStrB);
84
37.1k
}
85
86
template <typename T>
87
inline const nsTSubstringTuple<T>
88
operator+(const nsTSubstringTuple<T>& aHead,
89
          const mozilla::detail::nsTStringRepr<T>& aStrB)
90
5.58k
{
91
5.58k
  return nsTSubstringTuple<T>(aHead, &aStrB);
92
5.58k
}
Unexecuted instantiation: nsTSubstringTuple<char16_t> const operator+<char16_t>(nsTSubstringTuple<char16_t> const&, mozilla::detail::nsTStringRepr<char16_t> const&)
nsTSubstringTuple<char> const operator+<char>(nsTSubstringTuple<char> const&, mozilla::detail::nsTStringRepr<char> const&)
Line
Count
Source
90
5.58k
{
91
5.58k
  return nsTSubstringTuple<T>(aHead, &aStrB);
92
5.58k
}
93
94
#endif