-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLRL_DataStreamToString.h
138 lines (115 loc) · 5.45 KB
/
LRL_DataStreamToString.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#ifndef LRL_DATASTREAMTOSTRING_H
#define LRL_DATASTREAMTOSTRING_H
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "LRL_ToString.h"
#include "StoreResults.h"
#pragma warning( disable : 4505) // unreferenced local function has been removed
static std::string LRL_DataStreamToString(const std::string ch, const char c) {
return std::string(1, c);
}
template<typename T>
std::string LRL_DataStreamToString(const std::string ch, const T& t) {
std::ostringstream ostr;
ostr << t;
return (ostr.str());
}
template <typename TKEY, typename TDATA>
std::string LRL_DataStreamToString(const std::string ch, const StoreResults<TKEY, TDATA>& sr) {
std::ostringstream os;
os << "Contents of StoreResults" << std::endl;
os << "m_title " << sr.GetTitle() << std::endl;
os << "m_nmax " << sr.GetNmax() << std::endl;
os << "m_tree.size() " << sr.GetTreeSize() << std::endl;
os << "m_data.size() " << sr.GetDataSize() << std::endl;
os << "m_itemSeparator " << sr.GetItemSeparator() << std::endl;
os << "m_valueSeparator " << sr.GetValueSeparator() << std::endl;
return os.str();
}
template<typename T1, typename T2>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2) {
return LRL_ToString(t1) + ch + LRL_ToString(t2);
}
template<typename T1, typename T2, typename T3>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3);
}
template<typename T1, typename T2, typename T3, typename T4>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3) + " "
+ LRL_ToString(t4);
}
template<typename T1, typename T2, typename T3, typename T4, typename T5>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3, const T4& t4,
const T5& t5) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3) + " "
+ LRL_ToString(t4) + ch + LRL_ToString(t5);
}
template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3, const T4& t4,
const T5& t5, const T6& t6) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3) + " "
+ LRL_ToString(t4) + ch + LRL_ToString(t5) + ch + LRL_ToString(t6);
}
template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3, const T4& t4,
const T5& t5, const T6& t6, const T7& t7) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3) + " "
+ LRL_ToString(t4) + ch + LRL_ToString(t5) + ch + LRL_ToString(t6) + " "
+ LRL_ToString(t7);
}
template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3, const T4& t4,
const T5& t5, const T6& t6, const T7& t7, const T8& t8) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3) + " "
+ LRL_ToString(t4) + ch + LRL_ToString(t5) + ch + LRL_ToString(t6) + " "
+ LRL_ToString(t7) + ch + LRL_ToString(t8);
}
template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3, const T4& t4,
const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3) + " "
+ LRL_ToString(t4) + ch + LRL_ToString(t5) + ch + LRL_ToString(t6) + " "
+ LRL_ToString(t7) + ch + LRL_ToString(t8) + ch + LRL_ToString(t9);
}
template<typename T1, typename T2, typename T3, typename T4, typename T5,
typename T6, typename T7, typename T8, typename T9, typename T10>
std::string LRL_DataStreamToString(const std::string ch, const T1& t1, const T2& t2, const T3& t3, const T4& t4,
const T5& t5, const T6& t6, const T7& t7, const T8& t8, const T9& t9, const T10& t10) {
return LRL_ToString(t1) + ch + LRL_ToString(t2) + ch + LRL_ToString(t3) + " "
+ LRL_ToString(t4) + ch + LRL_ToString(t5) + ch + LRL_ToString(t6) + " "
+ LRL_ToString(t7) + ch + LRL_ToString(t8) + ch + LRL_ToString(t9)
+ ch + LRL_ToString(t10);
}
template<typename T>
static std::string LRL_DataStreamToString(const std::string ch, const std::vector<T>& t) {
std::string s;
const unsigned long n = (unsigned long)t.size();
for (unsigned long i = 0; i < n; ++i) {
s += LRL_ToString(t[i]) + "\t";
}
return s;
}
template<typename T>
std::string LRL_DataStreamToString(const std::string ch, const std::string& s, const T& t) {
return (s + LRL_ToString(t));
}
template<typename T>
std::string LRL_DataStreamToString(const std::string ch, const T& t, const std::string& s) {
return (LRL_ToString(t) + s);
}
template<typename T>
std::string LRL_DataStreamToString_ToQuotedString(const T& t) {
return ("\"" + LRL_ToString(t) + "\"");
}
#endif // LRL_DATASTREAMTOSTRING_H