Update git submodules
[LibreOffice.git] / ucb / source / ucp / package / pkguri.hxx
blob4583a1afc8199a5fc69aade55808ff6e17995581
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <rtl/ustring.hxx>
23 #include <utility>
25 namespace package_ucp {
28 #define PACKAGE_URL_SCHEME "vnd.sun.star.pkg"
29 #define PACKAGE_ZIP_URL_SCHEME "vnd.sun.star.zip"
30 #define PACKAGE_URL_SCHEME_LENGTH 16
33 class PackageUri
35 mutable OUString m_aUri;
36 mutable OUString m_aParentUri;
37 mutable OUString m_aPackage;
38 mutable OUString m_aPath;
39 mutable OUString m_aName;
40 mutable OUString m_aParam;
41 mutable OUString m_aScheme;
42 mutable bool m_bValid;
44 private:
45 void init() const;
47 public:
48 explicit PackageUri( OUString aPackageUri )
49 : m_aUri(std::move( aPackageUri )), m_bValid( false ) {}
51 bool isValid() const
52 { init(); return m_bValid; }
54 const OUString & getUri() const
55 { init(); return m_aUri; }
57 void setUri( const OUString & rPackageUri )
58 { m_aPath.clear(); m_aUri = rPackageUri; m_bValid = false; }
60 const OUString & getParentUri() const
61 { init(); return m_aParentUri; }
63 const OUString & getPackage() const
64 { init(); return m_aPackage; }
66 const OUString & getPath() const
67 { init(); return m_aPath; }
69 const OUString & getName() const
70 { init(); return m_aName; }
72 const OUString & getParam() const
73 { init(); return m_aParam; }
75 const OUString & getScheme() const
76 { init(); return m_aScheme; }
78 inline bool isRootFolder() const;
81 inline bool PackageUri::isRootFolder() const
83 init();
84 return m_aPath == "/";
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */