From 1a28b45a936c8e2033f7d406f93946e90d273e6d Mon Sep 17 00:00:00 2001 From: Gert van Valkenhoef Date: Tue, 15 Nov 2011 17:26:41 +0000 Subject: [PATCH 1/1] Split Alien module into files --- alien/Make.inc | 2 +- alien/alien.cc | 28 ++-------------------------- alien/alien.h | 8 ++++---- alien/alien.ih | 4 ++++ alien/part.cc | 20 ++++++++++++++++++++ alien/piece.cc | 14 ++++++++++++++ 6 files changed, 45 insertions(+), 31 deletions(-) create mode 100644 alien/alien.ih create mode 100644 alien/part.cc create mode 100644 alien/piece.cc diff --git a/alien/Make.inc b/alien/Make.inc index 6a6a6a6..fd5c702 100644 --- a/alien/Make.inc +++ b/alien/Make.inc @@ -1 +1 @@ -SRCS += alien/alien.cc +SRCS += alien/alien.cc alien/piece.cc alien/part.cc diff --git a/alien/alien.cc b/alien/alien.cc index 38c70bd..d00a4b8 100644 --- a/alien/alien.cc +++ b/alien/alien.cc @@ -1,31 +1,7 @@ -#include "alien/alien.h" +#include "alien/alien.ih" namespace odc { -AlienPiece::AlienPiece(const char * const _data, const size_t _len): data(_data), len(_len) {} - -std::string AlienPiece::toString() { - return std::string("AlienPiece"); -} - -void AlienPiece::accept(Visitor &visitor) const { -} - -AlienPart::AlienPart(Store * const store): d_store(store) {} - -std::string AlienPart::toString() { - if (d_store != 0) - return d_store->toString(); - else - return "NULL"; -} - -void AlienPart::accept(Visitor &visitor) const { - if (d_store != 0) { - d_store->accept(visitor); - } -} - Alien::Alien(INTEGER id, const TypePath &path): Store(id), d_path(path), d_comps() {} std::vector & Alien::getComponents() { @@ -46,4 +22,4 @@ void Alien::accept(Visitor &visitor) const { } } -} +} // namespace odc diff --git a/alien/alien.h b/alien/alien.h index 5cc1262..099364f 100644 --- a/alien/alien.h +++ b/alien/alien.h @@ -3,13 +3,13 @@ #include "oberon.h" #include "store/store.h" -#include "visitor/visitor.h" -#include #include #include namespace odc { +class Visitor; + /** * Part of an alien store */ @@ -22,8 +22,8 @@ struct AlienComponent { * Totally unstructured part of an alien store */ struct AlienPiece : public AlienComponent { - const char * const data; - const size_t len; + char const * const data; + size_t const len; AlienPiece(const char * const data, const size_t len); diff --git a/alien/alien.ih b/alien/alien.ih new file mode 100644 index 0000000..34026e9 --- /dev/null +++ b/alien/alien.ih @@ -0,0 +1,4 @@ +#include + +#include "alien/alien.h" +#include "visitor/visitor.h" diff --git a/alien/part.cc b/alien/part.cc new file mode 100644 index 0000000..1f7ff47 --- /dev/null +++ b/alien/part.cc @@ -0,0 +1,20 @@ +#include "alien/alien.ih" + +namespace odc { + +AlienPart::AlienPart(Store * const store): d_store(store) {} + +std::string AlienPart::toString() { + if (d_store != 0) + return d_store->toString(); + else + return "NULL"; +} + +void AlienPart::accept(Visitor &visitor) const { + if (d_store != 0) { + d_store->accept(visitor); + } +} + +} // namespace odc diff --git a/alien/piece.cc b/alien/piece.cc new file mode 100644 index 0000000..82e3a0c --- /dev/null +++ b/alien/piece.cc @@ -0,0 +1,14 @@ +#include "alien/alien.ih" + +namespace odc { + +AlienPiece::AlienPiece(char const * const _data, const size_t _len): data(_data), len(_len) {} + +std::string AlienPiece::toString() { + return std::string("AlienPiece"); +} + +void AlienPiece::accept(Visitor &visitor) const { +} + +} // namespace odc -- 2.29.2