LCOV - code coverage report
Current view: top level - dom/smil - nsSMILValue.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 9 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.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             : 
       7             : #ifndef NS_SMILVALUE_H_
       8             : #define NS_SMILVALUE_H_
       9             : 
      10             : #include "nsISMILType.h"
      11             : #include "nsSMILNullType.h"
      12             : 
      13             : /**
      14             :  * Although objects of this type are generally only created on the stack and
      15             :  * only exist during the taking of a new time sample, that's not always the
      16             :  * case. The nsSMILValue objects obtained from attributes' base values are
      17             :  * cached so that the SMIL engine can make certain optimizations during a
      18             :  * sample if the base value has not changed since the last sample (potentially
      19             :  * avoiding recomposing). These nsSMILValue objects typically live much longer
      20             :  * than a single sample.
      21             :  */
      22             : class nsSMILValue
      23             : {
      24             : public:
      25           0 :   nsSMILValue() : mU(), mType(nsSMILNullType::Singleton()) { }
      26             :   explicit nsSMILValue(const nsISMILType* aType);
      27             :   nsSMILValue(const nsSMILValue& aVal);
      28             : 
      29           0 :   ~nsSMILValue()
      30           0 :   {
      31           0 :     mType->Destroy(*this);
      32           0 :   }
      33             : 
      34             :   const nsSMILValue& operator=(const nsSMILValue& aVal);
      35             : 
      36             :   // Move constructor / reassignment operator:
      37             :   nsSMILValue(nsSMILValue&& aVal);
      38             :   nsSMILValue& operator=(nsSMILValue&& aVal);
      39             : 
      40             :   // Equality operators. These are allowed to be conservative (return false
      41             :   // more than you'd expect) - see comment above nsISMILType::IsEqual.
      42             :   bool operator==(const nsSMILValue& aVal) const;
      43           0 :   bool operator!=(const nsSMILValue& aVal) const {
      44           0 :     return !(*this == aVal);
      45             :   }
      46             : 
      47           0 :   bool IsNull() const
      48             :   {
      49           0 :     return (mType == nsSMILNullType::Singleton());
      50             :   }
      51             : 
      52             :   nsresult Add(const nsSMILValue& aValueToAdd, uint32_t aCount = 1);
      53             :   nsresult SandwichAdd(const nsSMILValue& aValueToAdd);
      54             :   nsresult ComputeDistance(const nsSMILValue& aTo, double& aDistance) const;
      55             :   nsresult Interpolate(const nsSMILValue& aEndVal,
      56             :                        double aUnitDistance,
      57             :                        nsSMILValue& aResult) const;
      58             : 
      59             :   union {
      60             :     bool mBool;
      61             :     uint64_t mUint;
      62             :     int64_t mInt;
      63             :     double mDouble;
      64             :     struct {
      65             :       float mAngle;
      66             :       uint16_t mUnit;
      67             :       uint16_t mOrientType;
      68             :     } mOrient;
      69             :     int32_t mIntPair[2];
      70             :     float mNumberPair[2];
      71             :     void* mPtr;
      72             :   } mU;
      73             :   const nsISMILType* mType;
      74             : 
      75             : protected:
      76             :   void InitAndCheckPostcondition(const nsISMILType* aNewType);
      77             :   void DestroyAndCheckPostcondition();
      78             :   void DestroyAndReinit(const nsISMILType* aNewType);
      79             : };
      80             : 
      81             : #endif  // NS_SMILVALUE_H_

Generated by: LCOV version 1.13