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