LMMS
Loading...
Searching...
No Matches
juce_RelativeCoordinate.cpp
Go to the documentation of this file.
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
29const String RelativeCoordinate::Strings::parent ("parent");
30const String RelativeCoordinate::Strings::left ("left");
31const String RelativeCoordinate::Strings::right ("right");
32const String RelativeCoordinate::Strings::top ("top");
33const String RelativeCoordinate::Strings::bottom ("bottom");
34const String RelativeCoordinate::Strings::x ("x");
35const String RelativeCoordinate::Strings::y ("y");
36const String RelativeCoordinate::Strings::width ("width");
37const String RelativeCoordinate::Strings::height ("height");
38
40{
41 if (s == Strings::left) return left;
42 if (s == Strings::right) return right;
43 if (s == Strings::top) return top;
44 if (s == Strings::bottom) return bottom;
45 if (s == Strings::x) return x;
46 if (s == Strings::y) return y;
47 if (s == Strings::width) return width;
48 if (s == Strings::height) return height;
49 if (s == Strings::parent) return parent;
50 return unknown;
51}
52
53//==============================================================================
57
59 : term (term_)
60{
61}
62
67
68RelativeCoordinate& RelativeCoordinate::operator= (const RelativeCoordinate& other)
69{
70 term = other.term;
71 return *this;
72}
73
75 : term (std::move (other.term))
76{
77}
78
79RelativeCoordinate& RelativeCoordinate::operator= (RelativeCoordinate&& other) noexcept
80{
81 term = std::move (other.term);
82 return *this;
83}
84
85RelativeCoordinate::RelativeCoordinate (const double absoluteDistanceFromOrigin)
86 : term (absoluteDistanceFromOrigin)
87{
88}
89
95
99
100bool RelativeCoordinate::operator== (const RelativeCoordinate& other) const noexcept
101{
102 return term.toString() == other.term.toString();
103}
104
105bool RelativeCoordinate::operator!= (const RelativeCoordinate& other) const noexcept
106{
107 return ! operator== (other);
108}
109
111{
112 if (scope != nullptr)
113 return term.evaluate (*scope);
114
115 return term.evaluate();
116}
117
119{
121
122 if (scope != nullptr)
123 term.evaluate (*scope, error);
124 else
125 term.evaluate (Expression::Scope(), error);
126
127 return error.isNotEmpty();
128}
129
131{
132 if (scope != nullptr)
133 {
134 term = term.adjustedToGiveNewResult (newPos, *scope);
135 }
136 else
137 {
138 Expression::Scope defaultScope;
139 term = term.adjustedToGiveNewResult (newPos, defaultScope);
140 }
141}
142
144{
145 return term.usesAnySymbols();
146}
147
149{
150 return term.toString();
151}
152
153} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
static Audio_Scope * scope
Definition player.cpp:26
static volatile bool term
Definition carla-uhe-test.c:12
Definition juce_Expression.h:109
Definition juce_Expression.h:44
void moveToAbsolute(double absoluteTargetPosition, const Expression::Scope *evaluationScope)
Definition juce_RelativeCoordinate.cpp:130
bool isDynamic() const
Definition juce_RelativeCoordinate.cpp:143
bool isRecursive(const Expression::Scope *evaluationScope) const
Definition juce_RelativeCoordinate.cpp:118
String toString() const
Definition juce_RelativeCoordinate.cpp:148
Expression term
Definition juce_RelativeCoordinate.h:178
RelativeCoordinate()
Definition juce_RelativeCoordinate.cpp:54
double resolve(const Expression::Scope *evaluationScope) const
Definition juce_RelativeCoordinate.cpp:110
~RelativeCoordinate()
Definition juce_RelativeCoordinate.cpp:96
Definition juce_String.h:53
unsigned s
Definition inflate.c:1555
Definition carla_juce.cpp:31
Type
Definition juce_RelativeCoordinate.h:166
@ y
Definition juce_RelativeCoordinate.h:168
@ top
Definition juce_RelativeCoordinate.h:167
@ left
Definition juce_RelativeCoordinate.h:167
@ unknown
Definition juce_RelativeCoordinate.h:170
@ right
Definition juce_RelativeCoordinate.h:167
@ parent
Definition juce_RelativeCoordinate.h:169
@ x
Definition juce_RelativeCoordinate.h:168
@ height
Definition juce_RelativeCoordinate.h:168
@ width
Definition juce_RelativeCoordinate.h:168
@ bottom
Definition juce_RelativeCoordinate.h:167
static Type getTypeOf(const String &s) noexcept
Definition juce_RelativeCoordinate.cpp:39
static const String top
Definition juce_RelativeCoordinate.h:154
static const String bottom
Definition juce_RelativeCoordinate.h:155
static const String height
Definition juce_RelativeCoordinate.h:159
static const String x
Definition juce_RelativeCoordinate.h:156
static const String width
Definition juce_RelativeCoordinate.h:158
static const String right
Definition juce_RelativeCoordinate.h:153
static const String left
Definition juce_RelativeCoordinate.h:152
static const String parent
Definition juce_RelativeCoordinate.h:151
static const String y
Definition juce_RelativeCoordinate.h:157
int error
Definition extract.c:1038