Format.hGo to the documentation of this file.00001
00002 #ifndef _FORMAT_H
00003 #define _FORMAT_H
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifdef POLARIS_GNU_PRAGMAS
00020 #pragma interface
00021 #endif
00022
00023 #include "ClassNames.h"
00024 #include "BinRep.h"
00025 #include "Definition.h"
00026 #include "String.h"
00027
00028 class Format : public Listable {
00029 friend class FormatDB;
00030
00031 private:
00032 int _value;
00033 String _format;
00034
00035 public:
00036 inline Format(const int value, const char *format);
00037 inline Format(const int value, const BinRep &binstr);
00038 inline Format(const Format &other);
00039 inline Format & operator = (const Format &other);
00040
00041 virtual ~Format();
00042
00043 inline int value() const;
00044 inline const char *format_ref() const;
00045 inline void format(const char *str);
00046
00047 inline virtual Format *clone() const;
00048
00049 virtual void print(ostream &o) const;
00050 virtual Listable *listable_clone() const;
00051
00052 virtual int structures_OK() const;
00053
00054
00055
00056 };
00057
00058 Format *
00059 Format::clone() const
00060 {
00061 return new Format( *this );
00062 }
00063
00064 inline
00065 Format::Format(const Format &other)
00066 {
00067 #ifdef CLASS_INSTANCE_REGISTRY
00068 register_instance(FORMAT, sizeof(Format), this);
00069 #endif
00070
00071 *this = other;
00072 }
00073
00074 inline
00075 Format::Format(const int value, const char *format)
00076 {
00077 #ifdef CLASS_INSTANCE_REGISTRY
00078 register_instance(FORMAT, sizeof(Format), this);
00079 #endif
00080
00081 _value = value;
00082 _format = format;
00083 }
00084
00085 inline
00086 Format::Format(const int value, const BinRep &binstr)
00087 {
00088 #ifdef CLASS_INSTANCE_REGISTRY
00089 register_instance(FORMAT, sizeof(Format), this);
00090 #endif
00091
00092 _value = value;
00093 binstr.to_string(_format);
00094 }
00095
00096 inline Format &
00097 Format::operator = (const Format &other)
00098 {
00099 _value = other._value;
00100 _format = other._format;
00101 return *this;
00102 }
00103
00104 inline int
00105 Format::value() const
00106 {
00107 return _value;
00108 }
00109
00110 inline const char *
00111 Format::format_ref() const
00112 {
00113 return _format;
00114 }
00115
00116 inline void
00117 Format::format(const char *str)
00118 {
00119 _format = str;
00120 }
00121
00122 #endif
00123
|