Revision: 44762
          http://brlcad.svn.sourceforge.net/brlcad/?rev=44762&view=rev
Author:   brlcad
Date:     2011-06-06 21:23:57 +0000 (Mon, 06 Jun 2011)

Log Message:
-----------
fortunately, there's already a very common name for this type of operation.  
instead of getLastStepOfPath(), rename to simply basename().

Modified Paths:
--------------
    geomcore/trunk/include/StringUtils.h
    geomcore/trunk/src/GS/BrlcadDb.cxx
    geomcore/trunk/src/GS/FileDataSource.cxx
    geomcore/trunk/src/utility/StringUtils.cxx
    geomcore/trunk/tests/unit/utility/StringUtilsUTest.cxx

Modified: geomcore/trunk/include/StringUtils.h
===================================================================
--- geomcore/trunk/include/StringUtils.h        2011-06-06 21:21:25 UTC (rev 
44761)
+++ geomcore/trunk/include/StringUtils.h        2011-06-06 21:23:57 UTC (rev 
44762)
@@ -110,7 +110,7 @@
    * Determines and returns the last step of the provided 'path'.
    * Steps are determined by PATH_DELIM.
    */
-  static std::string getLastStepOfPath(const std::string path);
+  static std::string basename(const std::string path);
 
 
 private:

Modified: geomcore/trunk/src/GS/BrlcadDb.cxx
===================================================================
--- geomcore/trunk/src/GS/BrlcadDb.cxx  2011-06-06 21:21:25 UTC (rev 44761)
+++ geomcore/trunk/src/GS/BrlcadDb.cxx  2011-06-06 21:23:57 UTC (rev 44762)
@@ -154,7 +154,7 @@
     return G_PATH_NOT_VALID;
 
   /* Since we have good path, skip walk and go directly to item */
-  std::string objName = StringUtils::getLastStepOfPath(gPath);
+  std::string objName = StringUtils::basename(gPath);
 
   dp = db_lookup(this->dbip, objName.c_str(), 0);
   if (dp == RT_DIR_NULL)  return G_PATH_NOT_VALID;

Modified: geomcore/trunk/src/GS/FileDataSource.cxx
===================================================================
--- geomcore/trunk/src/GS/FileDataSource.cxx    2011-06-06 21:21:25 UTC (rev 
44761)
+++ geomcore/trunk/src/GS/FileDataSource.cxx    2011-06-06 21:23:57 UTC (rev 
44762)
@@ -168,7 +168,7 @@
   BrlcadDb* db = BrlcadDb::makeDb(fsPath);
   if (db == NULL) return BrlcadDb::FS_PATH_NOT_VALID;
 
-  std::string name = StringUtils::getLastStepOfPath(gPath);
+  std::string name = StringUtils::basename(gPath);
 
   int retVal = db->list(name, items);
   delete db;

Modified: geomcore/trunk/src/utility/StringUtils.cxx
===================================================================
--- geomcore/trunk/src/utility/StringUtils.cxx  2011-06-06 21:21:25 UTC (rev 
44761)
+++ geomcore/trunk/src/utility/StringUtils.cxx  2011-06-06 21:23:57 UTC (rev 
44762)
@@ -233,7 +233,7 @@
 
 
 std::string
-StringUtils::getLastStepOfPath(const std::string path)
+StringUtils::basename(const std::string path)
 {
   std::string out = "";
   std::string copy = path;

Modified: geomcore/trunk/tests/unit/utility/StringUtilsUTest.cxx
===================================================================
--- geomcore/trunk/tests/unit/utility/StringUtilsUTest.cxx      2011-06-06 
21:21:25 UTC (rev 44761)
+++ geomcore/trunk/tests/unit/utility/StringUtilsUTest.cxx      2011-06-06 
21:23:57 UTC (rev 44762)
@@ -24,11 +24,16 @@
  */
 
 #include "StringUtils.h"
+
 #include <cppunit/TestCase.h>
 #include <cppunit/extensions/HelperMacros.h>
 #include <string.h>
 
-class StringUtilsUTest : public CPPUNIT_NS::TestFixture {
+#include "bu.h"
+
+
+class StringUtilsUTest : public CPPUNIT_NS::TestFixture
+{
   CPPUNIT_TEST_SUITE( StringUtilsUTest );
   CPPUNIT_TEST( testGetLastStepOfPath );
   CPPUNIT_TEST( testSplitPathAtStep01 );
@@ -54,15 +59,14 @@
   testGetLastStepOfPath()
   {
     std::string name;
-    //std::cout << "\n\nname " << name << "\n\n";
 
-    name =  StringUtils::getLastStepOfPath(testPath01);
+    name =  StringUtils::basename(testPath01.c_str());
     CPPUNIT_ASSERT(name == "duder");
-    name =  StringUtils::getLastStepOfPath(testPath02);
+    name =  StringUtils::basename(testPath02.c_str());
     CPPUNIT_ASSERT(name == "duder");
-    name =  StringUtils::getLastStepOfPath(testPath03);
+    name =  StringUtils::basename(testPath03.c_str());
     CPPUNIT_ASSERT(name == "duder");
-    name =  StringUtils::getLastStepOfPath(testPath04);
+    name =  StringUtils::basename(testPath04.c_str());
     CPPUNIT_ASSERT(name == "duder");
   }
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to