From dd27f72b0ee66119bc6a4457eaaa409049d65165 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Tue, 13 Aug 2019 08:46:38 +1000 Subject: [PATCH] Convert doxygen \throws to Sphinx :raises: syntax in sipify --- python/server/auto_generated/qgsserverogcapihandler.sip.in | 7 ++++--- python/server/auto_generated/qgsserverparameters.sip.in | 6 ++++-- .../auto_generated/qgsserverquerystringparameter.sip.in | 3 ++- scripts/sipify.pl | 7 ++++++- 4 files changed, 16 insertions(+), 7 deletions(-) diff --git a/python/server/auto_generated/qgsserverogcapihandler.sip.in b/python/server/auto_generated/qgsserverogcapihandler.sip.in index 77d8c433d70..f5f96748fbb 100644 --- a/python/server/auto_generated/qgsserverogcapihandler.sip.in +++ b/python/server/auto_generated/qgsserverogcapihandler.sip.in @@ -115,7 +115,7 @@ Handles the request within its ``context`` Subclasses must implement this methods, and call validate() to extract validated parameters from the request. -\throws QgsServerApiBadRequestError if the method encounters any error +:raises QgsServerApiBadRequestError: if the method encounters any error %End virtual QVariantMap values( const QgsServerApiContext &context ) const throw( QgsServerApiBadRequestException ); @@ -137,7 +137,8 @@ the parameters map. .. seealso:: :py:func:`path` .. seealso:: :py:func:`parameters` -\throws QgsServerApiBadRequestError if validation fails + +:raises QgsServerApiBadRequestError: if validation fails %End QString contentTypeForAccept( const QString &accept ) const; @@ -202,7 +203,7 @@ The path file extension is examined first and checked for known mime types, the "Accept" HTTP header is examined next. Fallback to the default content type of the handler if none of the above matches. -\throws QgsServerApiBadRequestError if the content type of the request is not compatible with the handler (:py:func:`contentTypes` member) +:raises QgsServerApiBadRequestError: if the content type of the request is not compatible with the handler (:py:func:`contentTypes` member) %End static QString parentLink( const QUrl &url, int levels = 1 ); diff --git a/python/server/auto_generated/qgsserverparameters.sip.in b/python/server/auto_generated/qgsserverparameters.sip.in index f4a87c5f3c0..d39003ed630 100644 --- a/python/server/auto_generated/qgsserverparameters.sip.in +++ b/python/server/auto_generated/qgsserverparameters.sip.in @@ -169,7 +169,8 @@ Loads the data associated to the parameter converted into an url. Raises an exception in case of an invalid parameters. :param msg: The message describing the exception - \throws QgsBadRequestException Invalid parameter exception + +:raises QgsBadRequestException: Invalid parameter exception %End QVariant::Type mType; @@ -216,7 +217,8 @@ Constructor for QgsServerParameter. void raiseError() const; %Docstring Raises an error in case of an invalid conversion. -\throws QgsBadRequestException Invalid parameter exception + +:raises QgsBadRequestException: Invalid parameter exception %End static QString name( const QgsServerParameter::Name name ); diff --git a/python/server/auto_generated/qgsserverquerystringparameter.sip.in b/python/server/auto_generated/qgsserverquerystringparameter.sip.in index b3443c3212c..1d0a6676f40 100644 --- a/python/server/auto_generated/qgsserverquerystringparameter.sip.in +++ b/python/server/auto_generated/qgsserverquerystringparameter.sip.in @@ -74,7 +74,8 @@ Validation steps: .. seealso:: :py:func:`setCustomValidator` :return: the parameter value or an invalid QVariant if not found (and not required) - \throws QgsServerApiBadRequestError if validation fails + +:raises QgsServerApiBadRequestError: if validation fails %End diff --git a/scripts/sipify.pl b/scripts/sipify.pl index 7577fd77880..6aae775fa6b 100755 --- a/scripts/sipify.pl +++ b/scripts/sipify.pl @@ -190,7 +190,7 @@ sub processDoxygenLine { # if inside multi-line parameter, ensure additional lines are indented if ($line ne '') { - if ( $line !~ m/^\s*[\\:]+(param|note|since|return|deprecated|warning)/ ) { + if ( $line !~ m/^\s*[\\:]+(param|note|since|return|deprecated|warning|throws)/ ) { $line = "$INDENT$line"; } } @@ -299,6 +299,11 @@ sub processDoxygenLine { $COMMENT_LAST_LINE_NOTE_WARNING = 1; return "\n.. warning::\n\n $1\n"; } + if ( $line =~ m/[\\@]throws (.+?)\b\s*(.*)/ ) { + $INDENT = ''; + $COMMENT_LAST_LINE_NOTE_WARNING = 1; + return "\n:raises $1: $2\n"; + } if ( $line !~ m/^\s*$/ ){ if ( $COMMENT_LAST_LINE_NOTE_WARNING == 1 ){