LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/canvas - verifyinput.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 62 0.0 %
Date: 2012-08-25 Functions: 0 37 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef INCLUDED_CANVAS_VERIFYINPUT_HXX
      30                 :            : #define INCLUDED_CANVAS_VERIFYINPUT_HXX
      31                 :            : 
      32                 :            : #include <com/sun/star/uno/Reference.hxx>
      33                 :            : #include <com/sun/star/uno/Sequence.hxx>
      34                 :            : #include <com/sun/star/uno/RuntimeException.hpp>
      35                 :            : #include <com/sun/star/lang/IllegalArgumentException.hpp>
      36                 :            : #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
      37                 :            : 
      38                 :            : #include <algorithm>
      39                 :            : #include <boost/bind.hpp>
      40                 :            : #include <boost/current_function.hpp>
      41                 :            : 
      42                 :            : #include <canvas/canvastoolsdllapi.h>
      43                 :            : 
      44                 :            : namespace com { namespace sun { namespace star { namespace geometry
      45                 :            : {
      46                 :            :     struct RealPoint2D;
      47                 :            :     struct RealSize2D;
      48                 :            :     struct RealBezierSegment2D;
      49                 :            :     struct RealRectangle2D;
      50                 :            :     struct AffineMatrix2D;
      51                 :            :     struct Matrix2D;
      52                 :            :     struct IntegerPoint2D;
      53                 :            :     struct IntegerSize2D;
      54                 :            :     struct IntegerRectangle2D;
      55                 :            : } } } }
      56                 :            : 
      57                 :            : namespace com { namespace sun { namespace star { namespace rendering
      58                 :            : {
      59                 :            :     struct RenderState;
      60                 :            :     struct StrokeAttributes;
      61                 :            :     struct Texture;
      62                 :            :     struct ViewState;
      63                 :            :     struct IntegerBitmapLayout;
      64                 :            :     struct FontRequest;
      65                 :            :     struct FontInfo;
      66                 :            :     class  XCanvas;
      67                 :            : } } } }
      68                 :            : 
      69                 :            : 
      70                 :            : namespace canvas
      71                 :            : {
      72                 :            :     namespace tools
      73                 :            :     {
      74                 :            : 
      75                 :            :         // Input checking facilities
      76                 :            :         // ===================================================================
      77                 :            : 
      78                 :            :         // This header provides methods to check all common
      79                 :            :         // css::rendering::* method input parameters against
      80                 :            :         // compliance to the API specification.
      81                 :            : 
      82                 :            :         /** Verify that the given transformation contains valid floating point
      83                 :            :             values.
      84                 :            : 
      85                 :            :             @param rMatrix
      86                 :            :             Matrix to check
      87                 :            : 
      88                 :            :             @param xIf
      89                 :            :             The interface that should be reported as the one
      90                 :            :             generating the exception.
      91                 :            : 
      92                 :            :             @param nArgPos
      93                 :            :             Argument position on the call site (i.e. the position of
      94                 :            :             the argument, checked here, on the UNO interface
      95                 :            :             method. Counting starts at 0).
      96                 :            : 
      97                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
      98                 :            :          */
      99                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::AffineMatrix2D&   rMatrix,
     100                 :            :                           const char*                                       pStr,
     101                 :            :                           const ::com::sun::star::uno::Reference<
     102                 :            :                               ::com::sun::star::uno::XInterface >&          xIf,
     103                 :            :                           ::sal_Int16                                       nArgPos );
     104                 :            : 
     105                 :            :         /** Verify that the given transformation contains valid floating point
     106                 :            :             values.
     107                 :            : 
     108                 :            :             @param rMatrix
     109                 :            :             Matrix to check
     110                 :            : 
     111                 :            :             @param xIf
     112                 :            :             The interface that should be reported as the one
     113                 :            :             generating the exception.
     114                 :            : 
     115                 :            :             @param nArgPos
     116                 :            :             Argument position on the call site (i.e. the position of
     117                 :            :             the argument, checked here, on the UNO interface
     118                 :            :             method. Counting starts at 0).
     119                 :            : 
     120                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     121                 :            :          */
     122                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::Matrix2D& rMatrix,
     123                 :            :                           const char*                                   pStr,
     124                 :            :                           const ::com::sun::star::uno::Reference<
     125                 :            :                               ::com::sun::star::uno::XInterface >&      xIf,
     126                 :            :                           ::sal_Int16                                   nArgPos );
     127                 :            : 
     128                 :            :         /** Verify that the given point contains valid floating point
     129                 :            :             values.
     130                 :            : 
     131                 :            :             @param rPoint
     132                 :            :             Point to check
     133                 :            : 
     134                 :            :             @param xIf
     135                 :            :             The interface that should be reported as the one
     136                 :            :             generating the exception.
     137                 :            : 
     138                 :            :             @param nArgPos
     139                 :            :             Argument position on the call site (i.e. the position of
     140                 :            :             the argument, checked here, on the UNO interface
     141                 :            :             method. Counting starts at 0).
     142                 :            : 
     143                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     144                 :            :          */
     145                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D&  rPoint,
     146                 :            :                           const char*                                       pStr,
     147                 :            :                           const ::com::sun::star::uno::Reference<
     148                 :            :                               ::com::sun::star::uno::XInterface >&          xIf,
     149                 :            :                           ::sal_Int16                                       nArgPos );
     150                 :            : 
     151                 :            :         /** Verify that the given bezier segment contains valid
     152                 :            :             floating point values.
     153                 :            : 
     154                 :            :             @param rSegment
     155                 :            :             Segment to check
     156                 :            : 
     157                 :            :             @param xIf
     158                 :            :             The interface that should be reported as the one
     159                 :            :             generating the exception.
     160                 :            : 
     161                 :            :             @param nArgPos
     162                 :            :             Argument position on the call site (i.e. the position of
     163                 :            :             the argument, checked here, on the UNO interface
     164                 :            :             method. Counting starts at 0).
     165                 :            : 
     166                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     167                 :            :          */
     168                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealBezierSegment2D&  rSegment,
     169                 :            :                           const char*                                               pStr,
     170                 :            :                           const ::com::sun::star::uno::Reference<
     171                 :            :                               ::com::sun::star::uno::XInterface >&                  xIf,
     172                 :            :                           ::sal_Int16                                               nArgPos );
     173                 :            : 
     174                 :            :         /** Verify that the given point contains valid floating point
     175                 :            :             values.
     176                 :            : 
     177                 :            :             @param rPoint
     178                 :            :             Point to check
     179                 :            : 
     180                 :            :             @param xIf
     181                 :            :             The interface that should be reported as the one
     182                 :            :             generating the exception.
     183                 :            : 
     184                 :            :             @param nArgPos
     185                 :            :             Argument position on the call site (i.e. the position of
     186                 :            :             the argument, checked here, on the UNO interface
     187                 :            :             method. Counting starts at 0).
     188                 :            : 
     189                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     190                 :            :          */
     191                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealPoint2D&  rPoint,
     192                 :            :                           const char*                                       pStr,
     193                 :            :                           const ::com::sun::star::uno::Reference<
     194                 :            :                               ::com::sun::star::uno::XInterface >&          xIf,
     195                 :            :                           ::sal_Int16                                       nArgPos );
     196                 :            : 
     197                 :            :         /** Verify that the given rectangle contains valid floating
     198                 :            :             point values.
     199                 :            : 
     200                 :            :             @param rRect
     201                 :            :             Rect to check
     202                 :            : 
     203                 :            :             @param xIf
     204                 :            :             The interface that should be reported as the one
     205                 :            :             generating the exception.
     206                 :            : 
     207                 :            :             @param nArgPos
     208                 :            :             Argument position on the call site (i.e. the position of
     209                 :            :             the argument, checked here, on the UNO interface
     210                 :            :             method. Counting starts at 0).
     211                 :            : 
     212                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     213                 :            :          */
     214                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::geometry::RealRectangle2D&  rRect,
     215                 :            :                           const char*                                           pStr,
     216                 :            :                           const ::com::sun::star::uno::Reference<
     217                 :            :                               ::com::sun::star::uno::XInterface >&              xIf,
     218                 :            :                           ::sal_Int16                                           nArgPos );
     219                 :            : 
     220                 :            :         /** Basic check for view state validity.
     221                 :            : 
     222                 :            :             @param viewState
     223                 :            :             Viewstate to check
     224                 :            : 
     225                 :            :             @param xIf
     226                 :            :             The interface that should be reported as the one
     227                 :            :             generating the exception.
     228                 :            : 
     229                 :            :             @param nArgPos
     230                 :            :             Argument position on the call site (i.e. the position of
     231                 :            :             the argument, checked here, on the UNO interface
     232                 :            :             method. Counting starts at 0).
     233                 :            : 
     234                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     235                 :            :          */
     236                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::ViewState&   viewState,
     237                 :            :                           const char*                                   pStr,
     238                 :            :                           const ::com::sun::star::uno::Reference<
     239                 :            :                                    ::com::sun::star::uno::XInterface >& xIf,
     240                 :            :                           ::sal_Int16                                   nArgPos );
     241                 :            : 
     242                 :            :         /** Basic check for render state validity.
     243                 :            : 
     244                 :            :             @param renderState
     245                 :            :             Renderstate to check
     246                 :            : 
     247                 :            :             @param xIf
     248                 :            :             The interface that should be reported as the one
     249                 :            :             generating the exception.
     250                 :            : 
     251                 :            :             @param nArgPos
     252                 :            :             Argument position on the call site (i.e. the position of
     253                 :            :             the argument, checked here, on the UNO interface
     254                 :            :             method. Counting starts at 0).
     255                 :            : 
     256                 :            :             @param nMinColorComponents
     257                 :            :             Minimal number of color components available in
     258                 :            :             RenderState::DeviceColor
     259                 :            : 
     260                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     261                 :            :          */
     262                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::RenderState& renderState,
     263                 :            :                           const char*                                       pStr,
     264                 :            :                           const ::com::sun::star::uno::Reference<
     265                 :            :                                    ::com::sun::star::uno::XInterface >&     xIf,
     266                 :            :                           ::sal_Int16                                       nArgPos,
     267                 :            :                           sal_Int32                                         nMinColorComponents=0 );
     268                 :            : 
     269                 :            :         /** Basic check for stroke attributes validity.
     270                 :            : 
     271                 :            :             @param strokeAttributes
     272                 :            :             Attributes to check
     273                 :            : 
     274                 :            :             @param xIf
     275                 :            :             The interface that should be reported as the one
     276                 :            :             generating the exception.
     277                 :            : 
     278                 :            :             @param nArgPos
     279                 :            :             Argument position on the call site (i.e. the position of
     280                 :            :             the argument, checked here, on the UNO interface
     281                 :            :             method. Counting starts at 0).
     282                 :            : 
     283                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     284                 :            :          */
     285                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::StrokeAttributes&    strokeAttributes,
     286                 :            :                           const char*                                           pStr,
     287                 :            :                           const ::com::sun::star::uno::Reference<
     288                 :            :                                    ::com::sun::star::uno::XInterface >&         xIf,
     289                 :            :                           ::sal_Int16                                           nArgPos );
     290                 :            : 
     291                 :            :         /** Basic check for texture validity.
     292                 :            : 
     293                 :            :             @param texture
     294                 :            :             Texture to check
     295                 :            : 
     296                 :            :             @param xIf
     297                 :            :             The interface that should be reported as the one
     298                 :            :             generating the exception.
     299                 :            : 
     300                 :            :             @param nArgPos
     301                 :            :             Argument position on the call site (i.e. the position of
     302                 :            :             the argument, checked here, on the UNO interface
     303                 :            :             method. Counting starts at 0).
     304                 :            : 
     305                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     306                 :            :          */
     307                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::Texture&     texture,
     308                 :            :                           const char*                                   pStr,
     309                 :            :                           const ::com::sun::star::uno::Reference<
     310                 :            :                                    ::com::sun::star::uno::XInterface >& xIf,
     311                 :            :                           ::sal_Int16                                   nArgPos );
     312                 :            : 
     313                 :            :         /** Basic check for bitmap layout validity.
     314                 :            : 
     315                 :            :             @param bitmapLayout
     316                 :            :             Bitmap layout to check
     317                 :            : 
     318                 :            :             @param xIf
     319                 :            :             The interface that should be reported as the one
     320                 :            :             generating the exception.
     321                 :            : 
     322                 :            :             @param nArgPos
     323                 :            :             Argument position on the call site (i.e. the position of
     324                 :            :             the argument, checked here, on the UNO interface
     325                 :            :             method. Counting starts at 0).
     326                 :            : 
     327                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     328                 :            :          */
     329                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::IntegerBitmapLayout&     bitmapLayout,
     330                 :            :                           const char*                                               pStr,
     331                 :            :                           const ::com::sun::star::uno::Reference<
     332                 :            :                                    ::com::sun::star::uno::XInterface >&             xIf,
     333                 :            :                           ::sal_Int16                                               nArgPos );
     334                 :            : 
     335                 :            :         /** Basic check for font info validity.
     336                 :            : 
     337                 :            :             @param fontInfo
     338                 :            :             Font info to check
     339                 :            : 
     340                 :            :             @param xIf
     341                 :            :             The interface that should be reported as the one
     342                 :            :             generating the exception.
     343                 :            : 
     344                 :            :             @param nArgPos
     345                 :            :             Argument position on the call site (i.e. the position of
     346                 :            :             the argument, checked here, on the UNO interface
     347                 :            :             method. Counting starts at 0).
     348                 :            : 
     349                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     350                 :            :          */
     351                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontInfo&    fontInfo,
     352                 :            :                           const char*                                   pStr,
     353                 :            :                           const ::com::sun::star::uno::Reference<
     354                 :            :                                    ::com::sun::star::uno::XInterface >& xIf,
     355                 :            :                           ::sal_Int16                                   nArgPos );
     356                 :            : 
     357                 :            :         /** Basic check for font request validity.
     358                 :            : 
     359                 :            :             @param fontRequest
     360                 :            :             Font request to check
     361                 :            : 
     362                 :            :             @param xIf
     363                 :            :             The interface that should be reported as the one
     364                 :            :             generating the exception.
     365                 :            : 
     366                 :            :             @param nArgPos
     367                 :            :             Argument position on the call site (i.e. the position of
     368                 :            :             the argument, checked here, on the UNO interface
     369                 :            :             method. Counting starts at 0).
     370                 :            : 
     371                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     372                 :            :          */
     373                 :            :         CANVASTOOLS_DLLPUBLIC void verifyInput( const ::com::sun::star::rendering::FontRequest& fontRequest,
     374                 :            :                           const char*                                       pStr,
     375                 :            :                           const ::com::sun::star::uno::Reference<
     376                 :            :                                    ::com::sun::star::uno::XInterface >&     xIf,
     377                 :            :                           ::sal_Int16                                       nArgPos );
     378                 :            : 
     379                 :            :         /** Templatized check for uno::Reference validity.
     380                 :            : 
     381                 :            :             @param rRef
     382                 :            :             Reference to check against non-NILness
     383                 :            : 
     384                 :            :             @param xIf
     385                 :            :             The interface that should be reported as the one
     386                 :            :             generating the exception.
     387                 :            : 
     388                 :            :             @param nArgPos
     389                 :            :             Argument position on the call site (i.e. the position of
     390                 :            :             the argument, checked here, on the UNO interface
     391                 :            :             method. Counting starts at 0).
     392                 :            : 
     393                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     394                 :            :          */
     395                 :          0 :         template< class Interface > void verifyInput(
     396                 :            :             const ::com::sun::star::uno::Reference< Interface >&    rRef,
     397                 :            :             const char*                                             pStr,
     398                 :            :             const ::com::sun::star::uno::Reference<
     399                 :            :                 ::com::sun::star::uno::XInterface >&                xIf,
     400                 :            :             ::sal_Int16                                             nArgPos )
     401                 :            :         {
     402                 :            :             (void)pStr; (void)xIf; (void)nArgPos;
     403                 :            : 
     404                 :          0 :             if( !rRef.is() )
     405                 :            :             {
     406                 :            : #if OSL_DEBUG_LEVEL > 0
     407                 :            :                 throw ::com::sun::star::lang::IllegalArgumentException(
     408                 :            :                     ::rtl::OUString::createFromAscii(pStr) +
     409                 :            :                     ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ": reference is NULL" )),
     410                 :            :                     xIf,
     411                 :            :                     nArgPos );
     412                 :            : #else
     413                 :          0 :                 throw ::com::sun::star::lang::IllegalArgumentException();
     414                 :            : #endif
     415                 :            :             }
     416                 :          0 :         }
     417                 :            : 
     418                 :            :         /** Templatized check for content-of-sequence validity.
     419                 :            : 
     420                 :            :             @param rSequence
     421                 :            :             Sequence of things to check
     422                 :            : 
     423                 :            :             @param xIf
     424                 :            :             The interface that should be reported as the one
     425                 :            :             generating the exception.
     426                 :            : 
     427                 :            :             @param nArgPos
     428                 :            :             Argument position on the call site (i.e. the position of
     429                 :            :             the argument, checked here, on the UNO interface
     430                 :            :             method. Counting starts at 0).
     431                 :            : 
     432                 :            :             @throws an lang::IllegalArgumentException, if anything is wrong
     433                 :            :          */
     434                 :          0 :         template< typename SequenceContent > void verifyInput(
     435                 :            :             const ::com::sun::star::uno::Sequence< SequenceContent >&   rSequence,
     436                 :            :             const char*                                                 pStr,
     437                 :            :             const ::com::sun::star::uno::Reference<
     438                 :            :                 ::com::sun::star::uno::XInterface >&                    xIf,
     439                 :            :             ::sal_Int16                                                 nArgPos )
     440                 :            :         {
     441                 :          0 :             const SequenceContent* pCurr = rSequence.getConstArray();
     442                 :          0 :             const SequenceContent* pEnd  = pCurr + rSequence.getLength();
     443                 :          0 :             while( pCurr != pEnd )
     444                 :          0 :                 verifyInput( *pCurr++, pStr, xIf, nArgPos );
     445                 :          0 :         }
     446                 :            : 
     447                 :            :         /// Catch-all, to handle cases that DON'T need input checking (i.e. the Integer geometry ones)
     448                 :          0 :         template< typename T > void verifyInput( const T&                                   /*rDummy*/,
     449                 :            :                                                  const char*                                /*pStr*/,
     450                 :            :                                                  const ::com::sun::star::uno::Reference<
     451                 :            :                                                        ::com::sun::star::uno::XInterface >& /*xIf*/,
     452                 :            :                                                  ::sal_Int16                                /*nArgPos*/ )
     453                 :            :         {
     454                 :          0 :         }
     455                 :            : 
     456                 :            :         // TODO(Q2): Employ some template arglist magic here, to avoid
     457                 :            :         // this duplication of code...
     458                 :            : 
     459                 :          0 :         template< typename Arg0 > void verifyArgs( const Arg0&                                  rArg0,
     460                 :            :                                                    const char*                                  pStr,
     461                 :            :                                                    const ::com::sun::star::uno::Reference<
     462                 :            :                                                            ::com::sun::star::uno::XInterface >& xIf )
     463                 :            :         {
     464                 :          0 :             verifyInput( rArg0, pStr, xIf, 0 );
     465                 :          0 :         }
     466                 :            : 
     467                 :            :         template< typename Arg0,
     468                 :          0 :                   typename Arg1 > void verifyArgs( const Arg0&                                  rArg0,
     469                 :            :                                                    const Arg1&                                  rArg1,
     470                 :            :                                                    const char*                                  pStr,
     471                 :            :                                                    const ::com::sun::star::uno::Reference<
     472                 :            :                                                            ::com::sun::star::uno::XInterface >& xIf )
     473                 :            :         {
     474                 :          0 :             verifyInput( rArg0, pStr, xIf, 0 );
     475                 :          0 :             verifyInput( rArg1, pStr, xIf, 1 );
     476                 :          0 :         }
     477                 :            : 
     478                 :            :         template< typename Arg0,
     479                 :            :                   typename Arg1,
     480                 :          0 :                   typename Arg2 > void verifyArgs( const Arg0&                                  rArg0,
     481                 :            :                                                    const Arg1&                                  rArg1,
     482                 :            :                                                    const Arg2&                                  rArg2,
     483                 :            :                                                    const char*                                  pStr,
     484                 :            :                                                    const ::com::sun::star::uno::Reference<
     485                 :            :                                                            ::com::sun::star::uno::XInterface >& xIf )
     486                 :            :         {
     487                 :          0 :             verifyInput( rArg0, pStr, xIf, 0 );
     488                 :          0 :             verifyInput( rArg1, pStr, xIf, 1 );
     489                 :          0 :             verifyInput( rArg2, pStr, xIf, 2 );
     490                 :          0 :         }
     491                 :            : 
     492                 :            :         template< typename Arg0,
     493                 :            :                   typename Arg1,
     494                 :            :                   typename Arg2,
     495                 :          0 :                   typename Arg3 > void verifyArgs( const Arg0&                                  rArg0,
     496                 :            :                                                    const Arg1&                                  rArg1,
     497                 :            :                                                    const Arg2&                                  rArg2,
     498                 :            :                                                    const Arg3&                                  rArg3,
     499                 :            :                                                    const char*                                  pStr,
     500                 :            :                                                    const ::com::sun::star::uno::Reference<
     501                 :            :                                                            ::com::sun::star::uno::XInterface >& xIf )
     502                 :            :         {
     503                 :          0 :             verifyInput( rArg0, pStr, xIf, 0 );
     504                 :          0 :             verifyInput( rArg1, pStr, xIf, 1 );
     505                 :          0 :             verifyInput( rArg2, pStr, xIf, 2 );
     506                 :          0 :             verifyInput( rArg3, pStr, xIf, 3 );
     507                 :          0 :         }
     508                 :            : 
     509                 :            :         template< typename Arg0,
     510                 :            :                   typename Arg1,
     511                 :            :                   typename Arg2,
     512                 :            :                   typename Arg3,
     513                 :          0 :                   typename Arg4 > void verifyArgs( const Arg0&                                  rArg0,
     514                 :            :                                                    const Arg1&                                  rArg1,
     515                 :            :                                                    const Arg2&                                  rArg2,
     516                 :            :                                                    const Arg3&                                  rArg3,
     517                 :            :                                                    const Arg4&                                  rArg4,
     518                 :            :                                                    const char*                                  pStr,
     519                 :            :                                                    const ::com::sun::star::uno::Reference<
     520                 :            :                                                            ::com::sun::star::uno::XInterface >& xIf )
     521                 :            :         {
     522                 :          0 :             verifyInput( rArg0, pStr, xIf, 0 );
     523                 :          0 :             verifyInput( rArg1, pStr, xIf, 1 );
     524                 :          0 :             verifyInput( rArg2, pStr, xIf, 2 );
     525                 :          0 :             verifyInput( rArg3, pStr, xIf, 3 );
     526                 :          0 :             verifyInput( rArg4, pStr, xIf, 4 );
     527                 :          0 :         }
     528                 :            : 
     529                 :            :         template< typename Arg0,
     530                 :            :                   typename Arg1,
     531                 :            :                   typename Arg2,
     532                 :            :                   typename Arg3,
     533                 :            :                   typename Arg4,
     534                 :          0 :                   typename Arg5 > void verifyArgs( const Arg0&                                  rArg0,
     535                 :            :                                                    const Arg1&                                  rArg1,
     536                 :            :                                                    const Arg2&                                  rArg2,
     537                 :            :                                                    const Arg3&                                  rArg3,
     538                 :            :                                                    const Arg4&                                  rArg4,
     539                 :            :                                                    const Arg5&                                  rArg5,
     540                 :            :                                                    const char*                                  pStr,
     541                 :            :                                                    const ::com::sun::star::uno::Reference<
     542                 :            :                                                            ::com::sun::star::uno::XInterface >& xIf )
     543                 :            :         {
     544                 :          0 :             verifyInput( rArg0, pStr, xIf, 0 );
     545                 :          0 :             verifyInput( rArg1, pStr, xIf, 1 );
     546                 :          0 :             verifyInput( rArg2, pStr, xIf, 2 );
     547                 :          0 :             verifyInput( rArg3, pStr, xIf, 3 );
     548                 :          0 :             verifyInput( rArg4, pStr, xIf, 4 );
     549                 :          0 :             verifyInput( rArg5, pStr, xIf, 5 );
     550                 :          0 :         }
     551                 :            : 
     552                 :            :         template< typename Arg0,
     553                 :            :                   typename Arg1,
     554                 :            :                   typename Arg2,
     555                 :            :                   typename Arg3,
     556                 :            :                   typename Arg4,
     557                 :            :                   typename Arg5,
     558                 :          0 :                   typename Arg6 > void verifyArgs( const Arg0&                                  rArg0,
     559                 :            :                                                    const Arg1&                                  rArg1,
     560                 :            :                                                    const Arg2&                                  rArg2,
     561                 :            :                                                    const Arg3&                                  rArg3,
     562                 :            :                                                    const Arg4&                                  rArg4,
     563                 :            :                                                    const Arg5&                                  rArg5,
     564                 :            :                                                    const Arg6&                                  rArg6,
     565                 :            :                                                    const char*                                  pStr,
     566                 :            :                                                    const ::com::sun::star::uno::Reference<
     567                 :            :                                                            ::com::sun::star::uno::XInterface >& xIf )
     568                 :            :         {
     569                 :          0 :             verifyInput( rArg0, pStr, xIf, 0 );
     570                 :          0 :             verifyInput( rArg1, pStr, xIf, 1 );
     571                 :          0 :             verifyInput( rArg2, pStr, xIf, 2 );
     572                 :          0 :             verifyInput( rArg3, pStr, xIf, 3 );
     573                 :          0 :             verifyInput( rArg4, pStr, xIf, 4 );
     574                 :          0 :             verifyInput( rArg5, pStr, xIf, 5 );
     575                 :          0 :             verifyInput( rArg6, pStr, xIf, 6 );
     576                 :          0 :         }
     577                 :            : 
     578                 :            : 
     579                 :            :         /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when
     580                 :            :             range is violated
     581                 :            :         */
     582                 :          0 :         template< typename NumType > inline void verifyRange( NumType arg, NumType lowerBound, NumType upperBound )
     583                 :            :         {
     584                 :          0 :             if( arg < lowerBound ||
     585                 :            :                 arg > upperBound )
     586                 :            :             {
     587                 :          0 :                 throw ::com::sun::star::lang::IllegalArgumentException();
     588                 :            :             }
     589                 :          0 :         }
     590                 :            : 
     591                 :            :         /** Range checker, which throws ::com::sun::star::lang::IllegalArgument exception, when
     592                 :            :             range is violated
     593                 :            : 
     594                 :            :             The checked range is half open, i.e. only bound by the specified value.
     595                 :            : 
     596                 :            :             @param arg
     597                 :            :             Arg to check
     598                 :            : 
     599                 :            :             @param bound
     600                 :            :             Bound to check against
     601                 :            : 
     602                 :            :             @param bLowerBound
     603                 :            :             When true, given bound is the lower bound. When false,
     604                 :            :             given bound is the upper bound.
     605                 :            :         */
     606                 :          0 :         template< typename NumType > inline void verifyRange( NumType arg, NumType bound, bool bLowerBound=true )
     607                 :            :         {
     608                 :          0 :             if( (bLowerBound && arg < bound) ||
     609                 :            :                 (!bLowerBound && arg > bound) )
     610                 :            :             {
     611                 :          0 :                 throw ::com::sun::star::lang::IllegalArgumentException();
     612                 :            :             }
     613                 :          0 :         }
     614                 :            : 
     615                 :            :         /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
     616                 :            :             index range is violated
     617                 :            :         */
     618                 :            :         template< typename NumType > inline void verifyIndexRange( NumType arg, NumType lowerBound, NumType upperBound )
     619                 :            :         {
     620                 :            :             if( arg < lowerBound ||
     621                 :            :                 arg > upperBound )
     622                 :            :             {
     623                 :            :                 throw ::com::sun::star::lang::IndexOutOfBoundsException();
     624                 :            :             }
     625                 :            :         }
     626                 :            : 
     627                 :            :         /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
     628                 :            :             index range is violated
     629                 :            : 
     630                 :            :             @param rect
     631                 :            :             Rect to verify
     632                 :            : 
     633                 :            :             @param size
     634                 :            :             Given rectangle must be within ((0,0), (size.Width, size.Height))
     635                 :            :          */
     636                 :            :         CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerRectangle2D& rect,
     637                 :            :                                const ::com::sun::star::geometry::IntegerSize2D&      size );
     638                 :            : 
     639                 :            :         /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
     640                 :            :             index range is violated
     641                 :            : 
     642                 :            :             @param pos
     643                 :            :             Position to verify
     644                 :            : 
     645                 :            :             @param size
     646                 :            :             Given position must be within ((0,0), (size.Width, size.Height))
     647                 :            :          */
     648                 :            :         CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const ::com::sun::star::geometry::IntegerPoint2D& pos,
     649                 :            :                                const ::com::sun::star::geometry::IntegerSize2D&  size );
     650                 :            : 
     651                 :            :         /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
     652                 :            :             the size is negative or null
     653                 :            : 
     654                 :            :             @param size
     655                 :            :             Size to verify
     656                 :            :          */
     657                 :            :         CANVASTOOLS_DLLPUBLIC void verifyBitmapSize( const ::com::sun::star::geometry::IntegerSize2D& size,
     658                 :            :                                const char*                                      pStr,
     659                 :            :                                const ::com::sun::star::uno::Reference<
     660                 :            :                                        ::com::sun::star::uno::XInterface >&     xIf );
     661                 :            : 
     662                 :            :         /** Range checker, which throws ::com::sun::star::lang::IndexOutOfBounds exception, when
     663                 :            :             the size is negative or null
     664                 :            : 
     665                 :            :             @param size
     666                 :            :             Size to verify
     667                 :            :          */
     668                 :            :         CANVASTOOLS_DLLPUBLIC void verifySpriteSize( const ::com::sun::star::geometry::RealSize2D& size,
     669                 :            :                                const char*                                   pStr,
     670                 :            :                                const ::com::sun::star::uno::Reference<
     671                 :            :                                        ::com::sun::star::uno::XInterface >&  xIf );
     672                 :            :     }
     673                 :            : }
     674                 :            : 
     675                 :            : #endif /* INCLUDED_CANVAS_VERIFYINPUT_HXX */
     676                 :            : 
     677                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10