00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _MIMETIC_RFC822_FIELDVALUE_H_
00017 #define _MIMETIC_RFC822_FIELDVALUE_H_
00018 #include <string>
00019 #include <mimetic/strutils.h>
00020
00021 namespace mimetic
00022 {
00023
00024
00025
00026 struct FieldValue
00027 {
00028 FieldValue();
00029 virtual ~FieldValue();
00030 virtual void set(const std::string& val) = 0;
00031 virtual std::string str() const = 0;
00032 virtual FieldValue* clone() const = 0;
00033 friend std::ostream& operator<<(std::ostream&, const FieldValue&);
00034 protected:
00035 friend class Rfc822Header;
00036 bool typeChecked() const;
00037 void typeChecked(bool);
00038 private:
00039 bool m_typeChecked;
00040 };
00041
00042
00043 struct StringFieldValue: public FieldValue
00044 {
00045 StringFieldValue();
00046 StringFieldValue(const std::string&);
00047 void set(const std::string&);
00048 std::string str() const;
00049 const std::string& ref() const;
00050 std::string& ref();
00051 protected:
00052 FieldValue* clone() const;
00053 private:
00054 std::string m_value;
00055 };
00056
00057 }
00058
00059 #endif
00060