LCOV - code coverage report
Current view: directory - content/smil - nsSMILValue.h (source / functions) Found Hit Coverage
Test: app.info Lines: 8 0 0.0 %
Date: 2012-06-02 Functions: 4 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is the Mozilla SMIL module.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is Brian Birtles.
      18                 :  * Portions created by the Initial Developer are Copyright (C) 2006
      19                 :  * the Initial Developer. All Rights Reserved.
      20                 :  *
      21                 :  * Contributor(s):
      22                 :  *   Robert O'Callahan <roc+moz@cs.cmu.edu>
      23                 :  *   Brian Birtles <birtles@gmail.com>
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #ifndef NS_SMILVALUE_H_
      40                 : #define NS_SMILVALUE_H_
      41                 : 
      42                 : #include "nsISMILType.h"
      43                 : #include "nsSMILNullType.h"
      44                 : 
      45                 : /**
      46                 :  * Although objects of this type are generally only created on the stack and
      47                 :  * only exist during the taking of a new time sample, that's not always the
      48                 :  * case. The nsSMILValue objects obtained from attributes' base values are
      49                 :  * cached so that the SMIL engine can make certain optimizations during a
      50                 :  * sample if the base value has not changed since the last sample (potentially
      51                 :  * avoiding recomposing). These nsSMILValue objects typically live much longer
      52                 :  * than a single sample.
      53                 :  */
      54                 : class nsSMILValue
      55                 : {
      56                 : public:
      57               0 :   nsSMILValue() : mU(), mType(&nsSMILNullType::sSingleton) { }
      58                 :   explicit nsSMILValue(const nsISMILType* aType);
      59                 :   nsSMILValue(const nsSMILValue& aVal);
      60                 : 
      61               0 :   ~nsSMILValue()
      62                 :   {
      63               0 :     mType->Destroy(*this);
      64               0 :   }
      65                 : 
      66                 :   const nsSMILValue& operator=(const nsSMILValue& aVal);
      67                 : 
      68                 :   // Equality operators. These are allowed to be conservative (return false
      69                 :   // more than you'd expect) - see comment above nsISMILType::IsEqual.
      70                 :   bool operator==(const nsSMILValue& aVal) const;
      71               0 :   bool operator!=(const nsSMILValue& aVal) const {
      72               0 :     return !(*this == aVal);
      73                 :   }
      74                 : 
      75               0 :   bool IsNull() const
      76                 :   {
      77               0 :     return (mType == &nsSMILNullType::sSingleton);
      78                 :   }
      79                 : 
      80                 :   // Swaps the member data (mU & mPtr) of |this| with |aOther|
      81                 :   void     Swap(nsSMILValue& aOther);
      82                 : 
      83                 :   nsresult Add(const nsSMILValue& aValueToAdd, PRUint32 aCount = 1);
      84                 :   nsresult SandwichAdd(const nsSMILValue& aValueToAdd);
      85                 :   nsresult ComputeDistance(const nsSMILValue& aTo, double& aDistance) const;
      86                 :   nsresult Interpolate(const nsSMILValue& aEndVal,
      87                 :                        double aUnitDistance,
      88                 :                        nsSMILValue& aResult) const;
      89                 : 
      90                 :   union {
      91                 :     bool mBool;
      92                 :     PRUint64 mUint;
      93                 :     PRInt64 mInt;
      94                 :     double mDouble;
      95                 :     struct {
      96                 :       float mAngle;
      97                 :       PRUint16 mUnit;
      98                 :       PRUint16 mOrientType;
      99                 :     } mOrient;
     100                 :     PRInt32 mIntPair[2];
     101                 :     float mNumberPair[2];
     102                 :     void* mPtr;
     103                 :   } mU;
     104                 :   const nsISMILType* mType;
     105                 : 
     106                 : protected:
     107                 :   void InitAndCheckPostcondition(const nsISMILType* aNewType);
     108                 :   void DestroyAndCheckPostcondition();
     109                 :   void DestroyAndReinit(const nsISMILType* aNewType);
     110                 : };
     111                 : 
     112                 : #endif  // NS_SMILVALUE_H_

Generated by: LCOV version 1.7