1*59617ebcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*59617ebcSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*59617ebcSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*59617ebcSAndrew Rist * distributed with this work for additional information
6*59617ebcSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*59617ebcSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*59617ebcSAndrew Rist * "License"); you may not use this file except in compliance
9*59617ebcSAndrew Rist * with the License. You may obtain a copy of the License at
10*59617ebcSAndrew Rist *
11*59617ebcSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*59617ebcSAndrew Rist *
13*59617ebcSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*59617ebcSAndrew Rist * software distributed under the License is distributed on an
15*59617ebcSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*59617ebcSAndrew Rist * KIND, either express or implied. See the License for the
17*59617ebcSAndrew Rist * specific language governing permissions and limitations
18*59617ebcSAndrew Rist * under the License.
19*59617ebcSAndrew Rist *
20*59617ebcSAndrew Rist *************************************************************/
21*59617ebcSAndrew Rist
22*59617ebcSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #include <precomp.h>
25cdf0e10cSrcweir #include <cosv/ploc.hxx>
26cdf0e10cSrcweir
27cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
28cdf0e10cSrcweir #include <ctype.h>
29cdf0e10cSrcweir #include <cosv/bstream.hxx>
30cdf0e10cSrcweir #include <cosv/csv_ostream.hxx>
31cdf0e10cSrcweir
32cdf0e10cSrcweir
33cdf0e10cSrcweir namespace csv
34cdf0e10cSrcweir {
35cdf0e10cSrcweir namespace ploc
36cdf0e10cSrcweir {
37cdf0e10cSrcweir
38cdf0e10cSrcweir
39cdf0e10cSrcweir class UnixRootDir : public Root
40cdf0e10cSrcweir {
41cdf0e10cSrcweir public:
42cdf0e10cSrcweir UnixRootDir();
43cdf0e10cSrcweir
44cdf0e10cSrcweir virtual void Get(
45cdf0e10cSrcweir ostream & o_rPath ) const;
46cdf0e10cSrcweir virtual void Get(
47cdf0e10cSrcweir bostream & o_rPath ) const;
48cdf0e10cSrcweir virtual DYN Root * CreateCopy() const;
49cdf0e10cSrcweir virtual const char *
50cdf0e10cSrcweir OwnDelimiter() const;
51cdf0e10cSrcweir };
52cdf0e10cSrcweir
53cdf0e10cSrcweir class WorkingDir : public Root
54cdf0e10cSrcweir {
55cdf0e10cSrcweir public:
56cdf0e10cSrcweir WorkingDir(
57cdf0e10cSrcweir const char * i_sDelimiter = Delimiter() );
58cdf0e10cSrcweir
59cdf0e10cSrcweir virtual void Get(
60cdf0e10cSrcweir ostream & o_rPath ) const;
61cdf0e10cSrcweir virtual void Get(
62cdf0e10cSrcweir bostream & o_rPath ) const;
63cdf0e10cSrcweir virtual DYN Root * CreateCopy() const;
64cdf0e10cSrcweir virtual const char *
65cdf0e10cSrcweir OwnDelimiter() const;
66cdf0e10cSrcweir private:
67cdf0e10cSrcweir String sOwnDelimiter;
68cdf0e10cSrcweir };
69cdf0e10cSrcweir
70cdf0e10cSrcweir class WinRootDir : public Root
71cdf0e10cSrcweir {
72cdf0e10cSrcweir public:
73cdf0e10cSrcweir WinRootDir();
74cdf0e10cSrcweir
75cdf0e10cSrcweir virtual void Get(
76cdf0e10cSrcweir ostream & o_rPath ) const;
77cdf0e10cSrcweir virtual void Get(
78cdf0e10cSrcweir bostream & o_rPath ) const;
79cdf0e10cSrcweir virtual DYN Root * CreateCopy() const;
80cdf0e10cSrcweir virtual const char *
81cdf0e10cSrcweir OwnDelimiter() const;
82cdf0e10cSrcweir };
83cdf0e10cSrcweir
84cdf0e10cSrcweir class WinDrive : public Root
85cdf0e10cSrcweir {
86cdf0e10cSrcweir public:
87cdf0e10cSrcweir WinDrive(
88cdf0e10cSrcweir char i_cDrive );
89cdf0e10cSrcweir virtual void Get(
90cdf0e10cSrcweir ostream & o_rPath ) const;
91cdf0e10cSrcweir virtual void Get(
92cdf0e10cSrcweir bostream & o_rPath ) const;
93cdf0e10cSrcweir virtual DYN Root * CreateCopy() const;
94cdf0e10cSrcweir virtual const char *
95cdf0e10cSrcweir OwnDelimiter() const;
96cdf0e10cSrcweir private:
97cdf0e10cSrcweir char cDrive;
98cdf0e10cSrcweir };
99cdf0e10cSrcweir
100cdf0e10cSrcweir class WinDriveRootDir : public Root
101cdf0e10cSrcweir {
102cdf0e10cSrcweir public:
103cdf0e10cSrcweir WinDriveRootDir(
104cdf0e10cSrcweir const char * i_sPath );
105cdf0e10cSrcweir WinDriveRootDir(
106cdf0e10cSrcweir char i_cDrive );
107cdf0e10cSrcweir
108cdf0e10cSrcweir virtual void Get(
109cdf0e10cSrcweir ostream & o_rPath ) const;
110cdf0e10cSrcweir virtual void Get(
111cdf0e10cSrcweir bostream & o_rPath ) const;
112cdf0e10cSrcweir virtual DYN Root * CreateCopy() const;
113cdf0e10cSrcweir virtual const char *
114cdf0e10cSrcweir OwnDelimiter() const;
115cdf0e10cSrcweir private:
116cdf0e10cSrcweir char cDrive;
117cdf0e10cSrcweir };
118cdf0e10cSrcweir
119cdf0e10cSrcweir class UNCRoot : public Root
120cdf0e10cSrcweir {
121cdf0e10cSrcweir public:
122cdf0e10cSrcweir UNCRoot(
123cdf0e10cSrcweir const char * i_sPath );
124cdf0e10cSrcweir UNCRoot(
125cdf0e10cSrcweir const String & i_sComputer,
126cdf0e10cSrcweir const String & i_sEntryPt );
127cdf0e10cSrcweir
128cdf0e10cSrcweir virtual void Get(
129cdf0e10cSrcweir ostream & o_rPath ) const;
130cdf0e10cSrcweir virtual void Get(
131cdf0e10cSrcweir bostream & o_rPath ) const;
132cdf0e10cSrcweir virtual DYN Root * CreateCopy() const;
133cdf0e10cSrcweir virtual const char *
134cdf0e10cSrcweir OwnDelimiter() const;
135cdf0e10cSrcweir private:
136cdf0e10cSrcweir String sComputer;
137cdf0e10cSrcweir String sEntryPt;
138cdf0e10cSrcweir };
139cdf0e10cSrcweir
140cdf0e10cSrcweir class InvalidRoot : public Root
141cdf0e10cSrcweir {
142cdf0e10cSrcweir public:
143cdf0e10cSrcweir virtual void Get(
144cdf0e10cSrcweir ostream & o_rPath ) const;
145cdf0e10cSrcweir virtual void Get(
146cdf0e10cSrcweir bostream & o_rPath ) const;
147cdf0e10cSrcweir virtual DYN Root * CreateCopy() const;
148cdf0e10cSrcweir virtual const char *
149cdf0e10cSrcweir OwnDelimiter() const;
150cdf0e10cSrcweir };
151cdf0e10cSrcweir
152cdf0e10cSrcweir
153cdf0e10cSrcweir DYN Root *
Create_WindowsRoot(const char * & o_sPathAfterRoot,const char * i_sPath)154cdf0e10cSrcweir Create_WindowsRoot( const char * & o_sPathAfterRoot,
155cdf0e10cSrcweir const char * i_sPath )
156cdf0e10cSrcweir {
157cdf0e10cSrcweir if (i_sPath[0] == '\\')
158cdf0e10cSrcweir {
159cdf0e10cSrcweir if (i_sPath[1] == '\\')
160cdf0e10cSrcweir { // UNC path name
161cdf0e10cSrcweir o_sPathAfterRoot = strchr(i_sPath+2,'\\');
162cdf0e10cSrcweir if (o_sPathAfterRoot != 0)
163cdf0e10cSrcweir {
164cdf0e10cSrcweir o_sPathAfterRoot = strchr(o_sPathAfterRoot+1,'\\');
165cdf0e10cSrcweir if (o_sPathAfterRoot != 0)
166cdf0e10cSrcweir ++o_sPathAfterRoot;
167cdf0e10cSrcweir return new UNCRoot(i_sPath);
168cdf0e10cSrcweir }
169cdf0e10cSrcweir return new InvalidRoot; // Incomplete UNC root.
170cdf0e10cSrcweir }
171cdf0e10cSrcweir else
172cdf0e10cSrcweir {
173cdf0e10cSrcweir o_sPathAfterRoot = i_sPath+1;
174cdf0e10cSrcweir return new WinRootDir;
175cdf0e10cSrcweir }
176cdf0e10cSrcweir }
177cdf0e10cSrcweir else if (i_sPath[1] == ':')
178cdf0e10cSrcweir {
179cdf0e10cSrcweir if ( i_sPath[2] == '\\')
180cdf0e10cSrcweir {
181cdf0e10cSrcweir o_sPathAfterRoot = i_sPath + 3;
182cdf0e10cSrcweir return new WinDriveRootDir(i_sPath);
183cdf0e10cSrcweir }
184cdf0e10cSrcweir else
185cdf0e10cSrcweir {
186cdf0e10cSrcweir o_sPathAfterRoot = i_sPath + 2;
187cdf0e10cSrcweir return new WinDrive(*i_sPath);
188cdf0e10cSrcweir }
189cdf0e10cSrcweir }
190cdf0e10cSrcweir else
191cdf0e10cSrcweir {
192cdf0e10cSrcweir o_sPathAfterRoot = i_sPath;
193cdf0e10cSrcweir return new WorkingDir("\\");
194cdf0e10cSrcweir }
195cdf0e10cSrcweir }
196cdf0e10cSrcweir
197cdf0e10cSrcweir DYN Root *
Create_UnixRoot(const char * & o_sPathAfterRoot,const char * i_sPath)198cdf0e10cSrcweir Create_UnixRoot( const char * & o_sPathAfterRoot,
199cdf0e10cSrcweir const char * i_sPath )
200cdf0e10cSrcweir {
201cdf0e10cSrcweir if (*i_sPath == '/')
202cdf0e10cSrcweir {
203cdf0e10cSrcweir o_sPathAfterRoot = i_sPath + 1;
204cdf0e10cSrcweir return new UnixRootDir;
205cdf0e10cSrcweir }
206cdf0e10cSrcweir else //
207cdf0e10cSrcweir {
208cdf0e10cSrcweir o_sPathAfterRoot = i_sPath;
209cdf0e10cSrcweir return new WorkingDir("/");
210cdf0e10cSrcweir } // endif
211cdf0e10cSrcweir }
212cdf0e10cSrcweir
213cdf0e10cSrcweir
214cdf0e10cSrcweir //********************** Root ****************************//
215cdf0e10cSrcweir
~Root()216cdf0e10cSrcweir Root::~Root()
217cdf0e10cSrcweir {
218cdf0e10cSrcweir
219cdf0e10cSrcweir }
220cdf0e10cSrcweir
221cdf0e10cSrcweir DYN Root *
Create_(const char * & o_sPathAfterRoot,const char * i_sPath,const char * i_sDelimiter)222cdf0e10cSrcweir Root::Create_( const char * & o_sPathAfterRoot,
223cdf0e10cSrcweir const char * i_sPath,
224cdf0e10cSrcweir const char * i_sDelimiter )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir if (i_sPath[0] == '.')
227cdf0e10cSrcweir {
228cdf0e10cSrcweir switch ( i_sPath[1] )
229cdf0e10cSrcweir {
230cdf0e10cSrcweir case '\0': o_sPathAfterRoot = i_sPath + 1;
231cdf0e10cSrcweir break;
232cdf0e10cSrcweir case '\\': o_sPathAfterRoot = i_sPath + 2;
233cdf0e10cSrcweir break;
234cdf0e10cSrcweir case '/': o_sPathAfterRoot = i_sPath + 2;
235cdf0e10cSrcweir break;
236cdf0e10cSrcweir case '.': o_sPathAfterRoot = i_sPath;
237cdf0e10cSrcweir break;
238cdf0e10cSrcweir default:
239cdf0e10cSrcweir o_sPathAfterRoot = 0;
240cdf0e10cSrcweir return new InvalidRoot;
241cdf0e10cSrcweir } // end switch (i_sPath[1])
242cdf0e10cSrcweir
243cdf0e10cSrcweir return new WorkingDir;
244cdf0e10cSrcweir } // end if (i_sPath[0] == '.')
245cdf0e10cSrcweir
246cdf0e10cSrcweir switch (*i_sDelimiter)
247cdf0e10cSrcweir {
248cdf0e10cSrcweir case '\\': return Create_WindowsRoot(o_sPathAfterRoot, i_sPath);
249cdf0e10cSrcweir case '/': return Create_UnixRoot(o_sPathAfterRoot, i_sPath);
250cdf0e10cSrcweir }
251cdf0e10cSrcweir
252cdf0e10cSrcweir o_sPathAfterRoot = 0;
253cdf0e10cSrcweir return new InvalidRoot;
254cdf0e10cSrcweir }
255cdf0e10cSrcweir
256cdf0e10cSrcweir
257cdf0e10cSrcweir
258cdf0e10cSrcweir //********************** UnixRootDir ****************************//
259cdf0e10cSrcweir
260cdf0e10cSrcweir
UnixRootDir()261cdf0e10cSrcweir UnixRootDir::UnixRootDir()
262cdf0e10cSrcweir {
263cdf0e10cSrcweir }
264cdf0e10cSrcweir
265cdf0e10cSrcweir void
Get(ostream & o_rPath) const266cdf0e10cSrcweir UnixRootDir::Get( ostream & o_rPath ) const
267cdf0e10cSrcweir {
268cdf0e10cSrcweir o_rPath << '/';
269cdf0e10cSrcweir }
270cdf0e10cSrcweir
271cdf0e10cSrcweir void
Get(bostream & o_rPath) const272cdf0e10cSrcweir UnixRootDir::Get( bostream & o_rPath ) const
273cdf0e10cSrcweir {
274cdf0e10cSrcweir o_rPath.write( "/", 1 );
275cdf0e10cSrcweir }
276cdf0e10cSrcweir
277cdf0e10cSrcweir DYN Root *
CreateCopy() const278cdf0e10cSrcweir UnixRootDir::CreateCopy() const
279cdf0e10cSrcweir {
280cdf0e10cSrcweir return new UnixRootDir;
281cdf0e10cSrcweir }
282cdf0e10cSrcweir
283cdf0e10cSrcweir const char *
OwnDelimiter() const284cdf0e10cSrcweir UnixRootDir::OwnDelimiter() const
285cdf0e10cSrcweir {
286cdf0e10cSrcweir return "/";
287cdf0e10cSrcweir }
288cdf0e10cSrcweir
289cdf0e10cSrcweir
290cdf0e10cSrcweir //********************** WorkingDir ****************************//
291cdf0e10cSrcweir
WorkingDir(const char * i_sDelimiter)292cdf0e10cSrcweir WorkingDir::WorkingDir( const char * i_sDelimiter )
293cdf0e10cSrcweir : sOwnDelimiter(i_sDelimiter)
294cdf0e10cSrcweir {
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
297cdf0e10cSrcweir void
Get(ostream & o_rPath) const298cdf0e10cSrcweir WorkingDir::Get( ostream & o_rPath ) const
299cdf0e10cSrcweir {
300cdf0e10cSrcweir o_rPath << '.' << sOwnDelimiter;
301cdf0e10cSrcweir }
302cdf0e10cSrcweir
303cdf0e10cSrcweir void
Get(bostream & o_rPath) const304cdf0e10cSrcweir WorkingDir::Get( bostream & o_rPath ) const
305cdf0e10cSrcweir {
306cdf0e10cSrcweir o_rPath.write( ".", 1 );
307cdf0e10cSrcweir o_rPath.write( sOwnDelimiter );
308cdf0e10cSrcweir }
309cdf0e10cSrcweir
310cdf0e10cSrcweir DYN Root *
CreateCopy() const311cdf0e10cSrcweir WorkingDir::CreateCopy() const
312cdf0e10cSrcweir {
313cdf0e10cSrcweir return new WorkingDir(sOwnDelimiter);
314cdf0e10cSrcweir }
315cdf0e10cSrcweir
316cdf0e10cSrcweir const char *
OwnDelimiter() const317cdf0e10cSrcweir WorkingDir::OwnDelimiter() const
318cdf0e10cSrcweir {
319cdf0e10cSrcweir return sOwnDelimiter;
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir
323cdf0e10cSrcweir //********************** WinRootDir ****************************//
324cdf0e10cSrcweir
WinRootDir()325cdf0e10cSrcweir WinRootDir::WinRootDir()
326cdf0e10cSrcweir {
327cdf0e10cSrcweir }
328cdf0e10cSrcweir
329cdf0e10cSrcweir void
Get(ostream & o_rPath) const330cdf0e10cSrcweir WinRootDir::Get( ostream & o_rPath ) const
331cdf0e10cSrcweir {
332cdf0e10cSrcweir o_rPath << '\\';
333cdf0e10cSrcweir }
334cdf0e10cSrcweir
335cdf0e10cSrcweir void
Get(bostream & o_rPath) const336cdf0e10cSrcweir WinRootDir::Get( bostream & o_rPath ) const
337cdf0e10cSrcweir {
338cdf0e10cSrcweir o_rPath.write( "\\", 1 );
339cdf0e10cSrcweir }
340cdf0e10cSrcweir
341cdf0e10cSrcweir DYN Root *
CreateCopy() const342cdf0e10cSrcweir WinRootDir::CreateCopy() const
343cdf0e10cSrcweir {
344cdf0e10cSrcweir return new WinRootDir;
345cdf0e10cSrcweir }
346cdf0e10cSrcweir
347cdf0e10cSrcweir const char *
OwnDelimiter() const348cdf0e10cSrcweir WinRootDir::OwnDelimiter() const
349cdf0e10cSrcweir {
350cdf0e10cSrcweir return "\\";
351cdf0e10cSrcweir }
352cdf0e10cSrcweir
353cdf0e10cSrcweir
354cdf0e10cSrcweir //********************** WinDrive ****************************//
355cdf0e10cSrcweir
WinDrive(char i_cDrive)356cdf0e10cSrcweir WinDrive::WinDrive( char i_cDrive )
357cdf0e10cSrcweir : cDrive(static_cast< char >(toupper(i_cDrive)))
358cdf0e10cSrcweir {
359cdf0e10cSrcweir }
360cdf0e10cSrcweir
361cdf0e10cSrcweir void
Get(ostream & o_rPath) const362cdf0e10cSrcweir WinDrive::Get( ostream & o_rPath ) const
363cdf0e10cSrcweir {
364cdf0e10cSrcweir o_rPath << cDrive << ':';
365cdf0e10cSrcweir }
366cdf0e10cSrcweir
367cdf0e10cSrcweir void
Get(bostream & o_rPath) const368cdf0e10cSrcweir WinDrive::Get( bostream & o_rPath ) const
369cdf0e10cSrcweir {
370cdf0e10cSrcweir static char buf_[3] = " :";
371cdf0e10cSrcweir buf_[0] = cDrive;
372cdf0e10cSrcweir o_rPath.write( &buf_[0], 2 );
373cdf0e10cSrcweir }
374cdf0e10cSrcweir
375cdf0e10cSrcweir DYN Root *
CreateCopy() const376cdf0e10cSrcweir WinDrive::CreateCopy() const
377cdf0e10cSrcweir {
378cdf0e10cSrcweir return new WinDrive(cDrive);
379cdf0e10cSrcweir }
380cdf0e10cSrcweir
381cdf0e10cSrcweir const char *
OwnDelimiter() const382cdf0e10cSrcweir WinDrive::OwnDelimiter() const
383cdf0e10cSrcweir {
384cdf0e10cSrcweir return "\\";
385cdf0e10cSrcweir }
386cdf0e10cSrcweir
387cdf0e10cSrcweir
388cdf0e10cSrcweir //********************** WinDriveRootDir ****************************//
389cdf0e10cSrcweir
WinDriveRootDir(const char * i_sPath)390cdf0e10cSrcweir WinDriveRootDir::WinDriveRootDir( const char * i_sPath )
391cdf0e10cSrcweir : cDrive(static_cast< char >(toupper(*i_sPath)))
392cdf0e10cSrcweir {
393cdf0e10cSrcweir if ( 'A' > cDrive OR 'Z' < cDrive )
394cdf0e10cSrcweir cDrive = 0;
395cdf0e10cSrcweir }
396cdf0e10cSrcweir
WinDriveRootDir(char i_cDrive)397cdf0e10cSrcweir WinDriveRootDir::WinDriveRootDir( char i_cDrive )
398cdf0e10cSrcweir : cDrive(i_cDrive)
399cdf0e10cSrcweir {
400cdf0e10cSrcweir }
401cdf0e10cSrcweir
402cdf0e10cSrcweir void
Get(ostream & o_rPath) const403cdf0e10cSrcweir WinDriveRootDir::Get( ostream & o_rPath ) const
404cdf0e10cSrcweir {
405cdf0e10cSrcweir o_rPath << cDrive << ":\\";
406cdf0e10cSrcweir }
407cdf0e10cSrcweir
408cdf0e10cSrcweir void
Get(bostream & o_rPath) const409cdf0e10cSrcweir WinDriveRootDir::Get( bostream & o_rPath ) const
410cdf0e10cSrcweir {
411cdf0e10cSrcweir static char buf_[4] = " :\\";
412cdf0e10cSrcweir buf_[0] = cDrive;
413cdf0e10cSrcweir o_rPath.write( &buf_[0], 3 );
414cdf0e10cSrcweir }
415cdf0e10cSrcweir
416cdf0e10cSrcweir DYN Root *
CreateCopy() const417cdf0e10cSrcweir WinDriveRootDir::CreateCopy() const
418cdf0e10cSrcweir {
419cdf0e10cSrcweir return new WinDriveRootDir(cDrive);
420cdf0e10cSrcweir }
421cdf0e10cSrcweir
422cdf0e10cSrcweir const char *
OwnDelimiter() const423cdf0e10cSrcweir WinDriveRootDir::OwnDelimiter() const
424cdf0e10cSrcweir {
425cdf0e10cSrcweir return "\\";
426cdf0e10cSrcweir }
427cdf0e10cSrcweir
428cdf0e10cSrcweir
429cdf0e10cSrcweir //********************** UNCRoot ****************************//
430cdf0e10cSrcweir
UNCRoot(const char * i_sPath)431cdf0e10cSrcweir UNCRoot::UNCRoot( const char * i_sPath )
432cdf0e10cSrcweir // : // sComputer,
433cdf0e10cSrcweir // sEntryPt
434cdf0e10cSrcweir {
435cdf0e10cSrcweir const char * pRestPath = i_sPath + 2;
436cdf0e10cSrcweir const char * pDirEnd = strchr(pRestPath, '\\');
437cdf0e10cSrcweir csv_assert(pDirEnd != 0);
438cdf0e10cSrcweir
439cdf0e10cSrcweir sComputer = String(pRestPath, pDirEnd - pRestPath);
440cdf0e10cSrcweir pRestPath = pDirEnd+1;
441cdf0e10cSrcweir pDirEnd = strchr(pRestPath, '\\');
442cdf0e10cSrcweir
443cdf0e10cSrcweir if ( pDirEnd != 0 )
444cdf0e10cSrcweir {
445cdf0e10cSrcweir sEntryPt = String(pRestPath, pDirEnd - pRestPath);
446cdf0e10cSrcweir }
447cdf0e10cSrcweir else
448cdf0e10cSrcweir {
449cdf0e10cSrcweir sEntryPt = pRestPath;
450cdf0e10cSrcweir }
451cdf0e10cSrcweir }
452cdf0e10cSrcweir
UNCRoot(const String & i_sComputer,const String & i_sEntryPt)453cdf0e10cSrcweir UNCRoot::UNCRoot( const String & i_sComputer,
454cdf0e10cSrcweir const String & i_sEntryPt )
455cdf0e10cSrcweir : sComputer(i_sComputer),
456cdf0e10cSrcweir sEntryPt(i_sEntryPt)
457cdf0e10cSrcweir {
458cdf0e10cSrcweir }
459cdf0e10cSrcweir
460cdf0e10cSrcweir void
Get(ostream & o_rPath) const461cdf0e10cSrcweir UNCRoot::Get( ostream & o_rPath ) const
462cdf0e10cSrcweir {
463cdf0e10cSrcweir o_rPath << "\\\\" << sComputer << '\\' << sEntryPt << "\\";
464cdf0e10cSrcweir }
465cdf0e10cSrcweir
466cdf0e10cSrcweir void
Get(bostream & o_rPath) const467cdf0e10cSrcweir UNCRoot::Get( bostream & o_rPath ) const
468cdf0e10cSrcweir {
469cdf0e10cSrcweir o_rPath.write( "\\\\", 2 );
470cdf0e10cSrcweir o_rPath.write( sComputer );
471cdf0e10cSrcweir o_rPath.write( "\\", 1 );
472cdf0e10cSrcweir o_rPath.write( sEntryPt );
473cdf0e10cSrcweir o_rPath.write( "\\", 1 );
474cdf0e10cSrcweir }
475cdf0e10cSrcweir
476cdf0e10cSrcweir DYN Root *
CreateCopy() const477cdf0e10cSrcweir UNCRoot::CreateCopy() const
478cdf0e10cSrcweir {
479cdf0e10cSrcweir return new UNCRoot(sComputer,sEntryPt);
480cdf0e10cSrcweir }
481cdf0e10cSrcweir
482cdf0e10cSrcweir const char *
OwnDelimiter() const483cdf0e10cSrcweir UNCRoot::OwnDelimiter() const
484cdf0e10cSrcweir {
485cdf0e10cSrcweir return "\\";
486cdf0e10cSrcweir }
487cdf0e10cSrcweir
488cdf0e10cSrcweir
489cdf0e10cSrcweir
490cdf0e10cSrcweir //********************** InvalidRoot ****************************//
491cdf0e10cSrcweir
492cdf0e10cSrcweir void
Get(ostream &) const493cdf0e10cSrcweir InvalidRoot::Get( ostream & ) const
494cdf0e10cSrcweir {
495cdf0e10cSrcweir }
496cdf0e10cSrcweir
497cdf0e10cSrcweir void
Get(bostream &) const498cdf0e10cSrcweir InvalidRoot::Get( bostream & ) const
499cdf0e10cSrcweir {
500cdf0e10cSrcweir }
501cdf0e10cSrcweir
502cdf0e10cSrcweir DYN Root *
CreateCopy() const503cdf0e10cSrcweir InvalidRoot::CreateCopy() const
504cdf0e10cSrcweir {
505cdf0e10cSrcweir return new InvalidRoot;
506cdf0e10cSrcweir }
507cdf0e10cSrcweir
508cdf0e10cSrcweir const char *
OwnDelimiter() const509cdf0e10cSrcweir InvalidRoot::OwnDelimiter() const
510cdf0e10cSrcweir {
511cdf0e10cSrcweir return 0;
512cdf0e10cSrcweir }
513cdf0e10cSrcweir
514cdf0e10cSrcweir
515cdf0e10cSrcweir
516cdf0e10cSrcweir
517cdf0e10cSrcweir } // namespace ploc
518cdf0e10cSrcweir } // namespace csv
519cdf0e10cSrcweir
520cdf0e10cSrcweir
521cdf0e10cSrcweir
522