1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fixed some const violation errors

This commit is contained in:
Tom Poole 2017-12-19 12:44:24 +00:00
parent 03fef746d5
commit cff37f5b6a
32 changed files with 225 additions and 127 deletions

View file

@ -195,15 +195,15 @@ private:
expect (! bundle[1].isBundle());
int numElementsCounted = 0;
for (OSCBundle::Element* element = bundle.begin(); element != bundle.end(); ++element)
for (auto& element : bundle)
{
expect (element->isMessage());
expect (! element->isBundle());
expect (element.isMessage());
expect (! element.isBundle());
++numElementsCounted;
}
expectEquals (numElementsCounted, 2);
OSCBundle::Element* e = bundle.begin();
auto* e = bundle.begin();
expect (e[0].getMessage().size() == 1);
expect (e[0].getMessage().begin()->getInt32() == testInt);
expect (e[1].getMessage().size() == 2);

View file

@ -111,7 +111,12 @@ public:
This method does not check the range and results in undefined behaviour
in case i < 0 or i >= size().
*/
OSCBundle::Element& operator[] (const int i) const noexcept
OSCBundle::Element& operator[] (const int i) noexcept
{
return elements.getReference (i);
}
const OSCBundle::Element& operator[] (const int i) const noexcept
{
return elements.getReference (i);
}

View file

@ -53,7 +53,12 @@ bool OSCMessage::isEmpty() const noexcept
return arguments.isEmpty();
}
OSCArgument& OSCMessage::operator[] (const int i) const noexcept
OSCArgument& OSCMessage::operator[] (const int i) noexcept
{
return arguments.getReference (i);
}
const OSCArgument& OSCMessage::operator[] (const int i) const noexcept
{
return arguments.getReference (i);
}

View file

@ -93,7 +93,8 @@ public:
This method does not check the range and results in undefined behaviour
in case i < 0 or i >= size().
*/
OSCArgument& operator[] (const int i) const noexcept;
OSCArgument& operator[] (const int i) noexcept;
const OSCArgument& operator[] (const int i) const noexcept;
/** Returns a pointer to the first OSCArgument in the OSCMessage object.
This method is provided for compatibility with standard C++ iteration mechanisms.
@ -108,7 +109,6 @@ public:
/** Removes all arguments from the OSCMessage. */
void clear();
//==============================================================================
/** Creates a new OSCArgument of type int32 with a given value
and adds it to the OSCMessage object.