CFx SDK Documentation
2020SP3
SDK
CFx
dd_inc
OdPath.h
Go to the documentation of this file.
1
// Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3
// All rights reserved.
4
//
5
// This software and its documentation and related materials are owned by
6
// the Alliance. The software may only be incorporated into application
7
// programs owned by members of the Alliance, subject to a signed
8
// Membership Agreement and Supplemental Software License Agreement with the
9
// Alliance. The structure and organization of this software are the valuable
10
// trade secrets of the Alliance and its suppliers. The software is also
11
// protected by copyright law and international treaty provisions. Application
12
// programs incorporating this software must include the following statement
13
// with their copyright notices:
14
//
15
// This application incorporates Teigha(R) software pursuant to a license
16
// agreement with Open Design Alliance.
17
// Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18
// All rights reserved.
19
//
20
// By use of this software, its documentation or related materials, you
21
// acknowledge and accept the above terms.
23
24
#ifndef _ODPATH_INCLUDED_
25
#define _ODPATH_INCLUDED_
26
27
#include "
OdString.h
"
28
29
namespace
Oda
30
{
31
32
// Support methods operating with relative paths:
33
// isRelativePath()
34
// makeRelativePath()
35
// adjustPath()
36
//
37
#ifdef ODA_UNIXOS
38
#define pathChar '/'
39
#define dirDiv L"/"
40
#define dirCur L"./"
41
#define dirUp L"../"
42
inline
bool
isRelativePath
(
const
OdChar
* path)
43
{
44
return
path && path[0] != L
'/'
;
45
}
46
#else
47
#define pathChar '\\'
48
#define dirDiv L"\\"
49
#define dirCur L".\\"
50
#define dirUp L"..\\"
51
52
inline
bool
isUNCPath
(
const
OdChar
* path)
53
{
54
return
Od_wcslen
(path) >= 4 &&
// "\\a" can't be a UNC path
55
path[0] ==
pathChar
&& path[1] ==
pathChar
&& path[2] !=
pathChar
;
56
}
57
58
inline
bool
isRelativePath
(
const
OdChar
* path)
59
{
60
return
path &&
odWStrChr
(path,
':'
) == 0 && !
isUNCPath
(path);
61
}
62
#endif
63
64
FIRSTDLL_EXPORT
bool
makeRelativePath
(
const
OdString
& from,
const
OdString
& to,
OdString
& out,
bool
windowsMode =
false
);
65
FIRSTDLL_EXPORT
bool
adjustPath
(
OdString
& path,
bool
windowsMode =
false
);
66
67
}
// namespace Oda
68
69
#endif // _ODPATH_INCLUDED_
FIRSTDLL_EXPORT
#define FIRSTDLL_EXPORT
Definition:
RootExport.h:39
OdString
Definition:
OdString.h:95
Oda::adjustPath
FIRSTDLL_EXPORT bool adjustPath(OdString &path, bool windowsMode=false)
odWStrChr
#define odWStrChr(str, ch)
Definition:
OdPlatform.h:153
Oda::isRelativePath
bool isRelativePath(const OdChar *path)
Definition:
OdPath.h:58
Oda
Definition:
TxDefs.h:48
Oda::isUNCPath
bool isUNCPath(const OdChar *path)
Definition:
OdPath.h:52
Od_wcslen
#define Od_wcslen
Definition:
OdPlatform.h:144
OdString.h
OdChar
wchar_t OdChar
Definition:
OdPlatformSettings.h:745
Oda::makeRelativePath
FIRSTDLL_EXPORT bool makeRelativePath(const OdString &from, const OdString &to, OdString &out, bool windowsMode=false)
pathChar
#define pathChar
Definition:
OdPath.h:47
Generated on Mon Oct 12 2020 11:49:43