Coverage Report

Created: 2026-10-14 09:33

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
16.2k
{
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
16.2k
    sal_Int32 nPos = rURL.indexOf( ':' );
48
16.2k
    if ( nPos != -1 )
49
16.2k
    {
50
16.2k
        OUString aScheme( rURL.copy( 0, nPos ) );
51
16.2k
        m_aProviderScheme = aScheme.toAsciiLowerCase();
52
16.2k
        m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
53
16.2k
    }
54
16.2k
}
55
56
57
// ContentIdentifier Implementation.
58
59
60
ContentIdentifier::ContentIdentifier( const OUString& rURL )
61
16.2k
    : m_pImpl( new ContentIdentifier_Impl( rURL ) )
62
16.2k
{
63
16.2k
}
64
65
66
// virtual
67
ContentIdentifier::~ContentIdentifier()
68
16.2k
{
69
16.2k
}
70
71
72
// XContentIdentifier methods.
73
74
75
// virtual
76
OUString SAL_CALL ContentIdentifier::getContentIdentifier()
77
20.6k
{
78
20.6k
    return m_pImpl->m_aContentId;
79
20.6k
}
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: */