1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

More doxygen

This commit is contained in:
James Crook 2018-11-04 14:19:05 +00:00
parent 648d7ddb73
commit b5d4a828d1
8 changed files with 96 additions and 70 deletions

View File

@ -41,10 +41,10 @@ protected:
AudacityException &operator = ( const AudacityException & ) PROHIBITED; AudacityException &operator = ( const AudacityException & ) PROHIBITED;
}; };
// A subclass of AudacityException whose delayed handler action displays /// \brief A subclass of AudacityException whose delayed handler action displays
// a message box. The message is specified by further subclasses. /// a message box. The message is specified by further subclasses.
// Not more than one message box will be displayed for each pass through /// Not more than one message box will be displayed for each pass through
// the main event idle loop. /// the main event idle loop.
class MessageBoxException /* not final */ : public AudacityException class MessageBoxException /* not final */ : public AudacityException
{ {
// Do not allow subclasses to change this behavior further, except // Do not allow subclasses to change this behavior further, except
@ -68,7 +68,7 @@ private:
mutable bool moved { false }; mutable bool moved { false };
}; };
// MessageBoxException that shows a given, unvarying string. /// \brief A MessageBoxException that shows a given, unvarying string.
class SimpleMessageBoxException /* not final */ : public MessageBoxException class SimpleMessageBoxException /* not final */ : public MessageBoxException
{ {
public: public:
@ -90,6 +90,8 @@ private:
wxString message; wxString message;
}; };
/// \brief performs the delayed configured action, when invoked.
struct DefaultDelayedHandlerAction struct DefaultDelayedHandlerAction
{ {
void operator () (AudacityException *pException) const void operator () (AudacityException *pException) const
@ -99,8 +101,8 @@ struct DefaultDelayedHandlerAction
} }
}; };
// Classes that can supply the second argument of GuardedCall: /// \brief SimpleGuard classes add the second argument of GuardedCall:
// Frequently useful converter of all exceptions to some failure constant /// Frequently useful converter of all exceptions to some failure constant
template <typename R> struct SimpleGuard template <typename R> struct SimpleGuard
{ {
explicit SimpleGuard( R value ) : m_value{ value } {} explicit SimpleGuard( R value ) : m_value{ value } {}
@ -108,7 +110,7 @@ template <typename R> struct SimpleGuard
const R m_value; const R m_value;
}; };
// Simple guard specialization that returns bool, and defines Default /// \brief SimpleGuard specialization that returns bool, and defines Default
template<> struct SimpleGuard<bool> template<> struct SimpleGuard<bool>
{ {
explicit SimpleGuard( bool value ) : m_value{ value } {} explicit SimpleGuard( bool value ) : m_value{ value } {}
@ -118,7 +120,7 @@ template<> struct SimpleGuard<bool>
const bool m_value; const bool m_value;
}; };
// Simple guard specialization that returns nothing, and defines Default /// \brief SimpleGuard specialization that returns nothing, and defines Default
template<> struct SimpleGuard<void> template<> struct SimpleGuard<void>
{ {
SimpleGuard() {} SimpleGuard() {}
@ -132,16 +134,24 @@ SimpleGuard< R > MakeSimpleGuard( R value )
inline SimpleGuard< void > MakeSimpleGuard() { return {}; } inline SimpleGuard< void > MakeSimpleGuard() { return {}; }
/** /***
* Call the body function (usually a lambda) inside a try block. \brief GuardedCall performs a body action, and provided there is no
* exception a handler action on completion. If there is an exception,
* The handler intercepts exceptions, and is passed nullptr if the it queues up the delayed handler action for execution later in
* exception is of a type not defined by Audacity. It may return a value the idle event loop
* for the guarded call or throw the same or another exception.
* It executes in the same thread as the body. The template is rather configurable, and default behaviours can be
* overridden. GuardedCall makes use of SimpleGuard for the handler action.
* If the handler is passed non-null and does not throw, then delayedHandler
* executes later in the main thread, in idle time of the event loop. GuardedCall calls the body function (usually a lambda) inside a try block.
The handler intercepts exceptions, and is passed nullptr if the
exception is of a type not defined by Audacity. It may return a value
for the guarded call or throw the same or another exception.
The handler executes in the same thread as the body.
If the handler is passed non-null and does not throw, then delayedHandler
executes later in the main thread, in idle time of the event loop.
*/ */
template < template <
typename R = void, // return type typename R = void, // return type

View File

@ -999,6 +999,9 @@ using AVCodecContextHolder = std::unique_ptr<
using AVDictionaryCleanup = std::unique_ptr< using AVDictionaryCleanup = std::unique_ptr<
AVDictionary*, AV_Deleter<AVDictionary*, void, av_dict_free> AVDictionary*, AV_Deleter<AVDictionary*, void, av_dict_free>
>; >;
/// \brief FFmpeg structure to hold a file pointer and provide a return
/// value when closing the file.
struct UFileHolder : public std::unique_ptr< struct UFileHolder : public std::unique_ptr<
AVIOContext, ::AV_Deleter<AVIOContext, int, ufile_close> AVIOContext, ::AV_Deleter<AVIOContext, int, ufile_close>
> >

View File

@ -25,6 +25,8 @@ class LabelTrack;
#define LYRICS_DEFAULT_WIDTH 608 #define LYRICS_DEFAULT_WIDTH 608
#define LYRICS_DEFAULT_HEIGHT 280 #define LYRICS_DEFAULT_HEIGHT 280
/// \brief used in LyricsPanel, a Syllable gives positional information to
/// be used with the bouncing ball effect.
struct Syllable { struct Syllable {
Syllable() = default; Syllable() = default;
Syllable( const Syllable& ) = default; Syllable( const Syllable& ) = default;

View File

@ -123,11 +123,14 @@ public:
} }
}; };
/* /**
* ArraysOf<X> \class ArrayOf
* This simplifies arrays of arrays, each array separately allocated with NEW[]
* But it might be better to use std::Array<ArrayOf<X>, N> for some small constant N ArraysOf<X>
* Or use just one array when sub-arrays have a common size and are not large.
\brief This simplifies arrays of arrays, each array separately allocated with NEW[]
But it might be better to use std::Array<ArrayOf<X>, N> for some small constant N
Or use just one array when sub-arrays have a common size and are not large.
*/ */
template<typename X> template<typename X>
class ArraysOf : public ArrayOf<ArrayOf<X>> class ArraysOf : public ArrayOf<ArrayOf<X>>
@ -181,12 +184,15 @@ public:
} }
}; };
/* /**
* template class Maybe<X> \class Maybe
* Can be used for monomorphic objects that are stack-allocable, but only conditionally constructed. \brief Like a smart pointer, allows for object to not exist (nullptr)
* You might also use it as a member.
* Initialize with create(), then use like a smart pointer, template class Maybe<X>
* with *, ->, get(), reset(), or in if() Can be used for monomorphic objects that are stack-allocable, but only conditionally constructed.
You might also use it as a member.
Initialize with create(), then use like a smart pointer,
with *, ->, get(), reset(), or in if()
*/ */
// Placement-NEW is used below, and that does not cooperate with the DEBUG_NEW for Visual Studio // Placement-NEW is used below, and that does not cooperate with the DEBUG_NEW for Visual Studio
@ -196,6 +202,7 @@ public:
#endif #endif
#endif #endif
template<typename X> template<typename X>
class Maybe { class Maybe {
public: public:
@ -238,11 +245,11 @@ public:
return *this; return *this;
} }
// Make an object in the buffer, passing constructor arguments, /// Make an object in the buffer, passing constructor arguments,
// but destroying any previous object first /// but destroying any previous object first
// Note that if constructor throws, we remain in a consistent /// Note that if constructor throws, we remain in a consistent
// NULL state -- giving exception safety but only weakly /// NULL state -- giving exception safety but only weakly
// (previous value was lost if present) /// (previous value was lost if present)
template<typename... Args> template<typename... Args>
void create(Args&&... args) void create(Args&&... args)
{ {
@ -260,7 +267,7 @@ public:
// Pointer-like operators // Pointer-like operators
// Dereference, with the usual bad consequences if NULL /// Dereference, with the usual bad consequences if NULL
X &operator* () const X &operator* () const
{ {
return *pp; return *pp;
@ -318,44 +325,44 @@ static char*THIS_FILE = __FILE__;
#endif #endif
#endif #endif
/* /**
* A deleter for pointers obtained with malloc A deleter for pointers obtained with malloc
*/ */
struct freer { void operator() (void *p) const { free(p); } }; struct freer { void operator() (void *p) const { free(p); } };
/* /**
* A useful alias for holding the result of malloc A useful alias for holding the result of malloc
*/ */
template< typename T > template< typename T >
using MallocPtr = std::unique_ptr< T, freer >; using MallocPtr = std::unique_ptr< T, freer >;
/* /**
* A useful alias for holding the result of strup and similar A useful alias for holding the result of strup and similar
*/ */
template <typename Character = char> template <typename Character = char>
using MallocString = std::unique_ptr< Character[], freer >; using MallocString = std::unique_ptr< Character[], freer >;
/* /**
* A deleter class to supply the second template parameter of unique_ptr for \brief A deleter class to supply the second template parameter of unique_ptr for
* classes like wxWindow that should be sent a message called Destroy rather classes like wxWindow that should be sent a message called Destroy rather
* than be deleted directly than be deleted directly
*/ */
template <typename T> template <typename T>
struct Destroyer { struct Destroyer {
void operator () (T *p) const { if (p) p->Destroy(); } void operator () (T *p) const { if (p) p->Destroy(); }
}; };
/* /**
* a convenience for using Destroyer \brief a convenience for using Destroyer
*/ */
template <typename T> template <typename T>
using Destroy_ptr = std::unique_ptr<T, Destroyer<T>>; using Destroy_ptr = std::unique_ptr<T, Destroyer<T>>;
/* /**
* "finally" as in The C++ Programming Language, 4th ed., p. 358 \brief "finally" as in The C++ Programming Language, 4th ed., p. 358
* Useful for defining ad-hoc RAII actions. Useful for defining ad-hoc RAII actions.
* typical usage: typical usage:
* auto cleanup = finally([&]{ ... code; ... }); auto cleanup = finally([&]{ ... code; ... });
*/ */
// Construct this from any copyable function object, such as a lambda // Construct this from any copyable function object, such as a lambda
@ -366,8 +373,8 @@ struct Final_action {
F clean; F clean;
}; };
// Function template with type deduction lets you construct Final_action /// \brief Function template with type deduction lets you construct Final_action
// without typing any angle brackets /// without typing any angle brackets
template <typename F> template <typename F>
Final_action<F> finally (F f) Final_action<F> finally (F f)
{ {
@ -377,8 +384,8 @@ Final_action<F> finally (F f)
#include <wx/utils.h> // for wxMin, wxMax #include <wx/utils.h> // for wxMin, wxMax
#include <algorithm> #include <algorithm>
/* /**
* Set a variable temporarily in a scope \brief Structure used by ValueRestorer
*/ */
template< typename T > template< typename T >
struct RestoreValue { struct RestoreValue {
@ -386,6 +393,10 @@ struct RestoreValue {
void operator () ( T *p ) const { if (p) *p = oldValue; } void operator () ( T *p ) const { if (p) *p = oldValue; }
}; };
/**
\brief Set a variable temporarily in a scope
*/
template< typename T > template< typename T >
class ValueRestorer : public std::unique_ptr< T, RestoreValue<T> > class ValueRestorer : public std::unique_ptr< T, RestoreValue<T> >
{ {
@ -408,7 +419,7 @@ public:
} }
}; };
// inline functions provide convenient parameter type deduction /// inline functions provide convenient parameter type deduction
template< typename T > template< typename T >
ValueRestorer< T > valueRestorer( T& var ) ValueRestorer< T > valueRestorer( T& var )
{ return ValueRestorer< T >{ var }; } { return ValueRestorer< T >{ var }; }
@ -417,8 +428,8 @@ template< typename T >
ValueRestorer< T > valueRestorer( T& var, const T& newValue ) ValueRestorer< T > valueRestorer( T& var, const T& newValue )
{ return ValueRestorer< T >{ var, newValue }; } { return ValueRestorer< T >{ var, newValue }; }
/* /**
* A convenience for use with range-for \brief A convenience for use with range-for
*/ */
template <typename Iterator> template <typename Iterator>
struct IteratorRange : public std::pair<Iterator, Iterator> { struct IteratorRange : public std::pair<Iterator, Iterator> {

View File

@ -15,14 +15,7 @@
\brief \brief
Implements TrackPanel and TrackInfo. Implements TrackPanel and TrackInfo.
*//********************************************************************/ *//***************************************************************//**
// Documentation: Rather than have a lengthy \todo section, having
// a \todo a \file and a \page in EXACTLY that order gets Doxygen to
// put the following lengthy description of refactoring on a NEW page
// and link to it from the docs.
/*****************************************************************//**
\class TrackPanel \class TrackPanel
\brief \brief
@ -100,7 +93,9 @@ is time to refresh some aspect of the screen.
wxDEFINE_EVENT(EVT_TRACK_PANEL_TIMER, wxCommandEvent); wxDEFINE_EVENT(EVT_TRACK_PANEL_TIMER, wxCommandEvent);
/* /**
\class TrackPanel
This is a diagram of TrackPanel's division of one (non-stereo) track rectangle. This is a diagram of TrackPanel's division of one (non-stereo) track rectangle.
Total height equals Track::GetHeight()'s value. Total width is the wxWindow's Total height equals Track::GetHeight()'s value. Total width is the wxWindow's

View File

@ -28,7 +28,7 @@ using UIHandlePtr = std::shared_ptr<UIHandle>;
#include <vector> #include <vector>
/// The TrackPanel is built up of nodes, subtrees of the CellularPanel's area /// \brief The TrackPanel is built up of nodes, subtrees of the CellularPanel's area
/// This class itself has almost nothing in it. Other classes derived from it /// This class itself has almost nothing in it. Other classes derived from it
/// build up the capabilities. /// build up the capabilities.
class AUDACITY_DLL_API /* not final */ TrackPanelNode class AUDACITY_DLL_API /* not final */ TrackPanelNode

View File

@ -39,6 +39,8 @@
Param( Amount, float, wxT("Stretch Factor"), 10.0, 1.0, FLT_MAX, 1 ); Param( Amount, float, wxT("Stretch Factor"), 10.0, 1.0, FLT_MAX, 1 );
Param( Time, float, wxT("Time Resolution"), 0.25f, 0.00099f, FLT_MAX, 1 ); Param( Time, float, wxT("Time Resolution"), 0.25f, 0.00099f, FLT_MAX, 1 );
/// \brief Class that helps EffectPaulStretch. It does the FFTs and inner loop
/// of the effect.
class PaulStretch class PaulStretch
{ {
public: public:

View File

@ -64,6 +64,9 @@ in which buttons can be placed.
// //
#define RWIDTH 4 #define RWIDTH 4
/// \brief a wxWindow that provides the resizer for a toolbar on the
/// right hand side. Responsible for drawing the resizer appearance,
/// resizing mouse events and constraining the resizing.
class ToolBarResizer final : public wxWindow class ToolBarResizer final : public wxWindow
{ {
public: public: