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 
24 namespace package_ucp {
25 
26 
27 #define PACKAGE_URL_SCHEME "vnd.sun.star.pkg"
28 #define PACKAGE_ZIP_URL_SCHEME "vnd.sun.star.zip"
29 #define PACKAGE_URL_SCHEME_LENGTH 16
30 
31 
33 {
34  mutable OUString m_aUri;
35  mutable OUString m_aParentUri;
36  mutable OUString m_aPackage;
37  mutable OUString m_aPath;
38  mutable OUString m_aName;
39  mutable OUString m_aParam;
40  mutable OUString m_aScheme;
41  mutable bool m_bValid;
42 
43 private:
44  void init() const;
45 
46 public:
47  explicit PackageUri( const OUString & rPackageUri )
48  : m_aUri( rPackageUri ), m_bValid( false ) {}
49 
50  bool isValid() const
51  { init(); return m_bValid; }
52 
53  const OUString & getUri() const
54  { init(); return m_aUri; }
55 
56  void setUri( const OUString & rPackageUri )
57  { m_aPath.clear(); m_aUri = rPackageUri; m_bValid = false; }
58 
59  const OUString & getParentUri() const
60  { init(); return m_aParentUri; }
61 
62  const OUString & getPackage() const
63  { init(); return m_aPackage; }
64 
65  const OUString & getPath() const
66  { init(); return m_aPath; }
67 
68  const OUString & getName() const
69  { init(); return m_aName; }
70 
71  const OUString & getParam() const
72  { init(); return m_aParam; }
73 
74  const OUString & getScheme() const
75  { init(); return m_aScheme; }
76 
77  inline bool isRootFolder() const;
78 };
79 
80 inline bool PackageUri::isRootFolder() const
81 {
82  init();
83  return m_aPath == "/";
84 }
85 
86 }
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const OUString & getParam() const
Definition: pkguri.hxx:71
void setUri(const OUString &rPackageUri)
Definition: pkguri.hxx:56
bool isRootFolder() const
Definition: pkguri.hxx:80
bool isValid() const
Definition: pkguri.hxx:50
const OUString & getPath() const
Definition: pkguri.hxx:65
const OUString & getScheme() const
Definition: pkguri.hxx:74
const OUString & getPackage() const
Definition: pkguri.hxx:62
const OUString & getName() const
Definition: pkguri.hxx:68
const OUString & getParentUri() const
Definition: pkguri.hxx:59
PackageUri(const OUString &rPackageUri)
Definition: pkguri.hxx:47
void init() const
Definition: pkguri.cxx:59
const OUString & getUri() const
Definition: pkguri.hxx:53