LibreOffice Module ucb (master) 1
pkguri.hxx
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#pragma once
21
22#include <rtl/ustring.hxx>
23#include <utility>
24
25namespace package_ucp {
26
27
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
31
32
34{
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;
43
44private:
45 void init() const;
46
47public:
48 explicit PackageUri( OUString aPackageUri )
49 : m_aUri(std::move( aPackageUri )), m_bValid( false ) {}
50
51 bool isValid() const
52 { init(); return m_bValid; }
53
54 const OUString & getUri() const
55 { init(); return m_aUri; }
56
57 void setUri( const OUString & rPackageUri )
58 { m_aPath.clear(); m_aUri = rPackageUri; m_bValid = false; }
59
60 const OUString & getParentUri() const
61 { init(); return m_aParentUri; }
62
63 const OUString & getPackage() const
64 { init(); return m_aPackage; }
65
66 const OUString & getPath() const
67 { init(); return m_aPath; }
68
69 const OUString & getName() const
70 { init(); return m_aName; }
71
72 const OUString & getParam() const
73 { init(); return m_aParam; }
74
75 const OUString & getScheme() const
76 { init(); return m_aScheme; }
77
78 inline bool isRootFolder() const;
79};
80
81inline bool PackageUri::isRootFolder() const
82{
83 init();
84 return m_aPath == "/";
85}
86
87}
88
89/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool isRootFolder() const
Definition: pkguri.hxx:81
const OUString & getParam() const
Definition: pkguri.hxx:72
const OUString & getScheme() const
Definition: pkguri.hxx:75
void setUri(const OUString &rPackageUri)
Definition: pkguri.hxx:57
const OUString & getName() const
Definition: pkguri.hxx:69
const OUString & getParentUri() const
Definition: pkguri.hxx:60
void init() const
Definition: pkguri.cxx:63
const OUString & getPackage() const
Definition: pkguri.hxx:63
bool isValid() const
Definition: pkguri.hxx:51
PackageUri(OUString aPackageUri)
Definition: pkguri.hxx:48
const OUString & getPath() const
Definition: pkguri.hxx:66
const OUString & getUri() const
Definition: pkguri.hxx:54