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 .
20 #define CSV_USE_CSV_ASSERTIONS
21 #include <cosv/csv_env.hxx>
23 #include <cosv/comfunc.hxx>
24 #include <cosv/string.hxx>
25 #include <cosv/streamstr.hxx>
26 #include <cosv/std_outp.hxx>
27 #include <cosv/tpl/dyn.hxx>
28 #include <cosv/ploc.hxx>
30 // NOT FULLY DECLARED SERVICES
31 #include <cosv/bstream.hxx>
42 Path::Path( const char * i_sPath
,
43 bool i_bPathIsAlwaysDir
,
44 const char * i_sDelimiter
)
49 Set(i_sPath
, i_bPathIsAlwaysDir
, i_sDelimiter
);
52 Path::Path( const Path
& i_rPath
)
53 : pRoot(i_rPath
.pRoot
->CreateCopy()),
64 Path::operator=( const Path
& i_rPath
)
66 pRoot
= i_rPath
.pRoot
->CreateCopy();
67 aPath
= i_rPath
.aPath
;
68 sFile
= i_rPath
.sFile
;
74 Path::Set( const char * i_sPath
,
75 bool i_bPathIsAlwaysDir
,
76 const char * i_sDelimiter
)
78 if ( *i_sDelimiter
!= '\\' AND
*i_sDelimiter
!= '/' )
83 pRoot
= Root::Create_( restPath
, i_sPath
, i_sDelimiter
);
87 aPath
.Set(restPath
, i_bPathIsAlwaysDir
, i_sDelimiter
);
89 if (NOT i_bPathIsAlwaysDir
)
92 file
= strrchr( restPath
, *i_sDelimiter
);
102 Path::SetFile( const String
& i_sName
)
108 Path::IsValid() const
110 return RootDir().OwnDelimiter() != 0;
114 Path::Get( bostream
& o_rPath
) const
119 pRoot
->Get( o_rPath
);
120 aPath
.Get( o_rPath
, pRoot
->OwnDelimiter() );
122 if ( sFile
.length() > 0 )
123 o_rPath
.write( sFile
);
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */