LibreOffice Module ucbhelper (master)  1
contentidentifier.cxx
Go to the documentation of this file.
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 /**************************************************************************
22  TODO
23  **************************************************************************
24 
25  *************************************************************************/
29 
30 using namespace com::sun::star::uno;
31 using namespace com::sun::star::lang;
32 using namespace com::sun::star::ucb;
33 
34 
35 namespace ucbhelper
36 {
37 
38 
39 // struct ContentIdentifier_Impl.
40 
41 
43 {
44  OUString m_aContentId;
46 
47  explicit ContentIdentifier_Impl( const OUString& rURL );
48 };
49 
50 
51 // ContentIdentifier_Impl Implementation.
52 
53 
54 ContentIdentifier_Impl::ContentIdentifier_Impl(const OUString& rURL )
55 {
56  // Normalize URL scheme ( it's case insensitive ).
57 
58  // The content provider scheme is the part before the first ':'
59  // within the content id.
60  sal_Int32 nPos = rURL.indexOf( ':' );
61  if ( nPos != -1 )
62  {
63  OUString aScheme( rURL.copy( 0, nPos ) );
64  m_aProviderScheme = aScheme.toAsciiLowerCase();
65  m_aContentId = rURL.replaceAt( 0, nPos, aScheme );
66  }
67 }
68 
69 
70 // ContentIdentifier Implementation.
71 
72 
73 ContentIdentifier::ContentIdentifier( const OUString& rURL )
74  : m_pImpl( new ContentIdentifier_Impl( rURL ) )
75 {
76 }
77 
78 
79 // virtual
81 {
82 }
83 
84 
85 // XContentIdentifier methods.
86 
87 
88 // virtual
90 {
91  return m_pImpl->m_aContentId;
92 }
93 
94 
95 // virtual
97 {
98  return m_pImpl->m_aProviderScheme;
99 }
100 
101 } /* namespace ucbhelper */
102 
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ContentIdentifier(const OUString &ContentId)
virtual ~ContentIdentifier() override
virtual OUString SAL_CALL getContentIdentifier() override
virtual OUString SAL_CALL getContentProviderScheme() override
std::unique_ptr< ContentIdentifier_Impl > m_pImpl
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
sal_uInt16 nPos