aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/oo/ObjBase.h
blob: 3aa99d7057db0a1f4d592bcc7c7d00983c333b74 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef   oo_ObjBase_H__
#define   oo_ObjBase_H__

#include <cstdio>

#include <typeinfo>
#include <string>

namespace meow{
  class ObjBase{
    protected:
      ObjBase(){ }
    public:
      virtual ~ObjBase(){ }
      //
      virtual bool read (FILE* f, bool bin, unsigned int fg){ return false; }
      virtual bool write(FILE* f, bool bin, unsigned int fg){ return false; }
      //
      virtual ObjBase* create() const{ return NULL; }
      //
      virtual char const* ctype() const{
        static char const* ptr = typeid(*this).name();
        return ptr;
      }
      virtual std::string type() const{
        return std::string(ctype());
      }
      //
      static char const* ctypeBase(){
        static char const* ptr = typeid(ObjBase).name();
        return ptr;
      }
      static std::string typeBase(){
        return std::string(ctypeBase());
      }
  };
}

#endif // oo_ObjBase_H__