fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucb / source / ucp / tdoc / tdoc_uri.hxx
blobd4ecdd2f528b7fb1dd271d9b0a182831122b020c
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 #ifndef INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_URI_HXX
21 #define INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_URI_HXX
23 #include "rtl/ustring.hxx"
25 namespace tdoc_ucp {
29 #define TDOC_URL_SCHEME "vnd.sun.star.tdoc"
30 #define TDOC_URL_SCHEME_LENGTH 17
34 class Uri
36 enum State { UNKNOWN, INVALID, VALID };
38 mutable OUString m_aUri;
39 mutable OUString m_aParentUri;
40 mutable OUString m_aPath;
41 mutable OUString m_aDocId;
42 mutable OUString m_aInternalPath;
43 mutable OUString m_aName;
44 mutable OUString m_aDecodedName;
45 mutable State m_eState;
47 private:
48 void init() const;
50 public:
51 Uri() : m_eState( UNKNOWN ) {}
52 Uri( const OUString & rUri )
53 : m_aUri( rUri ), m_eState( UNKNOWN ) {}
55 bool operator== ( const Uri & rOther ) const
56 { init(); return m_aUri == rOther.m_aUri; }
58 bool operator!= ( const Uri & rOther ) const
59 { return !operator==( rOther ); }
61 bool isValid() const
62 { init(); return m_eState == VALID; }
64 const OUString & getUri() const
65 { init(); return m_aUri; }
67 inline void setUri( const OUString & rUri );
69 const OUString & getParentUri() const
70 { init(); return m_aParentUri; }
72 const OUString & getPath() const
73 { init(); return m_aPath; }
75 const OUString & getDocumentId() const
76 { init(); return m_aDocId; }
78 const OUString & getInternalPath() const
79 { init(); return m_aInternalPath; }
81 const OUString & getName() const
82 { init(); return m_aName; }
84 const OUString & getDecodedName() const
85 { init(); return m_aDecodedName; }
87 inline bool isRoot() const;
89 inline bool isDocument() const;
91 inline bool isFolder() const;
94 inline void Uri::setUri( const OUString & rUri )
96 m_eState = UNKNOWN;
97 m_aUri = rUri;
98 m_aParentUri.clear();
99 m_aDocId.clear();
100 m_aInternalPath.clear();
101 m_aPath.clear();
102 m_aName.clear();
103 m_aDecodedName.clear();
106 inline bool Uri::isRoot() const
108 init();
109 return ( m_aPath.getLength() == 1 );
112 inline bool Uri::isDocument() const
114 init();
115 return ( ( !m_aDocId.isEmpty() ) /* not root */
116 && ( m_aPath.copy( m_aDocId.getLength() + 1 ).getLength() < 2 ) );
119 inline bool Uri::isFolder() const
121 init();
122 return m_aPath.isEmpty() || m_aPath.endsWith( "/" );
125 } // namespace tdoc_ucp
127 #endif // INCLUDED_UCB_SOURCE_UCP_TDOC_TDOC_URI_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */