Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/ucbhelper/source/provider/contentidentifier.cxx
Line
Count
Source
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 <ucbhelper/contentidentifier.hxx>
21
22
using namespace com::sun::star::uno;
23
using namespace com::sun::star::ucb;
24
25
26
namespace ucbhelper
27
{
28
29
struct ContentIdentifier_Impl
30
{
31
    OUString                          m_aContentId;
32
    OUString                          m_aProviderScheme;
33
34
    explicit ContentIdentifier_Impl( const OUString& rURL );
35
};
36
37
38
// ContentIdentifier_Impl Implementation.
39
40
41
ContentIdentifier_Impl::ContentIdentifier_Impl(const OUString& rURL )
42
10.7k
{
43
    // Normalize URL scheme ( it's case insensitive ).
44
45
    // The content provider scheme is the part before the first ':'
46
    // within the content id.
47
10.7k
    sal_Int32 nPos = rURL.indexOf( ':' );
48
10.7k
    if ( nPos != -1 )
49
10.7k
    {
50
10.7k
        OUString aScheme( rURL.copy( 0, nPos ) );
51
10.7k
        m_aProviderScheme = aScheme.toAsciiLowerCase();
52
10.7k
        m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
53
10.7k
    }
54
10.7k
}
55
56
57
// ContentIdentifier Implementation.
58
59
60
ContentIdentifier::ContentIdentifier( const OUString& rURL )
61
10.7k
    : m_pImpl( new ContentIdentifier_Impl( rURL ) )
62
10.7k
{
63
10.7k
}
64
65
66
// virtual
67
ContentIdentifier::~ContentIdentifier()
68
10.7k
{
69
10.7k
}
70
71
72
// XContentIdentifier methods.
73
74
75
// virtual
76
OUString SAL_CALL ContentIdentifier::getContentIdentifier()
77
14.7k
{
78
14.7k
    return m_pImpl->m_aContentId;
79
14.7k
}
80
81
82
// virtual
83
OUString SAL_CALL ContentIdentifier::getContentProviderScheme()
84
0
{
85
0
    return m_pImpl->m_aProviderScheme;
86
0
}
87
88
} /* namespace ucbhelper */
89
90
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */