LCOV - code coverage report
Current view: top level - include/formula - errorcodes.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 13 0.0 %
Date: 2014-04-14 Functions: 0 2 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_FORMULA_ERRORCODES_HXX
      21             : #define INCLUDED_FORMULA_ERRORCODES_HXX
      22             : 
      23             : #include <rtl/math.hxx>
      24             : 
      25             : namespace ScErrorCodes
      26             : {
      27             : 
      28             : const sal_uInt16 errIllegalChar          = 501;
      29             : const sal_uInt16 errIllegalArgument      = 502;
      30             : const sal_uInt16 errIllegalFPOperation   = 503; // #NUM!
      31             : const sal_uInt16 errIllegalParameter     = 504;
      32             : const sal_uInt16 errIllegalJump          = 505;
      33             : const sal_uInt16 errSeparator            = 506;
      34             : const sal_uInt16 errPair                 = 507;
      35             : const sal_uInt16 errPairExpected         = 508;
      36             : const sal_uInt16 errOperatorExpected     = 509;
      37             : const sal_uInt16 errVariableExpected     = 510;
      38             : const sal_uInt16 errParameterExpected    = 511;
      39             : const sal_uInt16 errCodeOverflow         = 512;
      40             : const sal_uInt16 errStringOverflow       = 513;
      41             : const sal_uInt16 errStackOverflow        = 514;
      42             : const sal_uInt16 errUnknownState         = 515;
      43             : const sal_uInt16 errUnknownVariable      = 516;
      44             : const sal_uInt16 errUnknownOpCode        = 517;
      45             : const sal_uInt16 errUnknownStackVariable = 518;
      46             : const sal_uInt16 errNoValue              = 519; // #VALUE!
      47             : const sal_uInt16 errUnknownToken         = 520;
      48             : const sal_uInt16 errNoCode               = 521; // #NULL!
      49             : const sal_uInt16 errCircularReference    = 522;
      50             : const sal_uInt16 errNoConvergence        = 523;
      51             : const sal_uInt16 errNoRef                = 524; // #REF!
      52             : const sal_uInt16 errNoName               = 525; // #NAME?
      53             : const sal_uInt16 errDoubleRef            = 526;
      54             : const sal_uInt16 errInterpOverflow       = 527;
      55             : // Not displayed, temporary for TrackFormulas,
      56             : // Cell depends on another cell that has errCircularReference
      57             : const sal_uInt16 errTrackFromCircRef     = 528;
      58             : // ScInterpreter internal:  no numeric value but numeric queried. If this is
      59             : // set as mnStringNoValueError no error is generated but 0 returned.
      60             : const sal_uInt16 errCellNoValue          = 529;
      61             : // Interpreter: needed AddIn not found
      62             : const sal_uInt16 errNoAddin              = 530;
      63             : // Interpreter: needed Macro not found
      64             : const sal_uInt16 errNoMacro              = 531;
      65             : // Interpreter: Division by zero
      66             : const sal_uInt16 errDivisionByZero       = 532; // #DIV/0!
      67             : // Compiler: a non-simple (str,err,val) value was put in an array
      68             : const sal_uInt16 errNestedArray          = 533;
      69             : // ScInterpreter internal:  no numeric value but numeric queried. If this is
      70             : // temporarily (!) set as mnStringNoValueError, the error is generated and can
      71             : // be used to distinguish that condition from all other (inherited) errors. Do
      72             : // not use for anything else! Never push or inherit the error otherwise!
      73             : const sal_uInt16 errNotNumericString     = 534;
      74             : // ScInterpreter internal:  jump matrix already has a result at this position,
      75             : // do not overwrite in case of empty code path.
      76             : const sal_uInt16 errJumpMatHasResult     = 535;
      77             : 
      78             : // Interpreter: NA() not available condition, not a real error
      79             : const sal_uInt16 NOTAVAILABLE            = 0x7fff;
      80             : 
      81             : 
      82             : /** Unconditionally construct a double value of NAN where the lower bits
      83             :     represent an interpreter error code. */
      84           0 : inline double CreateDoubleError( sal_uInt16 nErr )
      85             : {
      86             :     union
      87             :     {
      88             :         double fVal;
      89             :         sal_math_Double smVal;
      90             :     };
      91           0 :     ::rtl::math::setNan( &fVal );
      92           0 :     smVal.nan_parts.fraction_lo = nErr;
      93           0 :     return fVal;
      94             : }
      95             : 
      96             : /** Recreate the error code of a coded double error, if any. */
      97           0 : inline sal_uInt16 GetDoubleErrorValue( double fVal )
      98             : {
      99           0 :     if ( ::rtl::math::isFinite( fVal ) )
     100           0 :         return 0;
     101           0 :     if ( ::rtl::math::isInf( fVal ) )
     102           0 :         return errIllegalFPOperation;       // normal INF
     103             :     sal_uInt32 nErr = reinterpret_cast< sal_math_Double * >(
     104           0 :             &fVal)->nan_parts.fraction_lo;
     105           0 :     if ( nErr & 0xffff0000 )
     106           0 :         return errNoValue;                  // just a normal NAN
     107           0 :     return (sal_uInt16)(nErr & 0x0000ffff);     // any other error
     108             : }
     109             : 
     110             : } // namespace ScErrorCodes
     111             : 
     112             : // yes, exceptionally we put a "using namespace" in a header file..
     113             : using namespace ScErrorCodes;
     114             : 
     115             : #endif // INCLUDED_FORMULA_ERRORCODES_HXX
     116             : 
     117             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10