blob: 30b4dadf11e5d98b651b603275920bf0d32dc3f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
// File: TDocStd_PathParser.cxx
// Created: Fri Sep 17 17:51:42 1999
// Author: Denis PASCAL
// <dp@dingox.paris1.matra-dtv.fr>
#include <TDocStd_PathParser.ixx>
TDocStd_PathParser::TDocStd_PathParser(const TCollection_ExtendedString& path)
{
myPath = path;
Parse();
}
void TDocStd_PathParser::Parse()
{
TCollection_ExtendedString temp = myPath;
Standard_Integer PointPosition = myPath.SearchFromEnd(TCollection_ExtendedString("."));
if (PointPosition>0)
myExtension = temp.Split(PointPosition);
else
return;
temp.Trunc(PointPosition-1);
Standard_Boolean isFileName = (temp.Length()) ? Standard_True : Standard_False;
Standard_Boolean isTrek = Standard_True;
#ifdef WNT
PointPosition = temp.SearchFromEnd(TCollection_ExtendedString("\\"));
if (!(PointPosition>0))
PointPosition = temp.SearchFromEnd(TCollection_ExtendedString("/"));
if (PointPosition >0)
myName = temp.Split(PointPosition);
else {
if(isFileName) {
myName = temp;
isTrek = Standard_False;}
else
return;
}
#else
PointPosition = temp.SearchFromEnd(TCollection_ExtendedString("/"));
if (PointPosition >0)
myName = temp.Split(PointPosition);
else {
if(isFileName) {
myName = temp;
isTrek = Standard_False;}
else
return;
}
#endif //WNT
if(isTrek) {
temp.Trunc(PointPosition-1);
myTrek = temp;
} else
#ifdef WNT
myTrek = ".\\";
#else
myTrek = "./";
#endif
}
TCollection_ExtendedString TDocStd_PathParser::Extension() const
{
return myExtension;
}
TCollection_ExtendedString TDocStd_PathParser::Name() const
{
return myName;
}
TCollection_ExtendedString TDocStd_PathParser::Trek() const
{
return myTrek;
}
TCollection_ExtendedString TDocStd_PathParser::Path() const
{
return myPath;
}
Standard_Integer TDocStd_PathParser::Length() const
{
return myPath.Length();
}
|