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 DOM_SMIL_SMILNULLTYPE_H_
8 #define DOM_SMIL_SMILNULLTYPE_H_
9 
10 #include "mozilla/Attributes.h"
11 #include "mozilla/SMILType.h"
12 
13 namespace mozilla {
14 
15 class SMILNullType : public SMILType {
16  public:
17   // Singleton for SMILValue objects to hold onto.
18   static SMILNullType* Singleton();
19 
20  protected:
21   // SMILType Methods
22   // -------------------
Init(SMILValue & aValue)23   virtual void Init(SMILValue& aValue) const override {}
Destroy(SMILValue & aValue)24   virtual void Destroy(SMILValue& aValue) const override {}
25   virtual nsresult Assign(SMILValue& aDest,
26                           const SMILValue& aSrc) const override;
27 
28   // The remaining methods should never be called, so although they're very
29   // simple they don't need to be inline.
30   virtual bool IsEqual(const SMILValue& aLeft,
31                        const SMILValue& aRight) const override;
32   virtual nsresult Add(SMILValue& aDest, const SMILValue& aValueToAdd,
33                        uint32_t aCount) const override;
34   virtual nsresult ComputeDistance(const SMILValue& aFrom, const SMILValue& aTo,
35                                    double& aDistance) const override;
36   virtual nsresult Interpolate(const SMILValue& aStartVal,
37                                const SMILValue& aEndVal, double aUnitDistance,
38                                SMILValue& aResult) const override;
39 
40  private:
41   // Private constructor: prevent instances beyond my singleton.
42   constexpr SMILNullType() = default;
43 };
44 
45 }  // namespace mozilla
46 
47 #endif  // DOM_SMIL_SMILNULLTYPE_H_
48