]> git.tdb.fi Git - libs/datafile.git/commitdiff
Turn internal type helpers into structs
authorMikko Rasa <tdb@tdb.fi>
Mon, 3 Dec 2012 21:58:06 +0000 (23:58 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 4 Dec 2012 07:02:12 +0000 (09:02 +0200)
Eliminating access specifiers and dummy constructors reduces clutter, and
in most cases pure virtual functions prevent instantiation anyway.  Since
these reside in private or protected sections of other classes, risk of
misuse is negligible.

source/collection.h

index be9ae88c491595f925db46e30aeff2daa67deb5f..1f4b5562107a338190cf221355692aaa4c64d04f 100644 (file)
@@ -284,16 +284,13 @@ public:
 class CollectionItemTypeBase
 {
 protected:
 class CollectionItemTypeBase
 {
 protected:
-       class TagBase
+       struct TagBase
        {
        {
-       protected:
-               TagBase() { }
-       public:
                virtual ~TagBase() { }
        };
 
        template<typename T>
                virtual ~TagBase() { }
        };
 
        template<typename T>
-       class Tag: public TagBase
+       struct Tag: TagBase
        { };
 
        std::string kwd;
        { };
 
        std::string kwd;
@@ -327,37 +324,28 @@ template<typename T>
 class CollectionItemType: public CollectionItemTypeBase
 {
 private:
 class CollectionItemType: public CollectionItemTypeBase
 {
 private:
-       class CreatorBase
+       struct CreatorBase
        {
        {
-       protected:
-               CreatorBase() { }
-       public:
                virtual ~CreatorBase() { }
 
                virtual T *create(Collection &, const std::string &) const = 0;
        };
 
        template<typename C>
                virtual ~CreatorBase() { }
 
                virtual T *create(Collection &, const std::string &) const = 0;
        };
 
        template<typename C>
-       class Creator: public CreatorBase
+       struct Creator: CreatorBase
        {
        {
-       public:
                typedef T *(C::*FuncPtr)(const std::string &);
 
                typedef T *(C::*FuncPtr)(const std::string &);
 
-       private:
                FuncPtr func;
 
                FuncPtr func;
 
-       public:
                Creator(FuncPtr f): func(f) { }
 
                virtual T *create(Collection &coll, const std::string &name) const
                { return (static_cast<C &>(coll).*func)(name); }
        };
 
                Creator(FuncPtr f): func(f) { }
 
                virtual T *create(Collection &coll, const std::string &name) const
                { return (static_cast<C &>(coll).*func)(name); }
        };
 
-       class StoreBase
+       struct StoreBase
        {
        {
-       protected:
-               StoreBase() { }
-       public:
                virtual ~StoreBase() { }
 
                virtual void store(Collection &, const std::string &, T *) = 0;
                virtual ~StoreBase() { }
 
                virtual void store(Collection &, const std::string &, T *) = 0;
@@ -366,9 +354,8 @@ private:
        };
 
        template<typename S>
        };
 
        template<typename S>
-       class Store: public StoreBase
+       struct Store: StoreBase
        {
        {
-       public:
                virtual void store(Collection &coll, const std::string &name, T *obj)
                { coll.add(name, static_cast<S *>(obj)); }
 
                virtual void store(Collection &coll, const std::string &name, T *obj)
                { coll.add(name, static_cast<S *>(obj)); }