glom r1953 - in trunk: . glom/libglom



Author: murrayc
Date: Tue Mar  3 23:08:26 2009
New Revision: 1953
URL: http://svn.gnome.org/viewvc/glom?rev=1953&view=rev

Log:
2009-03-04  Murray Cumming  <murrayc murrayc com>

* glom/libglom/Makefile.am: Link to the correct library name for 
test_document.cc
* glom/libglom/test_document.cc: List the tables in the document.

Modified:
   trunk/ChangeLog
   trunk/glom/libglom/Makefile.am
   trunk/glom/libglom/test_document.cc

Modified: trunk/glom/libglom/Makefile.am
==============================================================================
--- trunk/glom/libglom/Makefile.am	(original)
+++ trunk/glom/libglom/Makefile.am	Tue Mar  3 23:08:26 2009
@@ -78,7 +78,7 @@
               $(GLOM_LIBS)
 
 test_document_SOURCES = test_document.cc
-test_document_LDADD =  libglom.la \
+test_document_LDADD =  libglom-1.0.la \
               $(GLOM_LIBS)
 
 if !WIN32

Modified: trunk/glom/libglom/test_document.cc
==============================================================================
--- trunk/glom/libglom/test_document.cc	(original)
+++ trunk/glom/libglom/test_document.cc	Tue Mar  3 23:08:26 2009
@@ -19,17 +19,43 @@
  */
 
 #include <libglom/document/document_glom.h>
-
+#include <giomm.h>
+#include <glibmm.h>
 
 int
 main()
 {
   Gnome::Gda::init();
+  Gio::init();
+
+  Glib::ustring uri;
+
+  try
+  {
+    uri = Glib::filename_to_uri("/home/murrayc/checkouts/gnome224/glom/examples/example_music_collection.glom");
+  }
+  catch(const Glib::ConvertError& ex)
+  {
+    std::cerr << "Exception from Glib::filename_to_uri(): " << ex.what();
+    return 1;
+  }
+
+  std::cout << "URI=" << uri << std::endl;
 
   Glom::Document_Glom document;
-  document.set_file_uri("../../examples/example_music_collection.glom");
+  document.set_file_uri(uri);
   bool test = document.load();
   std::cout << "Document load result=" << test << std::endl;
 
+  if(!test)
+    return 1;
+
+  typedef std::vector<Glib::ustring> type_vecstrings;
+  const type_vecstrings table_names = document.get_table_names();
+  for(type_vecstrings::const_iterator iter = table_names.begin(); iter != table_names.end(); ++iter)
+  {
+    std::cout << "Table: " << *iter << std::endl;
+  }
+
   return 0;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]