LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/binaryurp/source - binaryany.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 29 29 100.0 %
Date: 2013-07-09 Functions: 9 9 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             :  * 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             : #include "sal/config.h"
      21             : 
      22             : #include <cassert>
      23             : 
      24             : #include "typelib/typeclass.h"
      25             : #include "typelib/typedescription.hxx"
      26             : #include "uno/any2.h"
      27             : 
      28             : #include "binaryany.hxx"
      29             : 
      30             : namespace binaryurp {
      31             : 
      32      481508 : BinaryAny::BinaryAny() throw () {
      33      481508 :     uno_any_construct(&data_, 0, 0, 0);
      34      481512 : }
      35             : 
      36      803049 : BinaryAny::BinaryAny(css::uno::TypeDescription const & type, void * value)
      37             :     throw ()
      38             : {
      39             :     assert(type.is());
      40      803049 :     uno_any_construct(&data_, value, type.get(), 0);
      41      803049 : }
      42             : 
      43       16854 : BinaryAny::BinaryAny(uno_Any const & raw) throw () {
      44             :     assert(raw.pType != 0);
      45       16854 :     data_.pType = raw.pType;
      46       16854 :     typelib_typedescriptionreference_acquire(data_.pType);
      47       16854 :     data_.pData = raw.pData == &raw.pReserved ? &data_.pReserved : raw.pData;
      48       16854 :     data_.pReserved = raw.pReserved;
      49       16854 : }
      50             : 
      51     1319339 : BinaryAny::BinaryAny(BinaryAny const & other) throw () {
      52     1319339 :     uno_type_any_construct(&data_, other.data_.pData, other.data_.pType, 0);
      53     1319339 : }
      54             : 
      55     2620780 : BinaryAny::~BinaryAny() throw () {
      56     2620780 :     uno_any_destruct(&data_, 0);
      57     2620784 : }
      58             : 
      59      382108 : BinaryAny & BinaryAny::operator =(BinaryAny const & other) throw () {
      60      382108 :     if (&other != this) {
      61      382108 :         uno_type_any_assign(&data_, other.data_.pData, other.data_.pType, 0, 0);
      62             :     }
      63      382108 :     return *this;
      64             : }
      65             : 
      66          54 : uno_Any * BinaryAny::get() throw () {
      67          54 :     return &data_;
      68             : }
      69             : 
      70         134 : css::uno::TypeDescription BinaryAny::getType() const throw () {
      71         134 :     return css::uno::TypeDescription(data_.pType);
      72             : }
      73             : 
      74      851919 : void * BinaryAny::getValue(css::uno::TypeDescription const & type) const
      75             :     throw ()
      76             : {
      77             :     assert(
      78             :         type.is() &&
      79             :         (type.get()->eTypeClass == typelib_TypeClass_ANY ||
      80             :          type.equals(css::uno::TypeDescription(data_.pType))));
      81      851919 :     return type.get()->eTypeClass == typelib_TypeClass_ANY
      82      851919 :         ? &data_ : data_.pData;
      83             : }
      84             : 
      85             : }
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10