GME  13
Path.cpp
Go to the documentation of this file.
00001 
00023 #include "../StdAfx.h"
00024 
00025 #if(USESVN)
00026 
00027 #include "Path.h"
00028 #include "svn_path.h"
00029 #include "Util.h"
00030 #include "Pool.h"
00031 
00038 Path::Path (const char * pi_path, apr_pool_t* pool)
00039 {
00040         init(pi_path, pool);
00041 }
00042 
00050 Path::Path (const std::string & pi_path, apr_pool_t* pool)
00051 {
00052         init(pi_path.c_str(), pool);
00053 }
00054 
00060 Path::Path (const Path & pi_path)
00061 {
00062         init(pi_path.c_str(), pi_path.m_pool);
00063 }
00064 
00070 void
00071 Path::init(const char * pi_path, apr_pool_t* pool)
00072 {
00073         m_pool = pool;
00074         if(*pi_path == 0)
00075         {
00076                 m_error_occured = NULL;
00077                 m_path = "";
00078         }
00079         else
00080         {
00081                 // FIXME: hits the disk a lot
00082                 //21    XmlBackEnd.dll  Util::preprocessPath + 0xf0, c:\users\ksmyth\git\gmesrc\gme\xmlbackend\svncode\util.cpp(317)    0x6f9f4a0       C:\Users\ksmyth\git\GMESRC\GME\Release\XmlBackEnd.dll
00083                 //22    XmlBackEnd.dll  Path::Path + 0x6d, c:\users\ksmyth\git\gmesrc\gme\xmlbackend\svncode\path.cpp(39)       0x6f9b82d       C:\Users\ksmyth\git\GMESRC\GME\Release\XmlBackEnd.dll
00084                 //23    XmlBackEnd.dll  Client::sub_propertySet + 0xb5, c:\users\ksmyth\git\gmesrc\gme\xmlbackend\svncode\client.cpp(357)       0x6f97945       C:\Users\ksmyth\git\GMESRC\GME\Release\XmlBackEnd.dll
00085                 //24    XmlBackEnd.dll  HiClient::lockableProp + 0xd8, c:\users\ksmyth\git\gmesrc\gme\xmlbackend\svncode\hiclient.cpp(320)      0x6f98cc8       C:\Users\ksmyth\git\GMESRC\GME\Release\XmlBackEnd.dll
00086 
00087                 m_error_occured = Util::preprocessPath(pi_path, m_pool);
00088 
00089                 m_path = pi_path;
00090         }
00091 }
00092 
00096 const std::string &
00097 Path::path () const
00098 {
00099         return m_path;
00100 }
00101 
00105 const char *
00106 Path::c_str() const
00107 {
00108         return m_path.c_str ();
00109 }
00110 
00114 Path&
00115 Path::operator=(const Path & pi_path)
00116 {
00117         init(pi_path.c_str(), pi_path.m_pool);
00118         return *this;
00119 }
00120 
00121 svn_error_t *Path::error_occured() const
00122 {
00123         return m_error_occured;
00124 }
00125 
00126 bool Path::isValid(const char *p)
00127 {
00128         if (p == NULL)
00129         {
00130                 return false;
00131         }
00132 
00133         Pool reqPool;
00134         svn_error_t *err = svn_path_check_valid(p, reqPool.pool());
00135         if (err == SVN_NO_ERROR)
00136         {
00137                 return true;
00138         }
00139         else
00140         {
00141                 svn_error_clear(err);
00142                 return false;
00143         }
00144 }
00145 
00146 #endif