MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / main

Function main

applications/test/fileName/Test-fileName.C:44–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42// Main program:
43
44int main()
45{
46 wordList wrdList(5);
47 wrdList[0] = "hello";
48 wrdList[1] = "hello1";
49 wrdList[2] = "hello2";
50 wrdList[3] = "hello3";
51 wrdList[4] = "hello4.hmm";
52
53 fileName pathName(wrdList);
54
55 Info<< "pathName = " << pathName << nl
56 << "pathName.name() = >" << pathName.name() << "<\n"
57 << "pathName.path() = " << pathName.path() << nl
58 << "pathName.ext() = >" << pathName.ext() << "<\n"
59 << "pathName.name(true) = >" << pathName.name(true) << "<\n";
60
61 Info<< "pathName.components() = " << pathName.components() << nl
62 << "pathName.component(2) = " << pathName.component(2) << nl
63 << endl;
64
65 // try with different combination
66 // The final one should emit warnings
67 for (label start = 0; start <= wrdList.size(); ++start)
68 {
69 fileName instance, local;
70 word name;
71
72 fileName path(SubList<word>(wrdList, wrdList.size()-start, start));
73 fileName path2 = "."/path;
74
75 IOobject::fileNameComponents
76 (
77 path,
78 instance,
79 local,
80 name
81 );
82
83 Info<< "IOobject::fileNameComponents for " << path << nl
84 << " instance = " << instance << nl
85 << " local = " << local << nl
86 << " name = " << name << endl;
87
88 IOobject::fileNameComponents
89 (
90 path2,
91 instance,
92 local,
93 name
94 );
95
96 Info<< "IOobject::fileNameComponents for " << path2 << nl
97 << " instance = " << instance << nl
98 << " local = " << local << nl
99 << " name = " << name << endl;
100
101 }

Callers

nothing calls this directly

Calls 5

fileNameComponentsFunction · 0.85
nameMethod · 0.45
pathMethod · 0.45
componentMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected