1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-27 02:20:05 +00:00

ComponentPeer: Add documentation for OptionalBorderSize

This commit is contained in:
attila 2022-02-04 18:05:45 +01:00
parent 6575d24a81
commit 4cf036bb8b

View file

@ -76,20 +76,42 @@ public:
};
class OptionalBorderSize final
/** Represents the window borders around a window component.
You must use operator bool() to evaluate the validity of the object before accessing
its value.
Returned by getFrameSizeIfPresent(). A missing value may be returned on Linux for a
short time after window creation.
*/
class JUCE_API OptionalBorderSize final
{
public:
/** Default constructor. Creates an invalid object. */
OptionalBorderSize() : valid (false) {}
/** Constructor. Creates a valid object containing the provided BorderSize<int>. */
explicit OptionalBorderSize (BorderSize<int> size) : valid (true), borderSize (std::move (size)) {}
/** Returns true if a valid value has been provided. */
explicit operator bool() const noexcept { return valid; }
/** Returns a reference to the value.
You must not call this function on an invalid object. Use operator bool() to
determine validity.
*/
const auto& operator*() const noexcept
{
jassert (valid);
return borderSize;
}
/** Returns a pointer to the value.
You must not call this function on an invalid object. Use operator bool() to
determine validity.
*/
const auto* operator->() const noexcept
{
jassert (valid);