/[debian]/mimetic/branches/upstream/current/mimetic/contentid.cxx
ViewVC logotype

Contents of /mimetic/branches/upstream/current/mimetic/contentid.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 128 - (show annotations)
Sat Feb 25 16:49:20 2006 UTC (15 years, 5 months ago) by gregoa
File size: 1690 byte(s)
[svn-inject] Installing original source of mimetic
1 /***************************************************************************
2 copyright : (C) 2002-2005 by Stefano Barbato
3 email : stefano@codesink.org
4
5 $Id: contentid.cxx,v 1.2 2005/02/23 10:26:14 tat Exp $
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16 #include <mimetic/contentid.h>
17 #include <ctime>
18
19 namespace mimetic
20 {
21 unsigned int ContentId::ms_sequence_number = 0;
22
23 const char ContentId::label[] = "Content-ID";
24
25 ContentId::ContentId()
26 {
27 std::string host = gethostname();
28 if(!host.length())
29 host = "unknown";
30 m_cid = "c" + utils::int2str(time(0)) + "." + utils::int2str(getpid()) +
31 "." + utils::int2str(++ms_sequence_number) + "@" + host;
32 }
33
34 ContentId::ContentId(const char* cstr)
35 :m_cid(cstr)
36 {
37 }
38
39
40 ContentId::ContentId(const std::string& value)
41 :m_cid(value)
42 {
43 }
44
45 void ContentId::set(const std::string& value)
46 {
47 m_cid = value;
48 }
49
50 std::string ContentId::str() const
51 {
52 return m_cid;
53 }
54
55 FieldValue* ContentId::clone() const
56 {
57 return new ContentId(*this);
58 }
59
60 }

  ViewVC Help
Powered by ViewVC 1.1.26