From f20a251240d72281565564ae54e3c7f3314a5030 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 11 Dec 2007 21:24:13 +0000 Subject: Fixed the bu directory, now the code should compile and be usable even installed. That was odd. Anyway, also set props on the bu, unit, and test directories so that the contents won't be listed on svn status. --- build.conf | 14 ++++---- src/archive.cpp | 2 +- src/tests/archive.cpp | 4 +-- src/tests/archive2.cpp | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/unit/file.cpp | 6 ++-- src/unit/fstring.cpp | 4 +-- src/unit/taf.cpp | 6 ++-- 7 files changed, 113 insertions(+), 18 deletions(-) create mode 100644 src/tests/archive2.cpp diff --git a/build.conf b/build.conf index 0ad3f72..79c472c 100644 --- a/build.conf +++ b/build.conf @@ -15,7 +15,7 @@ set "CXXFLAGS" += "-ggdb -Wall" set "CXXFLAGS" += "-pg" set "LDFLAGS" += "-pg" -filesIn("src") filter regexp("^src/(.*)\\.h$", "src/bu/{re:1}.h"): +filesIn("src") filter regexp("^src/(.*)\\.h$", "bu/{re:1}.h"): rule "hln", group "lnhdrs", target file, @@ -24,7 +24,7 @@ filesIn("src") filter regexp("^src/(.*)\\.h$", "src/bu/{re:1}.h"): "libbu++.a": rule "lib", target file, - set "CXXFLAGS" += "-Isrc -fPIC", + set "CXXFLAGS" += "-I. -fPIC", input filesIn("src") filter regexp("^.*\\.cpp$") directoriesIn("src/tests","tests/"): @@ -32,7 +32,7 @@ directoriesIn("src/tests","tests/"): target file, group "tests", requires "libbu++.a", - set "CXXFLAGS" += "-Isrc", + set "CXXFLAGS" += "-I.", set "LDFLAGS" += "-L. -lbu++", input filesIn("{fulldir}") filter regexp("^.*\\.cpp$") @@ -41,7 +41,7 @@ filesIn("src/tests") filter regexp("^src/tests/(.*)\\.cpp$", "tests/{re:1}"): target file, group "tests", requires "libbu++.a", - set "CXXFLAGS" += "-Isrc", + set "CXXFLAGS" += "-I.", set "LDFLAGS" += "-L. -lbu++", input "src/{target}.cpp" @@ -54,7 +54,7 @@ filesIn("src/unit") filter regexp("^src/unit/(.*)\\.cpp$", "unit/{re:1}"): group "tests", group "unit", requires "libbu++.a", - set "CXXFLAGS" += "-Isrc", + set "CXXFLAGS" += "-I.", set "LDFLAGS" += "-L. -lbu++", input "src/{target}.cpp" @@ -80,6 +80,6 @@ rule "cpp": rule "hln": matches regexp("src/(.*)\\.h"), - produces "src/bu/{re:1}.h", - perform command("ln -s ../{re:1}.h {target}") + produces "bu/{re:1}.h", + perform command("ln -s ../src/{re:1}.h {target}") diff --git a/src/archive.cpp b/src/archive.cpp index 5ac2877..78fa362 100644 --- a/src/archive.cpp +++ b/src/archive.cpp @@ -5,7 +5,7 @@ * terms of the license contained in the file LICENSE. */ -#include "archive.h" +#include "bu/archive.h" Bu::Archive::Archive( Stream &rStream, bool bLoading ) : bLoading( bLoading ), diff --git a/src/tests/archive.cpp b/src/tests/archive.cpp index b2778f1..10bb834 100644 --- a/src/tests/archive.cpp +++ b/src/tests/archive.cpp @@ -5,8 +5,8 @@ * terms of the license contained in the file LICENSE. */ -#include "archive.h" -#include "file.h" +#include "bu/archive.h" +#include "bu/file.h" using namespace Bu; diff --git a/src/tests/archive2.cpp b/src/tests/archive2.cpp new file mode 100644 index 0000000..6d3c2c1 --- /dev/null +++ b/src/tests/archive2.cpp @@ -0,0 +1,95 @@ +#include "bu/archive.h" +#include "bu/archival.h" +#include "bu/file.h" + +int giId = 0; + +class A : public Bu::Archival +{ +public: + A() : + iId( giId++ ) + { + } + + virtual ~A() + { + } + + virtual void archive( Bu::Archive &ar ) + { + ar && iId; + } + + int iId; +}; + +class B : public Bu::Archival +{ +public: + B() : + iId( giId++ ), + a1( new A ), + a2( new A ) + { + } + + virtual ~B() + { + delete a1; + delete a2; + } + + virtual void archive( Bu::Archive &ar ) + { + //ar && iId && a1 && a2; + ar << iId << a1 << a2; + } + + int iId; + A *a1, *a2; +}; + +class C : public Bu::Archival +{ +public: + C() : + iId( giId++ ), + a( new A ), + b( new B ) + { + } + + virtual ~C() + { + delete a; + delete b; + } + + virtual void archive( Bu::Archive &ar ) + { + //ar && iId && a && b; + ar << iId; + ar << a << b; + } + + int iId; + A *a; + B *b; +}; + +void write() +{ + C *c = new C; + + Bu::File f( "test.archive", "wb"); + Bu::Archive ar( f, Bu::Archive::save ); + ar << c; +} + +int main() +{ + write(); + +} + diff --git a/src/unit/file.cpp b/src/unit/file.cpp index 5042350..abc816a 100644 --- a/src/unit/file.cpp +++ b/src/unit/file.cpp @@ -5,9 +5,9 @@ * terms of the license contained in the file LICENSE. */ -#include "unitsuite.h" -#include "file.h" -#include "exceptions.h" +#include "bu/unitsuite.h" +#include "bu/file.h" +#include "bu/exceptions.h" #include #include diff --git a/src/unit/fstring.cpp b/src/unit/fstring.cpp index b00f11b..cd90835 100644 --- a/src/unit/fstring.cpp +++ b/src/unit/fstring.cpp @@ -5,8 +5,8 @@ * terms of the license contained in the file LICENSE. */ -#include "fstring.h" -#include "unitsuite.h" +#include "bu/fstring.h" +#include "bu/unitsuite.h" class Unit : public Bu::UnitSuite { diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp index f363c78..b3edf5c 100644 --- a/src/unit/taf.cpp +++ b/src/unit/taf.cpp @@ -5,9 +5,9 @@ * terms of the license contained in the file LICENSE. */ -#include "unitsuite.h" -#include "file.h" -#include "tafreader.h" +#include "bu/unitsuite.h" +#include "bu/file.h" +#include "bu/tafreader.h" #include #include -- cgit v1.2.3