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 32 class PackageUri 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: PackageUri(const OUString & rPackageUri)47 explicit PackageUri( const OUString & rPackageUri ) 48 : m_aUri( rPackageUri ), m_bValid( false ) {} 49 isValid() const50 bool isValid() const 51 { init(); return m_bValid; } 52 getUri() const53 const OUString & getUri() const 54 { init(); return m_aUri; } 55 setUri(const OUString & rPackageUri)56 void setUri( const OUString & rPackageUri ) 57 { m_aPath.clear(); m_aUri = rPackageUri; m_bValid = false; } 58 getParentUri() const59 const OUString & getParentUri() const 60 { init(); return m_aParentUri; } 61 getPackage() const62 const OUString & getPackage() const 63 { init(); return m_aPackage; } 64 getPath() const65 const OUString & getPath() const 66 { init(); return m_aPath; } 67 getName() const68 const OUString & getName() const 69 { init(); return m_aName; } 70 getParam() const71 const OUString & getParam() const 72 { init(); return m_aParam; } 73 getScheme() const74 const OUString & getScheme() const 75 { init(); return m_aScheme; } 76 77 inline bool isRootFolder() const; 78 }; 79 isRootFolder() const80inline bool PackageUri::isRootFolder() const 81 { 82 init(); 83 return m_aPath == "/"; 84 } 85 86 } 87 88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 89