Browse Source

Updated the documentation of some methods which now return std::unique_ptr instead of raw pointers to remove references to deleting the returned object

tags/2021-05-28
ed 5 years ago
parent
commit
c2e3dcd8bf
9 changed files with 10 additions and 31 deletions
  1. +0
    -2
      modules/juce_audio_processors/format/juce_AudioPluginFormatManager.h
  2. +2
    -2
      modules/juce_core/containers/juce_PropertySet.h
  3. +1
    -5
      modules/juce_core/network/juce_URL.h
  4. +3
    -4
      modules/juce_core/xml/juce_XmlDocument.h
  5. +0
    -1
      modules/juce_data_structures/values/juce_ValueTree.h
  6. +0
    -2
      modules/juce_gui_basics/commands/juce_KeyPressMappingSet.h
  7. +2
    -4
      modules/juce_gui_basics/drawables/juce_Drawable.h
  8. +0
    -4
      modules/juce_gui_basics/widgets/juce_TreeView.h
  9. +2
    -7
      modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.h

+ 0
- 2
modules/juce_audio_processors/format/juce_AudioPluginFormatManager.h View File

@@ -64,8 +64,6 @@ public:
/** Tries to load the type for this description, by trying all the formats /** Tries to load the type for this description, by trying all the formats
that this manager knows about. that this manager knows about.
The caller is responsible for deleting the object that is returned.
If it can't load the plugin, it returns nullptr and leaves a message in the If it can't load the plugin, it returns nullptr and leaves a message in the
errorMessage string. errorMessage string.


+ 2
- 2
modules/juce_core/containers/juce_PropertySet.h View File

@@ -104,8 +104,8 @@ public:
/** Returns one of the properties as an XML element. /** Returns one of the properties as an XML element.
The result will a new XMLElement object that the caller must delete. If may return nullptr
if the key isn't found, or if the entry contains an string that isn't valid XML.
The result will a new XMLElement object. It may return nullptr if the key isn't found,
or if the entry contains an string that isn't valid XML.
If the value isn't found in this set, then this will look for it in a fallback If the value isn't found in this set, then this will look for it in a fallback
property set (if you've specified one with the setFallbackPropertySet() method), property set (if you've specified one with the setFallbackPropertySet() method),


+ 1
- 5
modules/juce_core/network/juce_URL.h View File

@@ -337,8 +337,7 @@ public:
returning a response (ignored for Android which follows up to 5 redirects) returning a response (ignored for Android which follows up to 5 redirects)
@param httpRequestCmd Specify which HTTP Request to use. If this is empty, then doPostRequest @param httpRequestCmd Specify which HTTP Request to use. If this is empty, then doPostRequest
will determine the HTTP request. will determine the HTTP request.
@returns an input stream that the caller must delete, or a null pointer if there was an
error trying to open it.
@returns a valid input stream, or nullptr if there was an error trying to open it.
*/ */
std::unique_ptr<InputStream> createInputStream (bool doPostLikeRequest, std::unique_ptr<InputStream> createInputStream (bool doPostLikeRequest,
OpenStreamProgressCallback* progressCallback = nullptr, OpenStreamProgressCallback* progressCallback = nullptr,
@@ -479,9 +478,6 @@ public:
If it fails, or if the text that it reads can't be parsed as XML, this will If it fails, or if the text that it reads can't be parsed as XML, this will
return nullptr. return nullptr.
When it returns a valid XmlElement object, the caller is responsible for deleting
this object when no longer needed.
Note that on some platforms (Android, for example) it's not permitted to do any network Note that on some platforms (Android, for example) it's not permitted to do any network
action from the message thread, so you must only call it from a background thread. action from the message thread, so you must only call it from a background thread.


+ 3
- 4
modules/juce_core/xml/juce_XmlDocument.h View File

@@ -93,8 +93,7 @@ public:
allows quick checking of large files to allows quick checking of large files to
see if they contain the correct type of see if they contain the correct type of
tag, without having to parse the entire file tag, without having to parse the entire file
@returns a new XmlElement which the caller will need to delete, or null if
there was an error.
@returns a new XmlElement, or nullptr if there was an error.
@see getLastParseError, getDocumentElementIfTagMatches @see getLastParseError, getDocumentElementIfTagMatches
*/ */
std::unique_ptr<XmlElement> getDocumentElement (bool onlyReadOuterDocumentElement = false); std::unique_ptr<XmlElement> getDocumentElement (bool onlyReadOuterDocumentElement = false);
@@ -136,14 +135,14 @@ public:
/** A handy static method that parses a file. /** A handy static method that parses a file.
This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it. This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it.
An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>! An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>!
@returns a new XmlElement which the caller will need to delete, or null if there was an error.
@returns a new XmlElement, or nullptr if there was an error.
*/ */
static std::unique_ptr<XmlElement> parse (const File& file); static std::unique_ptr<XmlElement> parse (const File& file);
/** A handy static method that parses some XML data. /** A handy static method that parses some XML data.
This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it. This is a shortcut for creating an XmlDocument object and calling getDocumentElement() on it.
An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>! An even better shortcut is the juce::parseXML() function, which returns a std::unique_ptr<XmlElement>!
@returns a new XmlElement which the caller will need to delete, or null if there was an error.
@returns a new XmlElement, or nullptr if there was an error.
*/ */
static std::unique_ptr<XmlElement> parse (const String& xmlData); static std::unique_ptr<XmlElement> parse (const String& xmlData);


+ 0
- 1
modules/juce_data_structures/values/juce_ValueTree.h View File

@@ -419,7 +419,6 @@ public:
/** Creates an XmlElement that holds a complete image of this tree and all its children. /** Creates an XmlElement that holds a complete image of this tree and all its children.
If this tree is invalid, this may return nullptr. Otherwise, the XML that is produced can If this tree is invalid, this may return nullptr. Otherwise, the XML that is produced can
be used to recreate a similar tree by calling ValueTree::fromXml(). be used to recreate a similar tree by calling ValueTree::fromXml().
The caller must delete the object that is returned.
@see fromXml, toXmlString @see fromXml, toXmlString
*/ */
std::unique_ptr<XmlElement> createXml() const; std::unique_ptr<XmlElement> createXml() const;


+ 0
- 2
modules/juce_gui_basics/commands/juce_KeyPressMappingSet.h View File

@@ -186,8 +186,6 @@ public:
This will produce a lump of XML that can be later reloaded using This will produce a lump of XML that can be later reloaded using
restoreFromXml() to recreate the current mapping state. restoreFromXml() to recreate the current mapping state.
The object that is returned must be deleted by the caller.
@param saveDifferencesFromDefaultSet if this is false, then all keypresses @param saveDifferencesFromDefaultSet if this is false, then all keypresses
will be saved into the XML. If it's true, then the XML will will be saved into the XML. If it's true, then the XML will
only store the differences between the current mappings and only store the differences between the current mappings and


+ 2
- 4
modules/juce_gui_basics/drawables/juce_Drawable.h View File

@@ -144,8 +144,7 @@ public:
/** Attempts to parse an SVG (Scalable Vector Graphics) document, and to turn this /** Attempts to parse an SVG (Scalable Vector Graphics) document, and to turn this
into a Drawable tree. into a Drawable tree.
The object returned must be deleted by the caller. If something goes wrong
while parsing, it may return nullptr.
If something goes wrong while parsing, it may return nullptr.
SVG is a pretty large and complex spec, and this doesn't aim to be a full SVG is a pretty large and complex spec, and this doesn't aim to be a full
implementation, but it can return the basic vector objects. implementation, but it can return the basic vector objects.
@@ -155,8 +154,7 @@ public:
/** Attempts to parse an SVG (Scalable Vector Graphics) document from a file, /** Attempts to parse an SVG (Scalable Vector Graphics) document from a file,
and to turn this into a Drawable tree. and to turn this into a Drawable tree.
The object returned must be deleted by the caller. If something goes wrong
while parsing, it may return nullptr.
If something goes wrong while parsing, it may return nullptr.
SVG is a pretty large and complex spec, and this doesn't aim to be a full SVG is a pretty large and complex spec, and this doesn't aim to be a full
implementation, but it can return the basic vector objects. implementation, but it can return the basic vector objects.


+ 0
- 4
modules/juce_gui_basics/widgets/juce_TreeView.h View File

@@ -499,8 +499,6 @@ public:
for a specific item, but this can be handy if you need to briefly save the state for a specific item, but this can be handy if you need to briefly save the state
for a section of the tree. for a section of the tree.
The caller is responsible for deleting the object that is returned.
Note that if all nodes of the tree are in their default state, then this may Note that if all nodes of the tree are in their default state, then this may
return a nullptr. return a nullptr.
@@ -796,8 +794,6 @@ public:
completely different instance of the tree, as long as it contains nodes completely different instance of the tree, as long as it contains nodes
whose unique names are the same. whose unique names are the same.
The caller is responsible for deleting the object that is returned.
@param alsoIncludeScrollPosition if this is true, the state will also @param alsoIncludeScrollPosition if this is true, the state will also
include information about where the include information about where the
tree has been scrolled to vertically, tree has been scrolled to vertically,


+ 2
- 7
modules/juce_opengl/opengl/juce_OpenGLGraphicsContext.h View File

@@ -19,19 +19,14 @@
namespace juce namespace juce
{ {
/** Creates a graphics context object that will render into the given OpenGL target.
The caller is responsible for deleting this object when no longer needed.
*/
/** Creates a graphics context object that will render into the given OpenGL target. */
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&, int width, int height); std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&, int width, int height);
/** Creates a graphics context object that will render into the given OpenGL framebuffer.
The caller is responsible for deleting this object when no longer needed.
*/
/** Creates a graphics context object that will render into the given OpenGL framebuffer. */
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&, OpenGLFrameBuffer&); std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&, OpenGLFrameBuffer&);
/** Creates a graphics context object that will render into the given OpenGL framebuffer, /** Creates a graphics context object that will render into the given OpenGL framebuffer,
with the given size. with the given size.
The caller is responsible for deleting this object when no longer needed.
*/ */
std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&, std::unique_ptr<LowLevelGraphicsContext> createOpenGLGraphicsContext (OpenGLContext&,
unsigned int frameBufferID, unsigned int frameBufferID,


Loading…
Cancel
Save