Chris Hillery has proposed merging 
lp:~zorba-coders/zorba/zorba-with-file-access into lp:zorba.

Commit message:
Fixes to make ZORBA_WITH_FILE_ACCESS=0 work.

Requested reviews:
  Chris Hillery (ceejatec)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/zorba-with-file-access/+merge/144622
-- 
https://code.launchpad.net/~zorba-coders/zorba/zorba-with-file-access/+merge/144622
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'bin/zorbacmd.cpp'
--- bin/zorbacmd.cpp	2012-11-06 10:11:37 +0000
+++ bin/zorbacmd.cpp	2013-01-24 02:29:23 +0000
@@ -622,6 +622,7 @@
 void
 removeOutputFileIfNeeded(const ZorbaCMDProperties& lProperties)
 {
+#ifdef ZORBA_WITH_FILE_ACCESS
   if (lProperties.outputFile().size() > 0)
   {
     File_t lFile = zorba::File::createFile(lProperties.outputFile());
@@ -630,6 +631,7 @@
       lFile->remove();
     }
   }
+#endif /* ZORBA_WITH_FILE_ACCESS */
 }
 
 
@@ -963,20 +965,28 @@
 
   // write to file or standard out
   std::auto_ptr<std::ostream> 
-  lFileStream(properties.outputFile().size() > 0 ?
-              new std::ofstream(properties.outputFile().c_str()) : 0);
+  lFileStream(
+      #ifdef ZORBA_WITH_FILE_ACCESS
+        properties.outputFile().size() > 0 ?
+          new std::ofstream(properties.outputFile().c_str()) : 0
+      #else /* ZORBA_WITH_FILE_ACCESS */
+        0
+      #endif /* ZORBA_WITH_FILE_ACCESS */
+        );
 
   std::ostream* lOutputStream = lFileStream.get();
   if ( lOutputStream == 0 )
   {
     lOutputStream = &std::cout;
   }
+#ifdef ZORBA_WITH_FILE_ACCESS
   else if ( !lOutputStream->good() )
   {
     std::cerr << "could not write to output file {" << properties.outputFile()
               << "}" << std::endl;
     return 2;
   }
+#endif /* ZORBA_WITH_FILE_ACCESS */
 
   if (properties.queriesOrFilesBegin() == properties.queriesOrFilesEnd())
   {

=== modified file 'bin/zorbacmdproperties_base.h'
--- bin/zorbacmdproperties_base.h	2012-11-06 10:11:37 +0000
+++ bin/zorbacmdproperties_base.h	2013-01-24 02:29:23 +0000
@@ -32,7 +32,11 @@
   const char** get_all_options () const
   {
     static const char* result [] = {
-      "--timing", "--output-file", "--serialization-parameter",
+      "--timing",
+#ifdef ZORBA_WITH_FILE_ACCESS
+      "--output-file",
+#endif /* ZORBA_WITH_FILE_ACCESS */
+      "--serialization-parameter",
       "--serialize-html", "--serialize-text", "--indent", "--print-query",
       "--print-errors-as-xml", "--byte-order-mark", "--omit-xml-declaration",
       "--base-uri", "--boundary-space", "--default-collation",
@@ -48,7 +52,9 @@
   }
 
   bool theTiming;
+#ifdef ZORBA_WITH_FILE_ACCESS
   std::string theOutputFile;
+#endif /* ZORBA_WITH_FILE_ACCESS */
   std::vector<std::string> theSerializationParameter;
   bool theSerializeHtml;
   bool theSerializeText;
@@ -119,7 +125,9 @@
 
 public:
   const bool &timing () const { return theTiming; }
+#ifdef ZORBA_WITH_FILE_ACCESS
   const std::string &outputFile () const { return theOutputFile; }
+#endif /* ZORBA_WITH_FILE_ACCESS */
   const std::vector<std::string> &serializationParameter () const { return theSerializationParameter; }
   const bool &serializeHtml () const { return theSerializeHtml; }
   const bool &serializeText () const { return theSerializeText; }
@@ -177,6 +185,7 @@
       {
         theTiming = true;
       }
+#ifdef ZORBA_WITH_FILE_ACCESS
       else if (strcmp (*argv, "--output-file") == 0 || strncmp (*argv, "-o", 2) == 0) 
       {
         int d = 2;
@@ -184,6 +193,7 @@
         if (*argv == NULL) { result = "No value given for --output-file option"; break; }
         init_val (*argv, theOutputFile, d);
       }
+#endif /* ZORBA_WITH_FILE_ACCESS */
       else if (strcmp (*argv, "--serialization-parameter") == 0 || strncmp (*argv, "-z", 2) == 0) 
       {
         int d = 2;

=== modified file 'src/api/CMakeLists.txt'
--- src/api/CMakeLists.txt	2012-12-05 03:33:46 +0000
+++ src/api/CMakeLists.txt	2013-01-24 02:29:23 +0000
@@ -46,7 +46,6 @@
     invoke_item_sequence.cpp
     item_sequence_chainer.cpp
     empty_sequence.cpp
-    fileimpl.cpp
     serializerimpl.cpp
     base64impl.cpp
     base64_streambuf.cpp
@@ -63,6 +62,11 @@
     uuid.cpp
     )
 
+IF (ZORBA_WITH_FILE_ACCESS)
+  LIST(APPEND API_SRCS
+    fileimpl.cpp)
+ENDIF (ZORBA_WITH_FILE_ACCESS)  
+
 IF (NOT ZORBA_NO_FULL_TEXT)
   LIST(APPEND API_SRCS
     stemmer.cpp

=== modified file 'src/api/fileimpl.cpp'
--- src/api/fileimpl.cpp	2012-09-19 21:16:15 +0000
+++ src/api/fileimpl.cpp	2013-01-24 02:29:23 +0000
@@ -102,7 +102,7 @@
   ZORBA_CATCH
 
   return lResult;
-};
+}
 
 const std::string
 FileImpl::getFileUri() const
@@ -136,7 +136,7 @@
   ZORBA_CATCH
 
   return lPath;
-};
+}
 
 bool
 FileImpl::isDirectory() const
@@ -148,7 +148,7 @@
   ZORBA_CATCH
 
   return lResult;
-};
+}
 
 bool
 FileImpl::isFile() const

=== modified file 'src/unit_tests/CMakeLists.txt'
--- src/unit_tests/CMakeLists.txt	2013-01-08 03:09:24 +0000
+++ src/unit_tests/CMakeLists.txt	2013-01-24 02:29:23 +0000
@@ -16,7 +16,6 @@
   instantiate_string.cpp
   test_base64.cpp
   test_base64_streambuf.cpp
-  test_fs_iterator.cpp
   test_hashmaps.cpp
   test_json_parser.cpp
   test_string.cpp
@@ -26,6 +25,11 @@
   unit_tests.cpp
 )
 
+IF (ZORBA_WITH_FILE_ACCESS)
+  LIST (APPEND UNIT_TEST_SRCS
+    test_fs_iterator.cpp)
+ENDIF (ZORBA_WITH_FILE_ACCESS)
+
 IF (NOT ZORBA_NO_FULL_TEXT)
   LIST (APPEND UNIT_TEST_SRCS
     test_stemmer.cpp

=== modified file 'src/unit_tests/unit_test_list.h'
--- src/unit_tests/unit_test_list.h	2013-01-04 16:08:03 +0000
+++ src/unit_tests/unit_test_list.h	2013-01-24 02:29:23 +0000
@@ -45,7 +45,9 @@
 
   int test_unique_ptr( int, char*[] );
 
+#ifdef ZORBA_WITH_FILE_ACCESS
   int test_fs_iterator( int, char*[] );
+#endif /* ZORBA_WITH_FILE_ACCESS */
 
 #ifndef ZORBA_NO_FULL_TEXT
   int test_stemmer( int, char*[] );

=== modified file 'src/unit_tests/unit_tests.cpp'
--- src/unit_tests/unit_tests.cpp	2013-01-04 16:08:03 +0000
+++ src/unit_tests/unit_tests.cpp	2013-01-24 02:29:23 +0000
@@ -41,7 +41,9 @@
 
   libunittests["base64_streambuf"] = test_base64_streambuf;
 
+#ifdef ZORBA_WITH_FILE_ACCESS
   libunittests["fs_iterator"] = test_fs_iterator;
+#endif /* ZORBA_WITH_FILE_ACCESS */
 
 #ifndef ZORBA_NO_ICU
   libunittests["icu_streambuf"] = test_icu_streambuf;

=== modified file 'src/util/file.cpp'
--- src/util/file.cpp	2012-09-19 21:16:15 +0000
+++ src/util/file.cpp	2013-01-24 02:29:23 +0000
@@ -317,6 +317,7 @@
   remove( ignore );
 }
 
+#ifdef ZORBA_WITH_FILE_ACCESS
 #ifndef _WIN32_WCE
 void file::chdir() {
   if ( is_directory() ) {
@@ -329,6 +330,7 @@
   }
 }
 #endif
+#endif /* ZORBA_WITH_FILE_ACCESS */
 
 void file::rename( std::string const& newpath ) {
 #ifdef ZORBA_WITH_FILE_ACCESS

=== modified file 'src/util/fs_util.cpp'
--- src/util/fs_util.cpp	2012-09-19 21:16:15 +0000
+++ src/util/fs_util.cpp	2013-01-24 02:29:23 +0000
@@ -273,6 +273,8 @@
 #endif /* WIN32 */
 }
 
+#endif /* ZORBA_WITH_FILE_ACCESS */
+
 type get_type( char const *path, size_type *size ) {
 #ifndef WIN32
   struct stat st_buf;
@@ -295,6 +297,8 @@
 #endif /* WIN32 */
 }
 
+#ifdef ZORBA_WITH_FILE_ACCESS
+
 void mkdir( char const *path ) {
 #ifndef WIN32
   if ( ::mkdir( path, 0755 ) != 0 )

=== modified file 'src/util/fs_util.h'
--- src/util/fs_util.h	2012-11-25 16:03:48 +0000
+++ src/util/fs_util.h	2013-01-24 02:29:23 +0000
@@ -496,8 +496,6 @@
   return base_name( path.c_str() );
 }
 
-#ifdef ZORBA_WITH_FILE_ACCESS
-
 /**
  * Gets the type of the given file.
  *
@@ -525,8 +523,6 @@
   return get_type( path.c_str(), size );
 }
 
-#endif /* ZORBA_WITH_FILE_ACCESS */
-
 /**
  * Checks whether the given path is an absolute path.
  *

-- 
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

Reply via email to