tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DDLifetime.cpp (994B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
      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 #include "DDLifetime.h"
      8 
      9 #include "mozilla/IntegerPrintfMacros.h"
     10 
     11 namespace mozilla {
     12 
     13 void DDLifetime::AppendPrintf(nsCString& aString) const {
     14  if (!mDerivedObject.Pointer()) {
     15    mObject.AppendPrintf(aString);
     16    aString.AppendPrintf("#%" PRIi32, mTag);
     17  } else {
     18    mDerivedObject.AppendPrintf(aString);
     19    aString.AppendPrintf("#%" PRIi32 " (as ", mTag);
     20    if (mObject.Pointer() == mDerivedObject.Pointer()) {
     21      aString.Append(mObject.TypeName());
     22    } else {
     23      mObject.AppendPrintf(aString);
     24    }
     25    aString.Append(")");
     26  }
     27 }
     28 
     29 nsCString DDLifetime::Printf() const {
     30  nsCString s;
     31  AppendPrintf(s);
     32  return s;
     33 }
     34 
     35 }  // namespace mozilla