LCOV - code coverage report
Current view: top level - unoidl/source - sourceprovider-parser-requires.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 35 35 100.0 %
Date: 2015-06-13 12:38:46 Functions: 15 15 100.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             : 
      10             : #ifndef INCLUDED_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_REQUIRES_HXX
      11             : #define INCLUDED_UNOIDL_SOURCE_SOURCEPROVIDER_PARSER_REQUIRES_HXX
      12             : 
      13             : #include "sal/config.h"
      14             : 
      15             : #include <vector>
      16             : 
      17             : #include "rtl/string.hxx"
      18             : #include "rtl/ustring.hxx"
      19             : #include "sal/types.h"
      20             : #include "unoidl/unoidl.hxx"
      21             : 
      22             : #define YYLTYPE int
      23             : 
      24             : typedef void * yyscan_t;
      25             : 
      26             : namespace unoidl { namespace detail {
      27             : 
      28             : struct SourceProviderEntity;
      29             : 
      30             : enum SourceProviderAccessDecls { ACCESS_DECL_GET = 0x1, ACCESS_DECL_SET = 0x2 };
      31             : 
      32             : enum SourceProviderFlags {
      33             :     FLAG_ATTRIBUTE = 0x001, FLAG_BOUND = 0x002, FLAG_CONSTRAINED = 0x004,
      34             :     FLAG_MAYBEAMBIGUOUS = 0x008, FLAG_MAYBEDEFAULT = 0x010,
      35             :     FLAG_MAYBEVOID = 0x020, FLAG_OPTIONAL = 0x040, FLAG_PROPERTY = 0x080,
      36             :     FLAG_READONLY = 0x100, FLAG_REMOVABLE = 0x200, FLAG_TRANSIENT = 0x400
      37             : };
      38             : 
      39             : struct SourceProviderExpr {
      40           1 :     static SourceProviderExpr Bool(bool v) {
      41             :         SourceProviderExpr e;
      42           1 :         e.type = TYPE_BOOL;
      43           1 :         e.bval = v;
      44           1 :         return e;
      45             :     }
      46             : 
      47         771 :     static SourceProviderExpr Int(sal_Int64 v) {
      48             :         SourceProviderExpr e;
      49         771 :         e.type = TYPE_INT;
      50         771 :         e.ival = v;
      51         771 :         return e;
      52             :     }
      53             : 
      54       15117 :     static SourceProviderExpr Uint(sal_uInt64 v) {
      55             :         SourceProviderExpr e;
      56       15117 :         e.type = TYPE_UINT;
      57       15117 :         e.uval = v;
      58       15117 :         return e;
      59             :     }
      60             : 
      61          22 :     static SourceProviderExpr Float(double v) {
      62             :         SourceProviderExpr e;
      63          22 :         e.type = TYPE_FLOAT;
      64          22 :         e.fval = v;
      65          22 :         return e;
      66             :     }
      67             : 
      68             :     enum Type { TYPE_BOOL, TYPE_INT, TYPE_UINT, TYPE_FLOAT };
      69             : 
      70             :     Type type;
      71             :     union {
      72             :         bool bval;
      73             :         sal_Int64 ival;
      74             :         sal_uInt64 uval;
      75             :         double fval;
      76             :     };
      77             : };
      78             : 
      79      165711 : struct SourceProviderType {
      80             :     enum Type {
      81             :         TYPE_VOID, TYPE_BOOLEAN, TYPE_BYTE, TYPE_SHORT, TYPE_UNSIGNED_SHORT,
      82             :         TYPE_LONG, TYPE_UNSIGNED_LONG, TYPE_HYPER, TYPE_UNSIGNED_HYPER,
      83             :         TYPE_FLOAT, TYPE_DOUBLE, TYPE_CHAR, TYPE_STRING, TYPE_TYPE, TYPE_ANY,
      84             :         TYPE_SEQUENCE, TYPE_ENUM, TYPE_PLAIN_STRUCT, TYPE_EXCEPTION,
      85             :         TYPE_INTERFACE, TYPE_INSTANTIATED_POLYMORPHIC_STRUCT, TYPE_PARAMETER
      86             :     };
      87             : 
      88        8658 :     SourceProviderType():
      89        8658 :         type(), entity() // avoid false warnings about uninitialized members
      90        8658 :     {}
      91             : 
      92       37576 :     explicit SourceProviderType(Type theType):
      93             :         type(theType),
      94       37576 :         entity() // avoid false warnings about uninitialized member
      95       37576 :     { assert(theType <= TYPE_ANY); }
      96             : 
      97        2229 :     explicit SourceProviderType(SourceProviderType const * componentType):
      98             :         type(TYPE_SEQUENCE),
      99        2229 :         entity() // avoid false warnings about uninitialized member
     100        2229 :     { assert(componentType != 0); subtypes.push_back(*componentType); }
     101             : 
     102        7783 :     SourceProviderType(
     103             :         Type theType, OUString const & theName,
     104             :         SourceProviderEntity const * theEntity):
     105        7783 :         type(theType), name(theName), entity(theEntity)
     106             :     {
     107             :         assert(theType >= TYPE_ENUM && theType <= TYPE_INTERFACE);
     108             :         assert(theEntity != 0);
     109        7783 :     }
     110             : 
     111         132 :     SourceProviderType(
     112             :         OUString const & polymorphicStructTypeTemplateName,
     113             :         SourceProviderEntity const * theEntity,
     114             :         std::vector<SourceProviderType> const & typeArguments):
     115             :         type(TYPE_INSTANTIATED_POLYMORPHIC_STRUCT),
     116             :         name(polymorphicStructTypeTemplateName), entity(theEntity),
     117         132 :         subtypes(typeArguments)
     118         132 :     { assert(theEntity != 0); }
     119             : 
     120          35 :     explicit SourceProviderType(OUString const & identifier):
     121             :         type(TYPE_PARAMETER), name(identifier),
     122          35 :         entity() // avoid false warnings about uninitialized member
     123          35 :     {}
     124             : 
     125             :     OUString getName() const;
     126             : 
     127             :     bool equals(SourceProviderType const & other) const;
     128             : 
     129             :     Type type;
     130             :     OUString name; // TYPE_ENUM ... TYPE_PARAMETER
     131             :     SourceProviderEntity const * entity;
     132             :         // TYPE_ENUM ... TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
     133             :     std::vector<SourceProviderType> subtypes;
     134             :         // TYPE_SEQUENCE, TYPE_INSTANTIATED_POLYMOPRHIC_STRUCT
     135             :     OUString typedefName;
     136             : };
     137             : 
     138             : } }
     139             : 
     140             : #endif
     141             : 
     142             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11