LCOV - code coverage report
Current view: top level - comphelper/source/misc - expandmacro.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 8 8 100.0 %
Date: 2014-11-03 Functions: 1 1 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             : #include <comphelper/expandmacro.hxx>
      11             : 
      12             : #include <com/sun/star/uno/Reference.hxx>
      13             : #include <rtl/ustring.hxx>
      14             : #include <rtl/uri.hxx>
      15             : #include <rtl/bootstrap.hxx>
      16             : 
      17             : using namespace ::com::sun::star;
      18             : using namespace ::com::sun::star::uno;
      19             : 
      20             : namespace comphelper
      21             : {
      22         892 :     rtl::OUString getExpandedFilePath(const rtl::OUString& filepath)
      23             :     {
      24         892 :         rtl::OUString aFilename = filepath;
      25             : 
      26         892 :         if( aFilename.startsWith( "vnd.sun.star.expand:" ) )
      27             :         {
      28             :             // cut protocol
      29         892 :             rtl::OUString aMacro( aFilename.copy( sizeof ( "vnd.sun.star.expand:" ) -1 ) );
      30             : 
      31             :             // decode uric class chars
      32         892 :             aMacro = rtl::Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
      33             : 
      34             :             // expand macro string
      35         892 :             rtl::Bootstrap::expandMacros( aMacro);
      36             : 
      37         892 :             aFilename = aMacro;
      38             :         }
      39         892 :         return aFilename;
      40             :     }
      41             : }

Generated by: LCOV version 1.10