1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #include <precomp.h> 29*cdf0e10cSrcweir #include <cosv/ploc.hxx> 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES 32*cdf0e10cSrcweir #include <ctype.h> 33*cdf0e10cSrcweir #include <cosv/bstream.hxx> 34*cdf0e10cSrcweir #include <cosv/csv_ostream.hxx> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir namespace csv 38*cdf0e10cSrcweir { 39*cdf0e10cSrcweir namespace ploc 40*cdf0e10cSrcweir { 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir class UnixRootDir : public Root 44*cdf0e10cSrcweir { 45*cdf0e10cSrcweir public: 46*cdf0e10cSrcweir UnixRootDir(); 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir virtual void Get( 49*cdf0e10cSrcweir ostream & o_rPath ) const; 50*cdf0e10cSrcweir virtual void Get( 51*cdf0e10cSrcweir bostream & o_rPath ) const; 52*cdf0e10cSrcweir virtual DYN Root * CreateCopy() const; 53*cdf0e10cSrcweir virtual const char * 54*cdf0e10cSrcweir OwnDelimiter() const; 55*cdf0e10cSrcweir }; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class WorkingDir : public Root 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir public: 60*cdf0e10cSrcweir WorkingDir( 61*cdf0e10cSrcweir const char * i_sDelimiter = Delimiter() ); 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir virtual void Get( 64*cdf0e10cSrcweir ostream & o_rPath ) const; 65*cdf0e10cSrcweir virtual void Get( 66*cdf0e10cSrcweir bostream & o_rPath ) const; 67*cdf0e10cSrcweir virtual DYN Root * CreateCopy() const; 68*cdf0e10cSrcweir virtual const char * 69*cdf0e10cSrcweir OwnDelimiter() const; 70*cdf0e10cSrcweir private: 71*cdf0e10cSrcweir String sOwnDelimiter; 72*cdf0e10cSrcweir }; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir class WinRootDir : public Root 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir public: 77*cdf0e10cSrcweir WinRootDir(); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir virtual void Get( 80*cdf0e10cSrcweir ostream & o_rPath ) const; 81*cdf0e10cSrcweir virtual void Get( 82*cdf0e10cSrcweir bostream & o_rPath ) const; 83*cdf0e10cSrcweir virtual DYN Root * CreateCopy() const; 84*cdf0e10cSrcweir virtual const char * 85*cdf0e10cSrcweir OwnDelimiter() const; 86*cdf0e10cSrcweir }; 87*cdf0e10cSrcweir 88*cdf0e10cSrcweir class WinDrive : public Root 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir public: 91*cdf0e10cSrcweir WinDrive( 92*cdf0e10cSrcweir char i_cDrive ); 93*cdf0e10cSrcweir virtual void Get( 94*cdf0e10cSrcweir ostream & o_rPath ) const; 95*cdf0e10cSrcweir virtual void Get( 96*cdf0e10cSrcweir bostream & o_rPath ) const; 97*cdf0e10cSrcweir virtual DYN Root * CreateCopy() const; 98*cdf0e10cSrcweir virtual const char * 99*cdf0e10cSrcweir OwnDelimiter() const; 100*cdf0e10cSrcweir private: 101*cdf0e10cSrcweir char cDrive; 102*cdf0e10cSrcweir }; 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir class WinDriveRootDir : public Root 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir public: 107*cdf0e10cSrcweir WinDriveRootDir( 108*cdf0e10cSrcweir const char * i_sPath ); 109*cdf0e10cSrcweir WinDriveRootDir( 110*cdf0e10cSrcweir char i_cDrive ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir virtual void Get( 113*cdf0e10cSrcweir ostream & o_rPath ) const; 114*cdf0e10cSrcweir virtual void Get( 115*cdf0e10cSrcweir bostream & o_rPath ) const; 116*cdf0e10cSrcweir virtual DYN Root * CreateCopy() const; 117*cdf0e10cSrcweir virtual const char * 118*cdf0e10cSrcweir OwnDelimiter() const; 119*cdf0e10cSrcweir private: 120*cdf0e10cSrcweir char cDrive; 121*cdf0e10cSrcweir }; 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir class UNCRoot : public Root 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir public: 126*cdf0e10cSrcweir UNCRoot( 127*cdf0e10cSrcweir const char * i_sPath ); 128*cdf0e10cSrcweir UNCRoot( 129*cdf0e10cSrcweir const String & i_sComputer, 130*cdf0e10cSrcweir const String & i_sEntryPt ); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir virtual void Get( 133*cdf0e10cSrcweir ostream & o_rPath ) const; 134*cdf0e10cSrcweir virtual void Get( 135*cdf0e10cSrcweir bostream & o_rPath ) const; 136*cdf0e10cSrcweir virtual DYN Root * CreateCopy() const; 137*cdf0e10cSrcweir virtual const char * 138*cdf0e10cSrcweir OwnDelimiter() const; 139*cdf0e10cSrcweir private: 140*cdf0e10cSrcweir String sComputer; 141*cdf0e10cSrcweir String sEntryPt; 142*cdf0e10cSrcweir }; 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir class InvalidRoot : public Root 145*cdf0e10cSrcweir { 146*cdf0e10cSrcweir public: 147*cdf0e10cSrcweir virtual void Get( 148*cdf0e10cSrcweir ostream & o_rPath ) const; 149*cdf0e10cSrcweir virtual void Get( 150*cdf0e10cSrcweir bostream & o_rPath ) const; 151*cdf0e10cSrcweir virtual DYN Root * CreateCopy() const; 152*cdf0e10cSrcweir virtual const char * 153*cdf0e10cSrcweir OwnDelimiter() const; 154*cdf0e10cSrcweir }; 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir DYN Root * 158*cdf0e10cSrcweir Create_WindowsRoot( const char * & o_sPathAfterRoot, 159*cdf0e10cSrcweir const char * i_sPath ) 160*cdf0e10cSrcweir { 161*cdf0e10cSrcweir if (i_sPath[0] == '\\') 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir if (i_sPath[1] == '\\') 164*cdf0e10cSrcweir { // UNC path name 165*cdf0e10cSrcweir o_sPathAfterRoot = strchr(i_sPath+2,'\\'); 166*cdf0e10cSrcweir if (o_sPathAfterRoot != 0) 167*cdf0e10cSrcweir { 168*cdf0e10cSrcweir o_sPathAfterRoot = strchr(o_sPathAfterRoot+1,'\\'); 169*cdf0e10cSrcweir if (o_sPathAfterRoot != 0) 170*cdf0e10cSrcweir ++o_sPathAfterRoot; 171*cdf0e10cSrcweir return new UNCRoot(i_sPath); 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir return new InvalidRoot; // Incomplete UNC root. 174*cdf0e10cSrcweir } 175*cdf0e10cSrcweir else 176*cdf0e10cSrcweir { 177*cdf0e10cSrcweir o_sPathAfterRoot = i_sPath+1; 178*cdf0e10cSrcweir return new WinRootDir; 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir else if (i_sPath[1] == ':') 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir if ( i_sPath[2] == '\\') 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir o_sPathAfterRoot = i_sPath + 3; 186*cdf0e10cSrcweir return new WinDriveRootDir(i_sPath); 187*cdf0e10cSrcweir } 188*cdf0e10cSrcweir else 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir o_sPathAfterRoot = i_sPath + 2; 191*cdf0e10cSrcweir return new WinDrive(*i_sPath); 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir else 195*cdf0e10cSrcweir { 196*cdf0e10cSrcweir o_sPathAfterRoot = i_sPath; 197*cdf0e10cSrcweir return new WorkingDir("\\"); 198*cdf0e10cSrcweir } 199*cdf0e10cSrcweir } 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir DYN Root * 202*cdf0e10cSrcweir Create_UnixRoot( const char * & o_sPathAfterRoot, 203*cdf0e10cSrcweir const char * i_sPath ) 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir if (*i_sPath == '/') 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir o_sPathAfterRoot = i_sPath + 1; 208*cdf0e10cSrcweir return new UnixRootDir; 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir else // 211*cdf0e10cSrcweir { 212*cdf0e10cSrcweir o_sPathAfterRoot = i_sPath; 213*cdf0e10cSrcweir return new WorkingDir("/"); 214*cdf0e10cSrcweir } // endif 215*cdf0e10cSrcweir } 216*cdf0e10cSrcweir 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir //********************** Root ****************************// 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir Root::~Root() 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir } 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir DYN Root * 226*cdf0e10cSrcweir Root::Create_( const char * & o_sPathAfterRoot, 227*cdf0e10cSrcweir const char * i_sPath, 228*cdf0e10cSrcweir const char * i_sDelimiter ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir if (i_sPath[0] == '.') 231*cdf0e10cSrcweir { 232*cdf0e10cSrcweir switch ( i_sPath[1] ) 233*cdf0e10cSrcweir { 234*cdf0e10cSrcweir case '\0': o_sPathAfterRoot = i_sPath + 1; 235*cdf0e10cSrcweir break; 236*cdf0e10cSrcweir case '\\': o_sPathAfterRoot = i_sPath + 2; 237*cdf0e10cSrcweir break; 238*cdf0e10cSrcweir case '/': o_sPathAfterRoot = i_sPath + 2; 239*cdf0e10cSrcweir break; 240*cdf0e10cSrcweir case '.': o_sPathAfterRoot = i_sPath; 241*cdf0e10cSrcweir break; 242*cdf0e10cSrcweir default: 243*cdf0e10cSrcweir o_sPathAfterRoot = 0; 244*cdf0e10cSrcweir return new InvalidRoot; 245*cdf0e10cSrcweir } // end switch (i_sPath[1]) 246*cdf0e10cSrcweir 247*cdf0e10cSrcweir return new WorkingDir; 248*cdf0e10cSrcweir } // end if (i_sPath[0] == '.') 249*cdf0e10cSrcweir 250*cdf0e10cSrcweir switch (*i_sDelimiter) 251*cdf0e10cSrcweir { 252*cdf0e10cSrcweir case '\\': return Create_WindowsRoot(o_sPathAfterRoot, i_sPath); 253*cdf0e10cSrcweir case '/': return Create_UnixRoot(o_sPathAfterRoot, i_sPath); 254*cdf0e10cSrcweir } 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir o_sPathAfterRoot = 0; 257*cdf0e10cSrcweir return new InvalidRoot; 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir //********************** UnixRootDir ****************************// 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir 265*cdf0e10cSrcweir UnixRootDir::UnixRootDir() 266*cdf0e10cSrcweir { 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir 269*cdf0e10cSrcweir void 270*cdf0e10cSrcweir UnixRootDir::Get( ostream & o_rPath ) const 271*cdf0e10cSrcweir { 272*cdf0e10cSrcweir o_rPath << '/'; 273*cdf0e10cSrcweir } 274*cdf0e10cSrcweir 275*cdf0e10cSrcweir void 276*cdf0e10cSrcweir UnixRootDir::Get( bostream & o_rPath ) const 277*cdf0e10cSrcweir { 278*cdf0e10cSrcweir o_rPath.write( "/", 1 ); 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir DYN Root * 282*cdf0e10cSrcweir UnixRootDir::CreateCopy() const 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir return new UnixRootDir; 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir const char * 288*cdf0e10cSrcweir UnixRootDir::OwnDelimiter() const 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir return "/"; 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir //********************** WorkingDir ****************************// 295*cdf0e10cSrcweir 296*cdf0e10cSrcweir WorkingDir::WorkingDir( const char * i_sDelimiter ) 297*cdf0e10cSrcweir : sOwnDelimiter(i_sDelimiter) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir } 300*cdf0e10cSrcweir 301*cdf0e10cSrcweir void 302*cdf0e10cSrcweir WorkingDir::Get( ostream & o_rPath ) const 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir o_rPath << '.' << sOwnDelimiter; 305*cdf0e10cSrcweir } 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir void 308*cdf0e10cSrcweir WorkingDir::Get( bostream & o_rPath ) const 309*cdf0e10cSrcweir { 310*cdf0e10cSrcweir o_rPath.write( ".", 1 ); 311*cdf0e10cSrcweir o_rPath.write( sOwnDelimiter ); 312*cdf0e10cSrcweir } 313*cdf0e10cSrcweir 314*cdf0e10cSrcweir DYN Root * 315*cdf0e10cSrcweir WorkingDir::CreateCopy() const 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir return new WorkingDir(sOwnDelimiter); 318*cdf0e10cSrcweir } 319*cdf0e10cSrcweir 320*cdf0e10cSrcweir const char * 321*cdf0e10cSrcweir WorkingDir::OwnDelimiter() const 322*cdf0e10cSrcweir { 323*cdf0e10cSrcweir return sOwnDelimiter; 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir //********************** WinRootDir ****************************// 328*cdf0e10cSrcweir 329*cdf0e10cSrcweir WinRootDir::WinRootDir() 330*cdf0e10cSrcweir { 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir void 334*cdf0e10cSrcweir WinRootDir::Get( ostream & o_rPath ) const 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir o_rPath << '\\'; 337*cdf0e10cSrcweir } 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir void 340*cdf0e10cSrcweir WinRootDir::Get( bostream & o_rPath ) const 341*cdf0e10cSrcweir { 342*cdf0e10cSrcweir o_rPath.write( "\\", 1 ); 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir DYN Root * 346*cdf0e10cSrcweir WinRootDir::CreateCopy() const 347*cdf0e10cSrcweir { 348*cdf0e10cSrcweir return new WinRootDir; 349*cdf0e10cSrcweir } 350*cdf0e10cSrcweir 351*cdf0e10cSrcweir const char * 352*cdf0e10cSrcweir WinRootDir::OwnDelimiter() const 353*cdf0e10cSrcweir { 354*cdf0e10cSrcweir return "\\"; 355*cdf0e10cSrcweir } 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir //********************** WinDrive ****************************// 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir WinDrive::WinDrive( char i_cDrive ) 361*cdf0e10cSrcweir : cDrive(static_cast< char >(toupper(i_cDrive))) 362*cdf0e10cSrcweir { 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir 365*cdf0e10cSrcweir void 366*cdf0e10cSrcweir WinDrive::Get( ostream & o_rPath ) const 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir o_rPath << cDrive << ':'; 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir void 372*cdf0e10cSrcweir WinDrive::Get( bostream & o_rPath ) const 373*cdf0e10cSrcweir { 374*cdf0e10cSrcweir static char buf_[3] = " :"; 375*cdf0e10cSrcweir buf_[0] = cDrive; 376*cdf0e10cSrcweir o_rPath.write( &buf_[0], 2 ); 377*cdf0e10cSrcweir } 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir DYN Root * 380*cdf0e10cSrcweir WinDrive::CreateCopy() const 381*cdf0e10cSrcweir { 382*cdf0e10cSrcweir return new WinDrive(cDrive); 383*cdf0e10cSrcweir } 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir const char * 386*cdf0e10cSrcweir WinDrive::OwnDelimiter() const 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir return "\\"; 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir 392*cdf0e10cSrcweir //********************** WinDriveRootDir ****************************// 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir WinDriveRootDir::WinDriveRootDir( const char * i_sPath ) 395*cdf0e10cSrcweir : cDrive(static_cast< char >(toupper(*i_sPath))) 396*cdf0e10cSrcweir { 397*cdf0e10cSrcweir if ( 'A' > cDrive OR 'Z' < cDrive ) 398*cdf0e10cSrcweir cDrive = 0; 399*cdf0e10cSrcweir } 400*cdf0e10cSrcweir 401*cdf0e10cSrcweir WinDriveRootDir::WinDriveRootDir( char i_cDrive ) 402*cdf0e10cSrcweir : cDrive(i_cDrive) 403*cdf0e10cSrcweir { 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir void 407*cdf0e10cSrcweir WinDriveRootDir::Get( ostream & o_rPath ) const 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir o_rPath << cDrive << ":\\"; 410*cdf0e10cSrcweir } 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir void 413*cdf0e10cSrcweir WinDriveRootDir::Get( bostream & o_rPath ) const 414*cdf0e10cSrcweir { 415*cdf0e10cSrcweir static char buf_[4] = " :\\"; 416*cdf0e10cSrcweir buf_[0] = cDrive; 417*cdf0e10cSrcweir o_rPath.write( &buf_[0], 3 ); 418*cdf0e10cSrcweir } 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir DYN Root * 421*cdf0e10cSrcweir WinDriveRootDir::CreateCopy() const 422*cdf0e10cSrcweir { 423*cdf0e10cSrcweir return new WinDriveRootDir(cDrive); 424*cdf0e10cSrcweir } 425*cdf0e10cSrcweir 426*cdf0e10cSrcweir const char * 427*cdf0e10cSrcweir WinDriveRootDir::OwnDelimiter() const 428*cdf0e10cSrcweir { 429*cdf0e10cSrcweir return "\\"; 430*cdf0e10cSrcweir } 431*cdf0e10cSrcweir 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir //********************** UNCRoot ****************************// 434*cdf0e10cSrcweir 435*cdf0e10cSrcweir UNCRoot::UNCRoot( const char * i_sPath ) 436*cdf0e10cSrcweir // : // sComputer, 437*cdf0e10cSrcweir // sEntryPt 438*cdf0e10cSrcweir { 439*cdf0e10cSrcweir const char * pRestPath = i_sPath + 2; 440*cdf0e10cSrcweir const char * pDirEnd = strchr(pRestPath, '\\'); 441*cdf0e10cSrcweir csv_assert(pDirEnd != 0); 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir sComputer = String(pRestPath, pDirEnd - pRestPath); 444*cdf0e10cSrcweir pRestPath = pDirEnd+1; 445*cdf0e10cSrcweir pDirEnd = strchr(pRestPath, '\\'); 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir if ( pDirEnd != 0 ) 448*cdf0e10cSrcweir { 449*cdf0e10cSrcweir sEntryPt = String(pRestPath, pDirEnd - pRestPath); 450*cdf0e10cSrcweir } 451*cdf0e10cSrcweir else 452*cdf0e10cSrcweir { 453*cdf0e10cSrcweir sEntryPt = pRestPath; 454*cdf0e10cSrcweir } 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir UNCRoot::UNCRoot( const String & i_sComputer, 458*cdf0e10cSrcweir const String & i_sEntryPt ) 459*cdf0e10cSrcweir : sComputer(i_sComputer), 460*cdf0e10cSrcweir sEntryPt(i_sEntryPt) 461*cdf0e10cSrcweir { 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir 464*cdf0e10cSrcweir void 465*cdf0e10cSrcweir UNCRoot::Get( ostream & o_rPath ) const 466*cdf0e10cSrcweir { 467*cdf0e10cSrcweir o_rPath << "\\\\" << sComputer << '\\' << sEntryPt << "\\"; 468*cdf0e10cSrcweir } 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir void 471*cdf0e10cSrcweir UNCRoot::Get( bostream & o_rPath ) const 472*cdf0e10cSrcweir { 473*cdf0e10cSrcweir o_rPath.write( "\\\\", 2 ); 474*cdf0e10cSrcweir o_rPath.write( sComputer ); 475*cdf0e10cSrcweir o_rPath.write( "\\", 1 ); 476*cdf0e10cSrcweir o_rPath.write( sEntryPt ); 477*cdf0e10cSrcweir o_rPath.write( "\\", 1 ); 478*cdf0e10cSrcweir } 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir DYN Root * 481*cdf0e10cSrcweir UNCRoot::CreateCopy() const 482*cdf0e10cSrcweir { 483*cdf0e10cSrcweir return new UNCRoot(sComputer,sEntryPt); 484*cdf0e10cSrcweir } 485*cdf0e10cSrcweir 486*cdf0e10cSrcweir const char * 487*cdf0e10cSrcweir UNCRoot::OwnDelimiter() const 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir return "\\"; 490*cdf0e10cSrcweir } 491*cdf0e10cSrcweir 492*cdf0e10cSrcweir 493*cdf0e10cSrcweir 494*cdf0e10cSrcweir //********************** InvalidRoot ****************************// 495*cdf0e10cSrcweir 496*cdf0e10cSrcweir void 497*cdf0e10cSrcweir InvalidRoot::Get( ostream & ) const 498*cdf0e10cSrcweir { 499*cdf0e10cSrcweir } 500*cdf0e10cSrcweir 501*cdf0e10cSrcweir void 502*cdf0e10cSrcweir InvalidRoot::Get( bostream & ) const 503*cdf0e10cSrcweir { 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir 506*cdf0e10cSrcweir DYN Root * 507*cdf0e10cSrcweir InvalidRoot::CreateCopy() const 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir return new InvalidRoot; 510*cdf0e10cSrcweir } 511*cdf0e10cSrcweir 512*cdf0e10cSrcweir const char * 513*cdf0e10cSrcweir InvalidRoot::OwnDelimiter() const 514*cdf0e10cSrcweir { 515*cdf0e10cSrcweir return 0; 516*cdf0e10cSrcweir } 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir 519*cdf0e10cSrcweir 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir } // namespace ploc 522*cdf0e10cSrcweir } // namespace csv 523*cdf0e10cSrcweir 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir 526