LCOV - code coverage report
Current view: top level - reportdesign/inc - reportformula.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 5 0.0 %
Date: 2014-04-14 Functions: 0 3 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 REPORTFORMULA_HXX
      21             : #define REPORTFORMULA_HXX
      22             : 
      23             : #include "dllapi.h"
      24             : 
      25             : #include <com/sun/star/uno/Any.hxx>
      26             : 
      27             : #include <osl/diagnose.h>
      28             : 
      29             : 
      30             : namespace rptui
      31             : {
      32             : 
      33             : 
      34             : 
      35             :     //= ReportFormula
      36             : 
      37             :     class REPORTDESIGN_DLLPUBLIC ReportFormula
      38             :     {
      39             :     public:
      40             :         enum BindType
      41             :         {
      42             :             Expression,
      43             :             Field,
      44             : 
      45             :             Invalid
      46             :         };
      47             : 
      48             :     private:
      49             :         BindType            m_eType;
      50             :         OUString     m_sCompleteFormula;
      51             :         OUString     m_sUndecoratedContent;
      52             : 
      53             :     public:
      54             :         /// constructs a ReportFormula object from a string
      55             :         ReportFormula( const OUString& _rFormula );
      56             : 
      57             :         /// constructs a ReportFormula by BindType
      58             :         ReportFormula( const BindType _eType, const OUString& _rFieldOrExpression );
      59             :         ~ReportFormula();
      60             : 
      61             :         ReportFormula& operator=(class ReportFormula const &);
      62             : 
      63             :         /// returns whether the object denotes a valid formula
      64             :         bool        isValid() const;
      65             : 
      66             :         /// returns the type of the binding represented by the formula
      67           0 :         inline BindType    getType() const { return m_eType; }
      68             : 
      69             :         /// returns the complete formula represented by the object
      70             :         const OUString&
      71             :                     getCompleteFormula() const;
      72             : 
      73             :         /** gets the <em>undecorated formula</em> content
      74             : 
      75             :             If the formula denotes a field binding, the <em>undecorated content</em> is the
      76             :             field name.
      77             : 
      78             :             If the formula denotes an expression, then the <em>undecorated content</em> is the expression
      79             :             itself.
      80             :         */
      81             :         const OUString& getUndecoratedContent() const;
      82             : 
      83             :         /// convenience alias for <code>getUndecoratedContent</code>, which asserts (in a non-product build) when used on an expression
      84             :         inline OUString  getFieldName() const;
      85             : 
      86             :         /**
      87             :             @returns "=" + getFieldName()
      88             :         */
      89             :         OUString getEqualUndecoratedContent() const;
      90             : 
      91             :         /// convenience alias for <code>getUndecoratedContent</code>, which asserts (in a non-product build) when used on a field
      92             :         inline OUString  getExpression() const;
      93             : 
      94             :         /** returns a bracketed field name of the formula denotes a field reference,
      95             :             or the undecorated expression if the formula denotes an expression.
      96             : 
      97             :             Effectively, this means the method returns the complete formular, stripped by the prefix
      98             :             which indicates a field or a expression.
      99             :         */
     100             :         OUString getBracketedFieldOrExpression() const;
     101             : 
     102             :     private:
     103             :         void    impl_construct( const OUString& _rFormula );
     104             :     };
     105             : 
     106             : 
     107           0 :     inline OUString ReportFormula::getFieldName() const
     108             :     {
     109             :         OSL_PRECOND( getType() == Field, "ReportFormula::getFieldName: not bound to a field!" );
     110           0 :         return getUndecoratedContent();
     111             :     }
     112             : 
     113             : 
     114           0 :     inline OUString ReportFormula::getExpression() const
     115             :     {
     116             :         OSL_PRECOND( getType() == Expression, "ReportFormula::getExpression: not bound to an expression!" );
     117           0 :         return getUndecoratedContent();
     118             :     }
     119             : 
     120             : 
     121             : } // namespace rptui
     122             : 
     123             : 
     124             : #endif // REPORTFORMULA_HXX
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10