cmn_Path Class Reference
[G_new_group]

#include <cmn_Path.h>

List of all members.


Detailed Description

Definition at line 39 of file cmn_Path.h.


Public Member Functions

 cmn_Path ()
 cmn_Path (const char *a_path)
 cmn_Path (const string &a_path)
 cmn_Path (const cmn_Path &a_path)
virtual ~cmn_Path ()
void operator= (const string &s)
void operator+= (const string &s)
void operator= (const char *s)
void operator+= (const char *s)
cmn_Path UpPath () const
string GetFileName () const
void OnlyFileName ()
bool IsEmpty () const
void HostPathSeparator ()
 change path separator regarding to host usage unix-win win-unix
bool IsAbsolute () const
cmn_Path GetAbsolutePathName (void) const
void RemoveTrailingPathSeparator ()

Static Private Attributes

static const string m_pathSeparatorStr = string(1, PATH_SEPARATOR)
static const char m_wrongPathSeparatorChar = WRONG_PATH_SEPARATOR

Friends

cmn_Path IVD_CMN_DECL_d operator+ (const cmn_Path &, const string &s)
cmn_Path IVD_CMN_DECL_d operator+ (const cmn_Path &, const char *s)

Constructor & Destructor Documentation

cmn_Path::cmn_Path (  )  [inline]

Definition at line 42 of file cmn_Path.h.

Referenced by cmn_FileNameToLong(), GetAbsolutePathName(), operator+(), and UpPath().

00042 : string() {};

Here is the caller graph for this function:

cmn_Path::cmn_Path ( const char *  a_path  ) 

Definition at line 54 of file cmn_Path.cpp.

00054                                       : string (a_path) {
00055 // fix bug 587    CheckPathSeparator();
00056 }

cmn_Path::cmn_Path ( const string &  a_path  ) 

Definition at line 58 of file cmn_Path.cpp.

00058                                        : string (a_path) {
00059 // fix bug 587    CheckPathSeparator();
00060 }

cmn_Path::cmn_Path ( const cmn_Path a_path  )  [inline]

Definition at line 45 of file cmn_Path.h.

00045 : string (a_path) {};

cmn_Path::~cmn_Path (  )  [virtual]

Definition at line 62 of file cmn_Path.cpp.

00062                     {
00063     // Empty
00064 }


Member Function Documentation

void cmn_Path::operator= ( const string &  s  ) 

Definition at line 75 of file cmn_Path.cpp.

00075                                           {
00076     string::operator=(s);
00077     return;
00078 }

void cmn_Path::operator+= ( const string &  s  ) 

Definition at line 80 of file cmn_Path.cpp.

References PATH_SEPARATOR.

00080                                          {
00081 
00082     if (  (length() == 0)
00083        || (at(length() - 1) != PATH_SEPARATOR)) {
00084         string::operator+=(PATH_SEPARATOR);
00085         string::operator+=(s);
00086     }
00087     else {
00088         string::operator+=(s);
00089     }
00090 
00091     return ;
00092 }

void cmn_Path::operator= ( const char *  s  ) 

Definition at line 122 of file cmn_Path.cpp.

00122                                        {
00123     string::assign(s);
00124     return;
00125 }

void cmn_Path::operator+= ( const char *  s  ) 

Definition at line 127 of file cmn_Path.cpp.

References PATH_SEPARATOR.

00127                                        {
00128 
00129     if (  (length() == 0)
00130        || (at(length() - 1) != PATH_SEPARATOR)) {
00131         string::append(1, PATH_SEPARATOR);
00132         string::append(s);
00133     }
00134     else {
00135         string::append(s);
00136     }
00137 
00138     return ;
00139 }

cmn_Path cmn_Path::UpPath (  )  const

Definition at line 159 of file cmn_Path.cpp.

References cmn_Path(), and PATH_SEPARATOR.

Referenced by cmn_CreatePathNoException(), cmn_IsMounted(), fsc_MedVolReader::fsc_MedVolReader(), fsc_MedVolWriter::fsc_MedVolWriter(), hsmGetDirFH(), hsmGetFH(), ivd_GetMountPoint(), i_HSM_i::MigrateByAPI(), log_Debugger::On(), Restore(), UnpackFile(), and blk_DiskBufferWriter::Write().

00159                                 {
00160     string::size_type pos = find_last_of(PATH_SEPARATOR, length());
00161     if (pos == string::npos) {
00162         return cmn_Path("");
00163     }
00164     else if (pos == 2 && at(1) == ':') {
00165         return cmn_Path("");  // we have something like "X:" now
00166     }
00167     else {
00168         return cmn_Path(substr(0, pos));
00169     }
00170 }

Here is the call graph for this function:

Here is the caller graph for this function:

string cmn_Path::GetFileName (  )  const

Definition at line 172 of file cmn_Path.cpp.

References PATH_SEPARATOR, and size.

Referenced by rm_DiskBuffer::Clear(), cmn_IsPatternMatch(), cmn_IsSpecialFile(), FileName2IPCFileList(), hsmGetDirFH(), hsmGetFH(), IsNameSpecial(), i_HSM_i::IVDFSPrepareRecovery(), i_HSM_i::MigrateByAPI(), and mif_CfgRep::Upload().

00172                                    {
00173 
00174     size_t pos = find_last_of(PATH_SEPARATOR, length());
00175     pos ++;
00176     return string(substr(pos, size() - pos));
00177 }

Here is the caller graph for this function:

void cmn_Path::OnlyFileName (  ) 

Definition at line 179 of file cmn_Path.cpp.

References PATH_SEPARATOR.

Referenced by mif_CfgRep::SetLastRevNum().

00179                             {
00180     size_t pos = find_last_of(PATH_SEPARATOR);
00181     if (pos != string::npos) {
00182         pos ++;
00183         *this = substr(pos);
00184     }
00185 }

Here is the caller graph for this function:

bool cmn_Path::IsEmpty (  )  const [inline]

Definition at line 62 of file cmn_Path.h.

00062                                 {
00063         return length() == 0;
00064     }

void cmn_Path::HostPathSeparator (  ) 

change path separator regarding to host usage unix-win win-unix

Definition at line 66 of file cmn_Path.cpp.

References m_pathSeparatorStr, and m_wrongPathSeparatorChar.

Referenced by fsc_FileExpiration::GetExpirationAge(), ClientConf_t::Init(), fsc_FileExpiration::SetExpirationAge(), and val_Path::Validate().

00066                                  {
00067 
00068     string::size_type pos = string::find(m_wrongPathSeparatorChar);
00069     while (pos != string::npos) {
00070         replace(pos, 1, m_pathSeparatorStr);
00071         pos = rfind(m_wrongPathSeparatorChar);
00072     }
00073 }

Here is the caller graph for this function:

bool cmn_Path::IsAbsolute (  )  const

Definition at line 195 of file cmn_Path.cpp.

References PATH_SEPARATOR.

Referenced by _tmain(), cmn_FileNameToLong(), GetAbsolutePathName(), main(), Restore(), and log_Debugger::SetFileName().

00195                                 {
00196 
00197     if ((length() != 0) && (at(0) == PATH_SEPARATOR)) {
00198         return true;
00199     }
00200     else {
00201         return false;
00202     }
00203 }

Here is the caller graph for this function:

cmn_Path cmn_Path::GetAbsolutePathName ( void   )  const

Definition at line 205 of file cmn_Path.cpp.

References cmn_GetCurrentDir(), cmn_LocaleToUTF8(), cmn_Path(), IsAbsolute(), and PATH_SEPARATOR.

Referenced by FileName2IPCFileList(), FileName2IPCStringList(), InputFile2IPCFileList(), ivd_AccessFsAttr(), api_Partition::LocalPath2HSM(), and mif_CfgRep::Upload().

00205                                                  {
00206     if (IsAbsolute()) {
00207         return (*this);
00208     }
00209     else {
00210         if (   length() > 1
00211             && at(0) == '.'
00212             && at(1) == PATH_SEPARATOR) {
00213             return cmn_Path(cmn_LocaleToUTF8(cmn_GetCurrentDir())) + substr(2);
00214         }
00215         else {
00216             return cmn_Path(cmn_LocaleToUTF8(cmn_GetCurrentDir())) + (*this);
00217         }
00218     }
00219 }

Here is the call graph for this function:

Here is the caller graph for this function:

void cmn_Path::RemoveTrailingPathSeparator (  ) 

Definition at line 187 of file cmn_Path.cpp.

References PATH_SEPARATOR.

Referenced by i_HSM_i::ActivateFiles(), cmn_IsMounted(), i_HSM_i::ForceMigration(), fsc_FileExpiration::GetExpirationAge(), GetPathList(), i_HSM_i::MigrateByAPI(), i_ManagementInterface_i::Mount(), fsc_FileExpiration::SetExpirationAge(), api_Partition::SetReferences(), i_ManagementInterface_i::Umount(), and val_Path::Validate().

00187                                            {
00188     if (  (length() > 0)
00189        && (at(length() - 1) == PATH_SEPARATOR)) {
00190         string::resize(length() - 1);
00191     }
00192 }

Here is the caller graph for this function:


Friends And Related Function Documentation

cmn_Path IVD_CMN_DECL_d operator+ ( const cmn_Path path,
const string &  s 
) [friend]

Definition at line 95 of file cmn_Path.cpp.

00095                                                           {
00096 
00097     if (path.length() == 0) {
00098         return s;
00099     }
00100     if (s.length() == 0) {
00101         return path;
00102     }
00103 
00104     string str(path);
00105     if (path.at(path.length() - 1) != PATH_SEPARATOR) {
00106         if (s.at(0) == PATH_SEPARATOR) {
00107             return str += s;
00108         }
00109         else {
00110             return (str += cmn_Path::m_pathSeparatorStr) += s;
00111         }
00112     }
00113     else {
00114         if (s.at(0) == PATH_SEPARATOR) {
00115             str.resize(str.length() - 1);
00116         }
00117         return str += s;
00118     }
00119 }

cmn_Path IVD_CMN_DECL_d operator+ ( const cmn_Path path,
const char *  s 
) [friend]

Definition at line 142 of file cmn_Path.cpp.

00142                                                         {
00143 
00144     if (path.length() == 0) {
00145         return cmn_Path(s);
00146     };
00147 
00148     string str(path);
00149     if (path.at(path.length() - 1) != PATH_SEPARATOR) {
00150         return (str += cmn_Path::m_pathSeparatorStr) += s;
00151     }
00152     else {
00153         return str += s;
00154     }
00155 }


Member Data Documentation

const string cmn_Path::m_pathSeparatorStr = string(1, PATH_SEPARATOR) [static, private]

Definition at line 82 of file cmn_Path.h.

Referenced by HostPathSeparator(), and operator+().

const char cmn_Path::m_wrongPathSeparatorChar = WRONG_PATH_SEPARATOR [static, private]

Definition at line 83 of file cmn_Path.h.

Referenced by HostPathSeparator().


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 19:05:25 2012 for OPENARCHIVE by  doxygen 1.5.6