LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/canvas - verifyinput.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 62 0.0 %
Date: 2012-12-27 Functions: 0 37 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10