[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread noreply
The proposal to merge lp:~zorba-coders/zorba/bug-986580 into lp:zorba has been 
updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Zorba Build Bot
Validation queue job bug-986580-2012-04-25T20-43-03.061Z is finished. The final 
status was:

All tests succeeded!
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/bug-986580-2012-04-25T20-43-03.061Z/log.html
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Rodolfo Ochoa
The proposal to merge lp:~zorba-coders/zorba/bug-986580 into lp:zorba has been 
updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Rodolfo Ochoa
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Cezar Andrei
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Paul J. Lucas
I didn't realize that the util-jvm module used file::lsdir(), so I put that 
function back.  However, I think that API ought to change as well, but that can 
be done separately.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Paul J. Lucas
The proposal to merge lp:~zorba-coders/zorba/bug-986580 into lp:zorba has been 
updated.

Commit Message changed to:

Better implementation of listing files in a directory.

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Paul J. Lucas
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-986580 into 
lp:zorba.

Requested reviews:
  Cezar Andrei (cezar-andrei)
  Rodolfo Ochoa (rodolfo-ochoa)
Related bugs:
  Bug #986580 in Zorba: "fs::lsdir() improvements"
  https://bugs.launchpad.net/zorba/+bug/986580

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552

Better implementation of listing files in a directory.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103552
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2012-04-24 12:39:38 +
+++ CMakeLists.txt	2012-04-25 19:52:28 +
@@ -309,6 +309,13 @@
 MESSAGE (STATUS "")
 
 #
+# shlwapi
+#
+IF(WIN32)
+SET(requiredlibs ${requiredlibs} "shlwapi")
+ENDIF(WIN32)
+
+#
 # SWIG
 #
 IF (NOT ZORBA_SUPPRESS_SWIG)

=== modified file 'NOTICE.txt'
--- NOTICE.txt	2012-04-18 15:34:39 +
+++ NOTICE.txt	2012-04-25 19:52:28 +
@@ -459,24 +459,6 @@
   suitability of this software for any purpose. It is provided "as is"
   without express or implied warranty.
 
-
-
-src/util/win32/dirent.h
-
-Copyright: 2006 Toni Ronkko
-
-
-  Permission is hereby granted, free of charge, to any person obtaining
-  a copy of this software and associated documentation files (the
-  ``Software''), to deal in the Software without restriction, including
-  without limitation the rights to use, copy, modify, merge, publish,
-  distribute, sublicense, and/or sell copies of the Software, and to
-  permit persons to whom the Software is furnished to do so, subject to
-  the following conditions:
-
-  The above copyright notice and this permission notice shall be included
-  in all copies or substantial portions of the Software.
-
 
 External libraries used by this project:
 

=== modified file 'NOTICE.xml'
--- NOTICE.xml	2012-04-24 12:39:38 +
+++ NOTICE.xml	2012-04-25 19:52:28 +
@@ -423,22 +423,6 @@
   without express or implied warranty.
 
   
-  
-src/util/win32/dirent.h
-2006 Toni Ronkko
-
-  Permission is hereby granted, free of charge, to any person obtaining
-  a copy of this software and associated documentation files (the
-  ``Software''), to deal in the Software without restriction, including
-  without limitation the rights to use, copy, modify, merge, publish,
-  distribute, sublicense, and/or sell copies of the Software, and to
-  permit persons to whom the Software is furnished to do so, subject to
-  the following conditions:
-
-  The above copyright notice and this permission notice shall be included
-  in all copies or substantial portions of the Software.
-
-  
 
   
 LIBXML2

=== modified file 'src/api/fileimpl.cpp'
--- src/api/fileimpl.cpp	2012-04-24 12:39:38 +
+++ src/api/fileimpl.cpp	2012-04-25 19:52:28 +
@@ -29,44 +29,33 @@
 #ifdef WIN32
 #include 
 #endif
-#include 
 
 #include "util/uri_util.h"
 #include "zorbaimpl.h"
 
 namespace zorba {
 
-DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath)
-{
-  theInternalDirIter = new dir_iterator(aPath);
-}
-
-DirectoryIteratorImpl::~DirectoryIteratorImpl()
-{
-  delete theInternalDirIter;
+DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath) :
+  theInternalDirIter( aPath.c_str() )
+{
 }
 
 bool
 DirectoryIteratorImpl::next(std::string& aPathStr) const
 {
-  if (theInternalDirIter->end()) {
+  if (!theInternalDirIter.next()) {
 return false;
   }
 
   // get the current pointed entry
-  aPathStr = *(*theInternalDirIter);
-
-  // advance to the next entry
-  ++(*theInternalDirIter);
+  aPathStr = theInternalDirIter.entry_name();
 
   return true;
 }
 
 void DirectoryIteratorImpl::reset()
 {
-  std::string aPath = theInternalDirIter->dirpath;
-  delete theInternalDirIter;
-  theInternalDirIter = new dir_iterator(aPath);
+  theInternalDirIter.reset();
 }
 
 FileImpl::FileImpl(std::string const& path)

=== modified file 'src/api/fileimpl.h'
--- src/api/fileimpl.h	2012-04-24 12:39:38 +
+++ src/api/fileimpl.h	2012-04-25 19:52:28 +
@@ -20,10 +20,11 @@
 #include 
 #include 
 
+#include "util/fs_util.h"
+
 namespace zorba {
 
   class file;
-  class dir_iterator;
   class DiagnosticHandler;
 
 
@@ -31,14 +32,12 @@
 {
 private:
 
-  dir_iterator* theInternalDirIter;
+  mutable fs::iterator  theInternalDirIter;
 
 public:
 
   DirectoryIteratorImpl(std::string const& aPath);
 
-  ~DirectoryIteratorImpl();
-
   bool next(std::string& aPathStr) const;
   void reset();
 };

=== modified file 'src/unit_tests/CMakeLists.txt'
--- src/unit_tests/CMakeLists.txt	2012-04-24 12:39:38 +
+++ src/unit_tests/CMakeLists.txt	2012-04-25 19:52:28 +
@@ -20,6 +20,7 @@
   unit_tests.cpp
   test_uri.cpp
   json_parser.cpp
+  test_fs_iterator.cpp
 )
 
 IF (N

[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Zorba Build Bot
The proposal to merge lp:~zorba-coders/zorba/bug-986580 into lp:zorba has been 
updated.

Status: Approved => Needs review

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Zorba Build Bot
The attempt to merge lp:~zorba-coders/zorba/bug-986580 into lp:zorba failed. 
Below is the output from the failed tests.


CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 
(message):
  Validation queue job bug-986580-2012-04-25T18-26-18.651Z is finished.  The
  final status was:

  

  No tests were run - build or configure step must have failed.

  Not commiting changes.


Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/bug-986580-2012-04-25T18-26-18.651Z/log.html
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Rodolfo Ochoa
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Cezar Andrei
The proposal to merge lp:~zorba-coders/zorba/bug-986580 into lp:zorba has been 
updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Cezar Andrei
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Paul J. Lucas
The proposal to merge lp:~zorba-coders/zorba/bug-986580 into lp:zorba has been 
updated.

Commit Message changed to:

Better implementation of listing files in a directory.

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Paul J. Lucas
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-986580 into 
lp:zorba.

Requested reviews:
  Rodolfo Ochoa (rodolfo-ochoa)
  Cezar Andrei (cezar-andrei)
Related bugs:
  Bug #986580 in Zorba: "fs::lsdir() improvements"
  https://bugs.launchpad.net/zorba/+bug/986580

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520

Better implementation of listing files in a directory.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103520
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2012-04-24 12:39:38 +
+++ CMakeLists.txt	2012-04-25 17:20:26 +
@@ -309,6 +309,13 @@
 MESSAGE (STATUS "")
 
 #
+# shlwapi
+#
+IF(WIN32)
+SET(requiredlibs ${requiredlibs} "shlwapi")
+ENDIF(WIN32)
+
+#
 # SWIG
 #
 IF (NOT ZORBA_SUPPRESS_SWIG)

=== modified file 'NOTICE.txt'
--- NOTICE.txt	2012-04-18 15:34:39 +
+++ NOTICE.txt	2012-04-25 17:20:26 +
@@ -459,24 +459,6 @@
   suitability of this software for any purpose. It is provided "as is"
   without express or implied warranty.
 
-
-
-src/util/win32/dirent.h
-
-Copyright: 2006 Toni Ronkko
-
-
-  Permission is hereby granted, free of charge, to any person obtaining
-  a copy of this software and associated documentation files (the
-  ``Software''), to deal in the Software without restriction, including
-  without limitation the rights to use, copy, modify, merge, publish,
-  distribute, sublicense, and/or sell copies of the Software, and to
-  permit persons to whom the Software is furnished to do so, subject to
-  the following conditions:
-
-  The above copyright notice and this permission notice shall be included
-  in all copies or substantial portions of the Software.
-
 
 External libraries used by this project:
 

=== modified file 'NOTICE.xml'
--- NOTICE.xml	2012-04-24 12:39:38 +
+++ NOTICE.xml	2012-04-25 17:20:26 +
@@ -423,22 +423,6 @@
   without express or implied warranty.
 
   
-  
-src/util/win32/dirent.h
-2006 Toni Ronkko
-
-  Permission is hereby granted, free of charge, to any person obtaining
-  a copy of this software and associated documentation files (the
-  ``Software''), to deal in the Software without restriction, including
-  without limitation the rights to use, copy, modify, merge, publish,
-  distribute, sublicense, and/or sell copies of the Software, and to
-  permit persons to whom the Software is furnished to do so, subject to
-  the following conditions:
-
-  The above copyright notice and this permission notice shall be included
-  in all copies or substantial portions of the Software.
-
-  
 
   
 LIBXML2

=== modified file 'include/zorba/util/file.h'
--- include/zorba/util/file.h	2012-04-24 12:39:38 +
+++ include/zorba/util/file.h	2012-04-25 17:20:26 +
@@ -85,7 +85,6 @@
   void mkdir();
   void deep_mkdir();
   void rmdir(bool ignore = true);
-  void lsdir(std::vector &list);
 #ifndef _WIN32_WCE
   void chdir();
 #endif

=== modified file 'src/api/fileimpl.cpp'
--- src/api/fileimpl.cpp	2012-04-24 12:39:38 +
+++ src/api/fileimpl.cpp	2012-04-25 17:20:26 +
@@ -29,44 +29,33 @@
 #ifdef WIN32
 #include 
 #endif
-#include 
 
 #include "util/uri_util.h"
 #include "zorbaimpl.h"
 
 namespace zorba {
 
-DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath)
-{
-  theInternalDirIter = new dir_iterator(aPath);
-}
-
-DirectoryIteratorImpl::~DirectoryIteratorImpl()
-{
-  delete theInternalDirIter;
+DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath) :
+  theInternalDirIter( aPath.c_str() )
+{
 }
 
 bool
 DirectoryIteratorImpl::next(std::string& aPathStr) const
 {
-  if (theInternalDirIter->end()) {
+  if (!theInternalDirIter.next()) {
 return false;
   }
 
   // get the current pointed entry
-  aPathStr = *(*theInternalDirIter);
-
-  // advance to the next entry
-  ++(*theInternalDirIter);
+  aPathStr = theInternalDirIter.entry_name();
 
   return true;
 }
 
 void DirectoryIteratorImpl::reset()
 {
-  std::string aPath = theInternalDirIter->dirpath;
-  delete theInternalDirIter;
-  theInternalDirIter = new dir_iterator(aPath);
+  theInternalDirIter.reset();
 }
 
 FileImpl::FileImpl(std::string const& path)

=== modified file 'src/api/fileimpl.h'
--- src/api/fileimpl.h	2012-04-24 12:39:38 +
+++ src/api/fileimpl.h	2012-04-25 17:20:26 +
@@ -20,10 +20,11 @@
 #include 
 #include 
 
+#include "util/fs_util.h"
+
 namespace zorba {
 
   class file;
-  class dir_iterator;
   class DiagnosticHandler;
 
 
@@ -31,14 +32,12 @@
 {
 private:
 
-  dir_iterator* theInternalDirIter;
+  mutable fs::iterator  theInternalDirIter;
 
 public:
 
   DirectoryIteratorImpl(std::string const& aPath);
 
-  ~DirectoryIteratorImpl();
-
   bool nex

Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Cezar Andrei
Review: Needs Fixing

Looks good, please do remove the dirent.h copyright/license from NOTICE.txt/xml 
files since you removed dirent.h.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103408
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-25 Thread Rodolfo Ochoa
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103408
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-24 Thread Paul J. Lucas
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-986580 into 
lp:zorba.

Requested reviews:
  Cezar Andrei (cezar-andrei)
  Rodolfo Ochoa (rodolfo-ochoa)
Related bugs:
  Bug #986580 in Zorba: "fs::lsdir() improvements"
  https://bugs.launchpad.net/zorba/+bug/986580

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103408

Better implementation of listing files in a directory.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103408
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2012-04-24 12:39:38 +
+++ CMakeLists.txt	2012-04-25 05:14:20 +
@@ -309,6 +309,13 @@
 MESSAGE (STATUS "")
 
 #
+# shlwapi
+#
+IF(WIN32)
+SET(requiredlibs ${requiredlibs} "shlwapi")
+ENDIF(WIN32)
+
+#
 # SWIG
 #
 IF (NOT ZORBA_SUPPRESS_SWIG)

=== modified file 'include/zorba/util/file.h'
--- include/zorba/util/file.h	2012-04-24 12:39:38 +
+++ include/zorba/util/file.h	2012-04-25 05:14:20 +
@@ -85,7 +85,6 @@
   void mkdir();
   void deep_mkdir();
   void rmdir(bool ignore = true);
-  void lsdir(std::vector &list);
 #ifndef _WIN32_WCE
   void chdir();
 #endif

=== modified file 'src/api/fileimpl.cpp'
--- src/api/fileimpl.cpp	2012-04-24 12:39:38 +
+++ src/api/fileimpl.cpp	2012-04-25 05:14:20 +
@@ -29,44 +29,33 @@
 #ifdef WIN32
 #include 
 #endif
-#include 
 
 #include "util/uri_util.h"
 #include "zorbaimpl.h"
 
 namespace zorba {
 
-DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath)
-{
-  theInternalDirIter = new dir_iterator(aPath);
-}
-
-DirectoryIteratorImpl::~DirectoryIteratorImpl()
-{
-  delete theInternalDirIter;
+DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath) :
+  theInternalDirIter( aPath.c_str() )
+{
 }
 
 bool
 DirectoryIteratorImpl::next(std::string& aPathStr) const
 {
-  if (theInternalDirIter->end()) {
+  if (!theInternalDirIter.next()) {
 return false;
   }
 
   // get the current pointed entry
-  aPathStr = *(*theInternalDirIter);
-
-  // advance to the next entry
-  ++(*theInternalDirIter);
+  aPathStr = theInternalDirIter.entry_name();
 
   return true;
 }
 
 void DirectoryIteratorImpl::reset()
 {
-  std::string aPath = theInternalDirIter->dirpath;
-  delete theInternalDirIter;
-  theInternalDirIter = new dir_iterator(aPath);
+  theInternalDirIter.reset();
 }
 
 FileImpl::FileImpl(std::string const& path)

=== modified file 'src/api/fileimpl.h'
--- src/api/fileimpl.h	2012-04-24 12:39:38 +
+++ src/api/fileimpl.h	2012-04-25 05:14:20 +
@@ -20,10 +20,11 @@
 #include 
 #include 
 
+#include "util/fs_util.h"
+
 namespace zorba {
 
   class file;
-  class dir_iterator;
   class DiagnosticHandler;
 
 
@@ -31,14 +32,12 @@
 {
 private:
 
-  dir_iterator* theInternalDirIter;
+  mutable fs::iterator  theInternalDirIter;
 
 public:
 
   DirectoryIteratorImpl(std::string const& aPath);
 
-  ~DirectoryIteratorImpl();
-
   bool next(std::string& aPathStr) const;
   void reset();
 };

=== modified file 'src/unit_tests/CMakeLists.txt'
--- src/unit_tests/CMakeLists.txt	2012-04-24 12:39:38 +
+++ src/unit_tests/CMakeLists.txt	2012-04-25 05:14:20 +
@@ -20,6 +20,7 @@
   unit_tests.cpp
   test_uri.cpp
   json_parser.cpp
+  test_fs_iterator.cpp
 )
 
 IF (NOT ZORBA_NO_FULL_TEXT)

=== added file 'src/unit_tests/test_fs_iterator.cpp'
--- src/unit_tests/test_fs_iterator.cpp	1970-01-01 00:00:00 +
+++ src/unit_tests/test_fs_iterator.cpp	2012-04-25 05:14:20 +
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2006-2010 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+
+#include 
+#include 
+
+#include "util/fs_util.h"
+
+using namespace std;
+using namespace zorba;
+
+///
+
+namespace zorba {
+namespace UnitTests {
+
+int test_fs_iterator( int argc, char *argv[] ) {
+  int result = 0;
+  try {
+#ifndef WIN32
+fs::iterator dir_iter( "/" );
+#else
+fs::iterator dir_iter( "C:\\" );
+#endif /* WIN32 */
+while ( dir_iter.next() )
+  cout << dir_iter.entry_name() << " (" << dir_iter.entry_type() << ')' << endl;
+  }
+  catch ( ZorbaException const &e ) {
+cerr << e << endl;
+result = 2;
+  }
+
+  return result;
+}
+
+} // namespace UnitTests
+} // namespace zorba
+
+/* vim:set et sw=2 ts=2: */

=== modified file 'src/unit_tests/unit_test_list.h'
--- src/unit_tests/unit_test_list.h	

[Zorba-coders] [Merge] lp:~zorba-coders/zorba/bug-986580 into lp:zorba

2012-04-24 Thread Paul J. Lucas
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-986580 into 
lp:zorba.

Requested reviews:
  Cezar Andrei (cezar-andrei)
  Rodolfo Ochoa (rodolfo-ochoa)
Related bugs:
  Bug #986580 in Zorba: "fs::lsdir() improvements"
  https://bugs.launchpad.net/zorba/+bug/986580

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103402

Better cross-platform implementation for listing the files in a directory.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986580/+merge/103402
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt	2012-04-24 12:39:38 +
+++ CMakeLists.txt	2012-04-25 01:55:41 +
@@ -309,6 +309,13 @@
 MESSAGE (STATUS "")
 
 #
+# shlwapi
+#
+IF(WIN32)
+SET(requiredlibs ${requiredlibs} "shlwapi")
+ENDIF(WIN32)
+
+#
 # SWIG
 #
 IF (NOT ZORBA_SUPPRESS_SWIG)

=== modified file 'include/zorba/util/file.h'
--- include/zorba/util/file.h	2012-04-24 12:39:38 +
+++ include/zorba/util/file.h	2012-04-25 01:55:41 +
@@ -85,7 +85,6 @@
   void mkdir();
   void deep_mkdir();
   void rmdir(bool ignore = true);
-  void lsdir(std::vector &list);
 #ifndef _WIN32_WCE
   void chdir();
 #endif

=== modified file 'src/api/fileimpl.cpp'
--- src/api/fileimpl.cpp	2012-04-24 12:39:38 +
+++ src/api/fileimpl.cpp	2012-04-25 01:55:41 +
@@ -29,44 +29,33 @@
 #ifdef WIN32
 #include 
 #endif
-#include 
 
 #include "util/uri_util.h"
 #include "zorbaimpl.h"
 
 namespace zorba {
 
-DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath)
-{
-  theInternalDirIter = new dir_iterator(aPath);
-}
-
-DirectoryIteratorImpl::~DirectoryIteratorImpl()
-{
-  delete theInternalDirIter;
+DirectoryIteratorImpl::DirectoryIteratorImpl(std::string const& aPath) :
+  theInternalDirIter( aPath.c_str() )
+{
 }
 
 bool
 DirectoryIteratorImpl::next(std::string& aPathStr) const
 {
-  if (theInternalDirIter->end()) {
+  if (!theInternalDirIter.next()) {
 return false;
   }
 
   // get the current pointed entry
-  aPathStr = *(*theInternalDirIter);
-
-  // advance to the next entry
-  ++(*theInternalDirIter);
+  aPathStr = theInternalDirIter.entry_name();
 
   return true;
 }
 
 void DirectoryIteratorImpl::reset()
 {
-  std::string aPath = theInternalDirIter->dirpath;
-  delete theInternalDirIter;
-  theInternalDirIter = new dir_iterator(aPath);
+  theInternalDirIter.reset();
 }
 
 FileImpl::FileImpl(std::string const& path)

=== modified file 'src/api/fileimpl.h'
--- src/api/fileimpl.h	2012-04-24 12:39:38 +
+++ src/api/fileimpl.h	2012-04-25 01:55:41 +
@@ -20,10 +20,11 @@
 #include 
 #include 
 
+#include "util/fs_util.h"
+
 namespace zorba {
 
   class file;
-  class dir_iterator;
   class DiagnosticHandler;
 
 
@@ -31,14 +32,12 @@
 {
 private:
 
-  dir_iterator* theInternalDirIter;
+  mutable fs::iterator  theInternalDirIter;
 
 public:
 
   DirectoryIteratorImpl(std::string const& aPath);
 
-  ~DirectoryIteratorImpl();
-
   bool next(std::string& aPathStr) const;
   void reset();
 };

=== modified file 'src/unit_tests/CMakeLists.txt'
--- src/unit_tests/CMakeLists.txt	2012-04-24 12:39:38 +
+++ src/unit_tests/CMakeLists.txt	2012-04-25 01:55:41 +
@@ -20,6 +20,7 @@
   unit_tests.cpp
   test_uri.cpp
   json_parser.cpp
+  test_fs_iterator.cpp
 )
 
 IF (NOT ZORBA_NO_FULL_TEXT)

=== added file 'src/unit_tests/test_fs_iterator.cpp'
--- src/unit_tests/test_fs_iterator.cpp	1970-01-01 00:00:00 +
+++ src/unit_tests/test_fs_iterator.cpp	2012-04-25 01:55:41 +
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2006-2010 The FLWOR Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "stdafx.h"
+
+#include 
+#include 
+
+#include "util/fs_util.h"
+
+using namespace std;
+using namespace zorba;
+
+///
+
+namespace zorba {
+namespace UnitTests {
+
+int test_fs_iterator( int argc, char *argv[] ) {
+  int result = 0;
+  try {
+#ifndef WIN32
+fs::iterator dir_iter( "/" );
+#else
+fs::iterator dir_iter( "C:\\" );
+#endif /* WIN32 */
+while ( dir_iter.next() )
+  cout << dir_iter.entry_name() << " (" << dir_iter.entry_type() << ')' << endl;
+  }
+  catch ( ZorbaException const &e ) {
+cerr << e << endl;
+result = 2;
+  }
+
+  return result;
+}
+
+} // namespace UnitTests
+} // namespace zorba
+
+/* vim:set et sw=2 ts=2: */

=== modified file 'src/unit_tests/unit_test_list.h'
--- src/unit_tes