Main Page Class Hierarchy Alphabetical List Compound List Examples

fieldvalue.h
1/***************************************************************************
2 copyright : (C) 2002-2008 by Stefano Barbato
3 email : stefano@codesink.org
4
5 $Id: fieldvalue.h,v 1.13 2008-10-07 11:06:26 tat Exp $
6 ***************************************************************************/
7#ifndef _MIMETIC_RFC822_FIELDVALUE_H_
8#define _MIMETIC_RFC822_FIELDVALUE_H_
9#include <string>
10#include <mimetic/strutils.h>
11
12 namespace mimetic
13{
14
15
16/// Value of an header field (base class)
17 struct FieldValue
18{
19 FieldValue();
20 virtual ~FieldValue();
21 virtual void set(const std::string& val) = 0;
22 virtual std::string str() const = 0;
23 virtual FieldValue* clone() const = 0;
24 friend std::ostream& operator<<(std::ostream&, const FieldValue&);
25 protected:
26 friend class Rfc822Header;
27 bool typeChecked() const;
28 void typeChecked(bool);
29 private:
30 bool m_typeChecked;
31};
32
33/// Unstructured field value
34 struct StringFieldValue: public FieldValue
35{
36 StringFieldValue();
37 StringFieldValue(const std::string&);
38 void set(const std::string&);
39 std::string str() const;
40 const std::string& ref() const;
41 std::string& ref();
42 protected:
43 FieldValue* clone() const;
44 private:
45 std::string m_value;
46};
47
48}
49
50#endif
51
mimetic
Definition body.h:18