1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
24 #include <cosv/string.hxx>
25 #include <cosv/plocroot.hxx>
26 #include <cosv/dirchain.hxx>
27 #include <cosv/tpl/dyn.hxx>
28 #include <cosv/csv_ostream.hxx>
42 /** Represents a path in the file system.
44 The path can be relative or absolute and in Unix- or Windows-syntax.
52 const char * i_sPath
= ".", /// Dirs have to be ended with a '\\ or '/'.
53 bool i_bPathIsAlwaysDir
= false, /// This overrides a missing Delimiter at the end of the i_sPath, if true.
54 const char * i_sDelimiter
= Delimiter() );
56 const Path
& i_rPath
);
60 const Path
& i_rPath
);
64 bool i_bPathIsAlwaysDir
= false,
65 const char * i_sDelimiter
= Delimiter() );
66 void SetFile( // If there is already a file, that is exchanged.
67 const String
& i_sName
);
69 const Root
& RootDir() const { return *pRoot
; }
70 const DirectoryChain
&
71 DirChain() const { return aPath
; }
72 const String
& File() const { return sFile
; }
74 bool IsDirectory() const { return sFile
.length() == 0; }
75 bool IsFile() const { return sFile
.length() > 0; }
77 /// Directories have a delimiter at the end, files not.
79 bostream
& o_rPath
) const;
81 DirectoryChain
& DirChain() { return aPath
; }
95 /// Directories produce a delimiter at the end, files not.
96 inline csv::bostream
&
97 operator<<( csv::bostream
& o_rOut
,
98 const csv::ploc::Path
& i_rPath
)
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */