LCOV - code coverage report
Current view: top level - stoc/source/javavm - interact.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 27 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 15 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             : 
      21             : #include "interact.hxx"
      22             : 
      23             : #include <boost/noncopyable.hpp>
      24             : #include <com/sun/star/java/JavaDisabledException.hpp>
      25             : #include <com/sun/star/java/JavaVMCreationFailureException.hpp>
      26             : #include <com/sun/star/task/XInteractionAbort.hpp>
      27             : #include <com/sun/star/task/XInteractionRetry.hpp>
      28             : #include <com/sun/star/task/XInteractionContinuation.hpp>
      29             : #include <cppuhelper/implbase1.hxx>
      30             : #include <osl/mutex.hxx>
      31             : 
      32             : using stoc_javavm::InteractionRequest;
      33             : 
      34             : namespace {
      35             : 
      36             : class AbortContinuation:
      37             :     public cppu::WeakImplHelper1<css::task::XInteractionAbort>,
      38             :     private boost::noncopyable
      39             : {
      40             : public:
      41           0 :     inline AbortContinuation() {}
      42             : 
      43           0 :     virtual void SAL_CALL select() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE {}
      44             : 
      45             : private:
      46           0 :     virtual inline ~AbortContinuation() {}
      47             : };
      48             : 
      49             : }
      50             : 
      51             : class InteractionRequest::RetryContinuation:
      52             :     public cppu::WeakImplHelper1<css::task::XInteractionRetry>,
      53             :     private boost::noncopyable
      54             : {
      55             : public:
      56           0 :     inline RetryContinuation(): m_bSelected(false) {}
      57             : 
      58             :     virtual void SAL_CALL select() throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      59             : 
      60             :     bool isSelected() const;
      61             : 
      62             : private:
      63           0 :     virtual inline ~RetryContinuation() {}
      64             : 
      65             :     mutable osl::Mutex m_aMutex;
      66             :     bool m_bSelected;
      67             : };
      68             : 
      69           0 : void SAL_CALL InteractionRequest::RetryContinuation::select()
      70             :     throw (css::uno::RuntimeException, std::exception)
      71             : {
      72           0 :     osl::MutexGuard aGuard(m_aMutex);
      73           0 :     m_bSelected = true;
      74           0 : }
      75             : 
      76           0 : bool InteractionRequest::RetryContinuation::isSelected() const
      77             : {
      78           0 :     osl::MutexGuard aGuard(m_aMutex);
      79           0 :     return m_bSelected;
      80             : }
      81             : 
      82           0 : InteractionRequest::InteractionRequest(css::uno::Any const & rRequest):
      83           0 :     m_aRequest(rRequest)
      84             : {
      85           0 :     m_aContinuations.realloc(2);
      86           0 :     m_xRetryContinuation = new RetryContinuation;
      87           0 :     m_aContinuations[0] = new AbortContinuation;
      88           0 :     m_aContinuations[1] = m_xRetryContinuation.get();
      89           0 : }
      90             : 
      91           0 : css::uno::Any SAL_CALL InteractionRequest::getRequest()
      92             :     throw (css::uno::RuntimeException, std::exception)
      93             : {
      94           0 :     return m_aRequest;
      95             : }
      96             : 
      97             : css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > >
      98           0 : SAL_CALL InteractionRequest::getContinuations()
      99             :     throw (css::uno::RuntimeException, std::exception)
     100             : {
     101           0 :     return m_aContinuations;
     102             : }
     103             : 
     104           0 : bool InteractionRequest::retry() const
     105             : {
     106           0 :     return m_xRetryContinuation.is() && m_xRetryContinuation->isSelected();
     107             : }
     108             : 
     109           0 : InteractionRequest::~InteractionRequest()
     110           0 : {}
     111             : 
     112             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11