LCOV - code coverage report
Current view: top level - include/comphelper - optional.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 2 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 1 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             : #ifndef INCLUDED_COMPHELPER_OPTIONAL_HXX
      20             : #define INCLUDED_COMPHELPER_OPTIONAL_HXX
      21             : 
      22             : #include <com/sun/star/beans/Optional.hpp>
      23             : #include <boost/optional.hpp>
      24             : 
      25             : namespace comphelper {
      26             : 
      27             : /// Object generators for boost::optional<T>, beans::Optional<T>:
      28             : 
      29             : template <typename T>
      30           0 : inline ::boost::optional<T> make_optional( T const& v )
      31             : {
      32           0 :     return ::boost::optional<T>(v);
      33             : }
      34             : 
      35             : template <typename T>
      36             : inline ::boost::optional<T> make_optional(
      37             :     ::com::sun::star::beans::Optional<T> const& o )
      38             : {
      39             :     if (o.IsPresent)
      40             :         return ::boost::optional<T>(o.Value);
      41             :     else
      42             :         return ::boost::optional<T>();
      43             : }
      44             : 
      45             : template <typename T>
      46             : inline ::com::sun::star::beans::Optional<T> makeOptional( T const& v )
      47             : {
      48             : //     CPPU_IS_CPP_MAPPING_OF_NON_VOID_UNO_TYPE(T);
      49             :     return ::com::sun::star::beans::Optional<T>(true, v);
      50             : }
      51             : 
      52             : template <typename T>
      53             : inline ::com::sun::star::beans::Optional<T> makeOptional(
      54             :     ::boost::optional<T> const& o )
      55             : {
      56             : //     CPPU_IS_CPP_MAPPING_OF_NON_VOID_UNO_TYPE(T);
      57             :     if (o)
      58             :         return ::com::sun::star::beans::Optional<T>(true, *o);
      59             :     else
      60             :         return ::com::sun::star::beans::Optional<T>();
      61             : }
      62             : 
      63             : inline ::com::sun::star::beans::Optional<sal_Bool> makeOptional(
      64             :     ::boost::optional<bool> const& o )
      65             : {
      66             :     if (o)
      67             :         return ::com::sun::star::beans::Optional<sal_Bool>(true, *o);
      68             :     else
      69             :         return ::com::sun::star::beans::Optional<sal_Bool>();
      70             : }
      71             : 
      72             : inline ::com::sun::star::beans::Optional<sal_Bool> makeOptional( bool v )
      73             : {
      74             :     return ::com::sun::star::beans::Optional<sal_Bool>(true, v);
      75             : }
      76             : 
      77             : } // namespace comphelper
      78             : 
      79             : #endif // ! defined(INCLUDED_COMPHELPER_OPTIONAL_HXX)
      80             : 
      81             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11