/[projects]/smsdaemon/Value.cpp
ViewVC logotype

Contents of /smsdaemon/Value.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 168 - (show annotations) (download)
Tue Dec 9 21:44:15 2008 UTC (15 years, 5 months ago) by torben
File size: 1221 byte(s)
1) SmsTool, outgoingdir - use .LOCK files
2) SmsTool: make it possible to configure inbox and outgoing directories
3) Value: make some extra data accessor functions


1
2 #include <string>
3 #include <sstream>
4 #include <stdlib.h>
5
6 #include "Value.h"
7
8 Value::Value(std::string const& value)
9 {
10 value_=value;
11 }
12
13 #include <iostream>
14
15 Value::Value(const char* c)
16 {
17 value_=c;
18 }
19
20 Value::Value(double d)
21 {
22 std::stringstream s;
23 s<<d;
24 value_=s.str();
25 }
26
27 Value::Value(int d)
28 {
29 std::stringstream s;
30 s<<d;
31 value_=s.str();
32 }
33
34
35 Value::Value(Value const& other)
36 {
37 value_=other.value_;
38 }
39
40 Value& Value::operator=(Value const& other)
41 {
42 value_=other.value_;
43 return *this;
44 }
45
46 Value& Value::operator=(double d)
47 {
48 std::stringstream s;
49 s << d;
50 value_ = s.str();
51 return *this;
52 }
53
54 Value& Value::operator=(int i)
55 {
56 std::stringstream s;
57 s << i;
58 value_ = s.str();
59 return *this;
60 }
61
62 Value& Value::operator=(std::string const& s)
63 {
64 value_=s;
65 return *this;
66 }
67
68 Value::operator std::string() const
69 {
70 return value_;
71 }
72
73 Value::operator const char*() const
74 {
75 return value_.c_str();
76 }
77
78 Value::operator double() const
79 {
80 return atof(value_.c_str());
81 }
82
83 Value::operator int() const
84 {
85 return atoi(value_.c_str());
86 }
87
88
89
90 std::string Value::StringValue() const
91 {
92 return value_;
93 }
94
95 double Value::DoubleValue() const
96 {
97 return atof(value_.c_str());
98 }
99
100 int Value::IntValue() const
101 {
102 return atoi(value_.c_str());
103 }

  ViewVC Help
Powered by ViewVC 1.1.20