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) 2005
19 : * the Initial Developer. All Rights Reserved.
20 : *
21 : * Contributor(s):
22 : * Brian Birtles <birtles@gmail.com>
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef NS_SMILINTERVAL_H_
39 : #define NS_SMILINTERVAL_H_
40 :
41 : #include "nsSMILInstanceTime.h"
42 : #include "nsTArray.h"
43 :
44 : //----------------------------------------------------------------------
45 : // nsSMILInterval class
46 : //
47 : // A structure consisting of a begin and end time. The begin time must be
48 : // resolved (i.e. not indefinite or unresolved).
49 : //
50 : // For an overview of how this class is related to other SMIL time classes see
51 : // the documentation in nsSMILTimeValue.h
52 :
53 : class nsSMILInterval
54 : {
55 : public:
56 : nsSMILInterval();
57 : nsSMILInterval(const nsSMILInterval& aOther);
58 : ~nsSMILInterval();
59 : void Unlink(bool aFiltered = false);
60 :
61 0 : const nsSMILInstanceTime* Begin() const
62 : {
63 0 : NS_ABORT_IF_FALSE(mBegin && mEnd,
64 : "Requesting Begin() on un-initialized instance time");
65 0 : return mBegin;
66 : }
67 : nsSMILInstanceTime* Begin();
68 :
69 0 : const nsSMILInstanceTime* End() const
70 : {
71 0 : NS_ABORT_IF_FALSE(mBegin && mEnd,
72 : "Requesting End() on un-initialized instance time");
73 0 : return mEnd;
74 : }
75 : nsSMILInstanceTime* End();
76 :
77 : void SetBegin(nsSMILInstanceTime& aBegin);
78 : void SetEnd(nsSMILInstanceTime& aEnd);
79 0 : void Set(nsSMILInstanceTime& aBegin, nsSMILInstanceTime& aEnd)
80 : {
81 0 : SetBegin(aBegin);
82 0 : SetEnd(aEnd);
83 0 : }
84 :
85 : void FixBegin();
86 : void FixEnd();
87 :
88 : typedef nsTArray<nsRefPtr<nsSMILInstanceTime> > InstanceTimeList;
89 :
90 : void AddDependentTime(nsSMILInstanceTime& aTime);
91 : void RemoveDependentTime(const nsSMILInstanceTime& aTime);
92 : void GetDependentTimes(InstanceTimeList& aTimes);
93 :
94 : // Cue for assessing if this interval can be filtered
95 : bool IsDependencyChainLink() const;
96 :
97 : private:
98 : nsRefPtr<nsSMILInstanceTime> mBegin;
99 : nsRefPtr<nsSMILInstanceTime> mEnd;
100 :
101 : // nsSMILInstanceTimes to notify when this interval is changed or deleted.
102 : InstanceTimeList mDependentTimes;
103 :
104 : // Indicates if the end points of the interval are fixed or not.
105 : //
106 : // Note that this is not the same as having an end point whose TIME is fixed
107 : // (i.e. nsSMILInstanceTime::IsFixed() returns true). This is because it is
108 : // possible to have an end point with a fixed TIME and yet still update the
109 : // end point to refer to a different nsSMILInstanceTime object.
110 : //
111 : // However, if mBegin/EndFixed is true, then BOTH the nsSMILInstanceTime
112 : // OBJECT returned for that end point and its TIME value will not change.
113 : bool mBeginFixed;
114 : bool mEndFixed;
115 : };
116 :
117 : #endif // NS_SMILINTERVAL_H_
|