]>
Commit | Line | Data |
---|---|---|
e5b573b7 BZ |
1 | --- ./src/Resources.hh 2004-03-02 17:49:51.000000000 +0100 |
2 | +++ /home/sean/tmp/dpep-work.kCLHyF/fbpager-0.1.4/src/Resources.hh 2006-05-29 22:05:44.000000000 +0200 | |
3 | @@ -8,8 +8,10 @@ | |
4 | #include <cstdio> | |
5 | #include <cstring> | |
6 | ||
7 | +namespace FbTk { | |
8 | + | |
9 | template<> | |
10 | -void FbTk::Resource<bool>:: | |
11 | +void Resource<bool>:: | |
12 | setFromString(char const *strval) { | |
13 | if (strcasecmp(strval, "true") == 0 || | |
14 | strcasecmp(strval, "yes") == 0) | |
15 | @@ -19,38 +21,37 @@ | |
16 | } | |
17 | ||
18 | template<> | |
19 | -std::string FbTk::Resource<bool>:: | |
20 | +std::string Resource<bool>:: | |
21 | getString() { | |
22 | return std::string(**this == true ? "true" : "false"); | |
23 | } | |
24 | ||
25 | template <> | |
26 | -void FbTk::Resource<std::string>::setFromString(const char *str) { | |
27 | +void Resource<std::string>::setFromString(const char *str) { | |
28 | *(*this) = (str ? str : ""); | |
29 | } | |
30 | ||
31 | template <> | |
32 | -std::string FbTk::Resource<std::string>::getString() { | |
33 | +std::string Resource<std::string>::getString() { | |
34 | return *(*this); | |
35 | } | |
36 | ||
37 | template <> | |
38 | -void FbTk::Resource<int>::setFromString(const char *str) { | |
39 | +void Resource<int>::setFromString(const char *str) { | |
40 | if (str == 0) | |
41 | return; | |
42 | sscanf(str, "%d", &(*(*this))); | |
43 | } | |
44 | ||
45 | template <> | |
46 | -std::string FbTk::Resource<int>::getString() { | |
47 | +std::string Resource<int>::getString() { | |
48 | char buff[16]; | |
49 | sprintf(buff, "%d", (*(*this))); | |
50 | return std::string(buff); | |
51 | } | |
52 | ||
53 | -namespace FbPager { | |
54 | template <> | |
55 | -void FbTk::Resource<FbPager::Alignment>::setFromString(const char *str) { | |
56 | +void Resource<FbPager::FbPager::Alignment>::setFromString(const char *str) { | |
57 | if (strcmp("TopToBottom", str) == 0) | |
58 | *(*this) = FbPager::FbPager::TOP_TO_BOTTOM; | |
59 | else | |
60 | @@ -58,7 +59,7 @@ | |
61 | } | |
62 | ||
63 | template <> | |
64 | -std::string FbTk::Resource<FbPager::Alignment>::getString() { | |
65 | +std::string Resource<FbPager::FbPager::Alignment>::getString() { | |
66 | switch (*(*this)) { | |
67 | case FbPager::FbPager::LEFT_TO_RIGHT: | |
68 | return "LeftToRight"; | |
69 | @@ -67,6 +68,6 @@ | |
70 | } | |
71 | } | |
72 | ||
73 | -} // end namespace FbPager | |
74 | +} // end namespace FbTk | |
75 | ||
76 | #endif // RESOURCES | |
77 |