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

Convert ignoreUnused to [[maybe_unused]]

This commit is contained in:
reuk 2022-09-16 19:08:31 +01:00
parent 4351e87bdd
commit 28f2157912
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
141 changed files with 1057 additions and 1209 deletions

View file

@ -86,12 +86,11 @@ PushNotifications::~PushNotifications() { clearSingletonInstance(); }
void PushNotifications::addListener (Listener* l) { listeners.add (l); }
void PushNotifications::removeListener (Listener* l) { listeners.remove (l); }
void PushNotifications::requestPermissionsWithSettings (const PushNotifications::Settings& settings)
void PushNotifications::requestPermissionsWithSettings ([[maybe_unused]] const PushNotifications::Settings& settings)
{
#if JUCE_PUSH_NOTIFICATIONS && (JUCE_IOS || JUCE_MAC)
pimpl->requestPermissionsWithSettings (settings);
#else
ignoreUnused (settings);
listeners.call ([] (Listener& l) { l.notificationSettingsReceived ({}); });
#endif
}
@ -137,12 +136,10 @@ String PushNotifications::getDeviceToken() const
#endif
}
void PushNotifications::setupChannels (const Array<ChannelGroup>& groups, const Array<Channel>& channels)
void PushNotifications::setupChannels ([[maybe_unused]] const Array<ChannelGroup>& groups, [[maybe_unused]] const Array<Channel>& channels)
{
#if JUCE_PUSH_NOTIFICATIONS
pimpl->setupChannels (groups, channels);
#else
ignoreUnused (groups, channels);
#endif
}
@ -160,58 +157,48 @@ void PushNotifications::removeAllPendingLocalNotifications()
#endif
}
void PushNotifications::subscribeToTopic (const String& topic)
void PushNotifications::subscribeToTopic ([[maybe_unused]] const String& topic)
{
#if JUCE_PUSH_NOTIFICATIONS
pimpl->subscribeToTopic (topic);
#else
ignoreUnused (topic);
#endif
}
void PushNotifications::unsubscribeFromTopic (const String& topic)
void PushNotifications::unsubscribeFromTopic ([[maybe_unused]] const String& topic)
{
#if JUCE_PUSH_NOTIFICATIONS
pimpl->unsubscribeFromTopic (topic);
#else
ignoreUnused (topic);
#endif
}
void PushNotifications::sendLocalNotification (const Notification& n)
void PushNotifications::sendLocalNotification ([[maybe_unused]] const Notification& n)
{
#if JUCE_PUSH_NOTIFICATIONS
pimpl->sendLocalNotification (n);
#else
ignoreUnused (n);
#endif
}
void PushNotifications::removeDeliveredNotification (const String& identifier)
void PushNotifications::removeDeliveredNotification ([[maybe_unused]] const String& identifier)
{
#if JUCE_PUSH_NOTIFICATIONS
pimpl->removeDeliveredNotification (identifier);
#else
ignoreUnused (identifier);
#endif
}
void PushNotifications::removePendingLocalNotification (const String& identifier)
void PushNotifications::removePendingLocalNotification ([[maybe_unused]] const String& identifier)
{
#if JUCE_PUSH_NOTIFICATIONS
pimpl->removePendingLocalNotification (identifier);
#else
ignoreUnused (identifier);
#endif
}
void PushNotifications::sendUpstreamMessage (const String& serverSenderId,
const String& collapseKey,
const String& messageId,
const String& messageType,
int timeToLive,
const StringPairArray& additionalData)
void PushNotifications::sendUpstreamMessage ([[maybe_unused]] const String& serverSenderId,
[[maybe_unused]] const String& collapseKey,
[[maybe_unused]] const String& messageId,
[[maybe_unused]] const String& messageType,
[[maybe_unused]] int timeToLive,
[[maybe_unused]] const StringPairArray& additionalData)
{
#if JUCE_PUSH_NOTIFICATIONS
pimpl->sendUpstreamMessage (serverSenderId,
@ -220,10 +207,24 @@ void PushNotifications::sendUpstreamMessage (const String& serverSenderId,
messageType,
timeToLive,
additionalData);
#else
ignoreUnused (serverSenderId, collapseKey, messageId, messageType);
ignoreUnused (timeToLive, additionalData);
#endif
}
//==============================================================================
void PushNotifications::Listener::notificationSettingsReceived ([[maybe_unused]] const Settings& settings) {}
void PushNotifications::Listener::pendingLocalNotificationsListReceived ([[maybe_unused]] const Array<Notification>& notifications) {}
void PushNotifications::Listener::handleNotification ([[maybe_unused]] bool isLocalNotification,
[[maybe_unused]] const Notification& notification) {}
void PushNotifications::Listener::handleNotificationAction ([[maybe_unused]] bool isLocalNotification,
[[maybe_unused]] const Notification& notification,
[[maybe_unused]] const String& actionIdentifier,
[[maybe_unused]] const String& optionalResponse) {}
void PushNotifications::Listener::localNotificationDismissedByUser ([[maybe_unused]] const Notification& notification) {}
void PushNotifications::Listener::deliveredNotificationsListReceived ([[maybe_unused]] const Array<Notification>& notifications) {}
void PushNotifications::Listener::deviceTokenRefreshed ([[maybe_unused]] const String& token) {}
void PushNotifications::Listener::remoteNotificationsDeleted() {}
void PushNotifications::Listener::upstreamMessageSent ([[maybe_unused]] const String& messageId) {}
void PushNotifications::Listener::upstreamMessageSendingError ([[maybe_unused]] const String& messageId,
[[maybe_unused]] const String& error) {}
} // namespace juce

View file

@ -601,12 +601,12 @@ public:
with no categories and all allow flags set to true will be received in
Listener::notificationSettingsReceived().
*/
virtual void notificationSettingsReceived (const Settings& settings) { ignoreUnused (settings); }
virtual void notificationSettingsReceived (const Settings& settings);
/** Called when the list of pending notifications, requested by calling
getPendingLocalNotifications() is returned. iOS 10 or above only.
*/
virtual void pendingLocalNotificationsListReceived (const Array<Notification>& notifications) { ignoreUnused (notifications); }
virtual void pendingLocalNotificationsListReceived (const Array<Notification>& notifications);
/** This can be called in multiple different situations, depending on the OS and the situation.
@ -622,7 +622,7 @@ public:
Note you can receive this callback on startup, if the application was launched from a notification.
*/
virtual void handleNotification (bool isLocalNotification, const Notification& notification) { ignoreUnused (isLocalNotification); ignoreUnused (notification); }
virtual void handleNotification (bool isLocalNotification, const Notification& notification);
/** This can be called when a user performs some action on the notification such as
pressing on an action button or responding with a text input.
@ -641,18 +641,12 @@ public:
virtual void handleNotificationAction (bool isLocalNotification,
const Notification& notification,
const String& actionIdentifier,
const String& optionalResponse)
{
ignoreUnused (isLocalNotification);
ignoreUnused (notification);
ignoreUnused (actionIdentifier);
ignoreUnused (optionalResponse);
}
const String& optionalResponse);
/** For iOS10 and Android, this can be also called when a user dismissed the notification before
responding to it.
*/
virtual void localNotificationDismissedByUser (const Notification& notification) { ignoreUnused (notification); }
virtual void localNotificationDismissedByUser (const Notification& notification);
/** Called after getDeliveredNotifications() request is fulfilled. Returns notifications
that are visible in the notification area on the device and that are still waiting
@ -661,31 +655,31 @@ public:
On iOS, iOS version 10 or higher is required. On Android, API level 18 or higher is required.
For unsupported platforms, an empty array will be returned.
*/
virtual void deliveredNotificationsListReceived (const Array<Notification>& notifications) { ignoreUnused (notifications); }
virtual void deliveredNotificationsListReceived (const Array<Notification>& notifications);
/** Called whenever a token gets refreshed. You should monitor any token updates, because
only the last token that is assigned to device is valid and can be used.
*/
virtual void deviceTokenRefreshed (const String& token) { ignoreUnused (token); }
virtual void deviceTokenRefreshed (const String& token);
/** Called when Firebase Cloud Messaging server deletes pending messages. This can happen when
1) too many messages were sent to the server (hint: use collapsible messages).
2) the devices hasn't been online in a long time (refer to Firebase documentation for
the maximum time a message can be stored on FCM before expiring).
*/
virtual void remoteNotificationsDeleted() {}
virtual void remoteNotificationsDeleted();
/** Called when an upstream message sent with PushNotifications::sendUpstreamMessage() has been
sent successfully.
Bear in mind that in may take several minutes or more to receive this callback.
*/
virtual void upstreamMessageSent (const String& messageId) { ignoreUnused (messageId); }
virtual void upstreamMessageSent (const String& messageId);
/** Called when there was an error sending an upstream message with
PushNotifications::sendUpstreamMessage().
Bear in mind that in may take several minutes or more to receive this callback.
*/
virtual void upstreamMessageSendingError (const String& messageId, const String& error) { ignoreUnused (messageId); ignoreUnused (error); }
virtual void upstreamMessageSendingError (const String& messageId, const String& error);
};
void addListener (Listener* l);

View file

@ -132,19 +132,17 @@ void RecentlyOpenedFilesList::restoreFromString (const String& stringifiedVersio
//==============================================================================
void RecentlyOpenedFilesList::registerRecentFileNatively (const File& file)
void RecentlyOpenedFilesList::registerRecentFileNatively ([[maybe_unused]] const File& file)
{
#if JUCE_MAC
JUCE_AUTORELEASEPOOL
{
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL: createNSURLFromFile (file)];
}
#else
ignoreUnused (file);
#endif
}
void RecentlyOpenedFilesList::forgetRecentFileNatively (const File& file)
void RecentlyOpenedFilesList::forgetRecentFileNatively ([[maybe_unused]] const File& file)
{
#if JUCE_MAC
JUCE_AUTORELEASEPOOL
@ -166,8 +164,6 @@ void RecentlyOpenedFilesList::forgetRecentFileNatively (const File& file)
if (! [url isEqual:nsFile])
[sharedDocController noteNewRecentDocumentURL:url];
}
#else
ignoreUnused (file);
#endif
}

View file

@ -0,0 +1,39 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
Agreement and JUCE Privacy Policy.
End User License Agreement: www.juce.com/juce-7-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
#if JUCE_WEB_BROWSER || DOXYGEN
bool WebBrowserComponent::pageAboutToLoad ([[maybe_unused]] const String& newURL) { return true; }
void WebBrowserComponent::pageFinishedLoading ([[maybe_unused]] const String& url) {}
bool WebBrowserComponent::pageLoadHadNetworkError ([[maybe_unused]] const String& errorInfo) { return true; }
void WebBrowserComponent::windowCloseRequest() {}
void WebBrowserComponent::newWindowAttemptingToLoad ([[maybe_unused]] const String& newURL) {}
#endif
} // namespace juce

View file

@ -232,10 +232,10 @@ public:
tries to go to a particular URL. To allow the operation to carry on,
return true, or return false to stop the navigation happening.
*/
virtual bool pageAboutToLoad (const String& newURL) { ignoreUnused (newURL); return true; }
virtual bool pageAboutToLoad (const String& newURL);
/** This callback happens when the browser has finished loading a page. */
virtual void pageFinishedLoading (const String& url) { ignoreUnused (url); }
virtual void pageFinishedLoading (const String& url);
/** This callback happens when a network error was encountered while
trying to load a page.
@ -247,18 +247,18 @@ public:
The errorInfo contains some platform dependent string describing the
error.
*/
virtual bool pageLoadHadNetworkError (const String& errorInfo) { ignoreUnused (errorInfo); return true; }
virtual bool pageLoadHadNetworkError (const String& errorInfo);
/** This callback occurs when a script or other activity in the browser asks for
the window to be closed.
*/
virtual void windowCloseRequest() {}
virtual void windowCloseRequest();
/** This callback occurs when the browser attempts to load a URL in a new window.
This won't actually load the window but gives you a chance to either launch a
new window yourself or just load the URL into the current window with goToURL().
*/
virtual void newWindowAttemptingToLoad (const String& newURL) { ignoreUnused (newURL); }
virtual void newWindowAttemptingToLoad (const String& newURL);
//==============================================================================
/** @internal */
@ -288,6 +288,7 @@ private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WebBrowserComponent)
};
#endif
} // namespace juce