[llvm-commits] CVS: llvm/lib/System/Path.cpp

Reid Spencer reid at x10sys.com
Sat Aug 28 22:24:12 PDT 2004



Changes in directory llvm/lib/System:

Path.cpp updated: 1.3 -> 1.4
---
Log message:

Revise the design of the Path concept per peer review. Too many changes to
note individually but these essence of it is to not derive from 
std::string, clarify the interface, and provide better documentation.
There is now also (untested) implementations for AIX, Darwin, and SunOS.


---
Diffs of the changes:  (+7 -28)

Index: llvm/lib/System/Path.cpp
diff -u llvm/lib/System/Path.cpp:1.3 llvm/lib/System/Path.cpp:1.4
--- llvm/lib/System/Path.cpp:1.3	Wed Aug 25 01:19:01 2004
+++ llvm/lib/System/Path.cpp	Sun Aug 29 00:24:00 2004
@@ -10,10 +10,11 @@
 //  This header file implements the operating system Path concept.
 //
 //===----------------------------------------------------------------------===//
+
 #include "llvm/System/Path.h"
 
 namespace llvm {
-namespace sys {
+using namespace sys;
 
 //===----------------------------------------------------------------------===//
 //=== WARNING: Implementation here must contain only TRULY operating system
@@ -21,40 +22,18 @@
 //===----------------------------------------------------------------------===//
 
 bool
-Path::is_valid() const {
-  if ( empty() ) return false;
-  return true;
-}
-
-void 
-Path::fill( char* buffer, unsigned bufflen ) const {
-  unsigned pathlen = length();
-  assert( bufflen > pathlen && "Insufficient buffer size" );
-  unsigned copylen = pathlen <? (bufflen - 1);
-  this->copy(buffer, copylen, 0 );
-  buffer[ copylen ] = 0;
+Path::is_file() const {
+  return (is_valid() && path[path.length()-1] != '/');
 }
 
-void
-Path::make_directory() {
-  char end[2];
-  end[0] = '/';
-  end[1] = 0;
-  if ( empty() )
-    this->assign( end );
-  else if ( (*this)[length()-1] != '/')
-    this->append( end );
+bool
+Path::is_directory() const {
+  return (is_valid() && path[path.length()-1] == '/');
 }
 
-void
-Path::make_file() {
-  if ( (*this)[length()-1] == '/')
-    this->erase( this->length()-1, 1 );
 }
 
 // Include the truly platform-specific parts of this class.
 #include "platform/Path.cpp"
-}
-}
 
 // vim: sw=2






More information about the llvm-commits mailing list