author | František Kučera <franta-hg@frantovo.cz> |
Sat, 14 Jul 2018 23:24:10 +0200 | |
branch | v_0 |
changeset 7 | 01dd90eeedbb |
parent 5 | 7fe870c3362f |
permissions | -rw-r--r-- |
1 | 1 |
#pragma once |
2 |
||
3 |
#include <string> |
|
3
cdfb91189c9e
split common.h into typedefs.h and format.h
František Kučera <franta-hg@frantovo.cz>
parents:
2
diff
changeset
|
4 |
#include "typedefs.h" |
1 | 5 |
|
6 |
namespace relpipe { |
|
7 |
namespace writer { |
|
8 |
||
9 |
/** |
|
10 |
* This class contains common features that are independent from particular data type (generic/template type) |
|
11 |
*/ |
|
12 |
class DataTypeWriterBase { |
|
13 |
private: |
|
14 |
const integer_t typeId; |
|
15 |
const string_t typeCode; |
|
16 |
public: |
|
17 |
||
18 |
DataTypeWriterBase(const integer_t typeId, const string_t typeCode) : |
|
19 |
typeId(typeId), typeCode(typeCode) { |
|
20 |
} |
|
21 |
||
22 |
virtual ~DataTypeWriterBase() { |
|
23 |
}; |
|
24 |
||
4
e6db28447957
documentation for readString() and writeString() methods
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
25 |
/** |
e6db28447957
documentation for readString() and writeString() methods
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
26 |
* @param output output stream, should be at position where the value is to be written; the stream will not be closed not flushed after writing |
e6db28447957
documentation for readString() and writeString() methods
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
27 |
* @param stringValue write value as given data type (e.g. integer or boolean); stringValue parameter contains given value in string representation of given data type |
e6db28447957
documentation for readString() and writeString() methods
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
28 |
* E.g. integer 123 is passed as a character string "123" |
e6db28447957
documentation for readString() and writeString() methods
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
29 |
* boolean true is passed as a character string "true". |
e6db28447957
documentation for readString() and writeString() methods
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
30 |
* See Relational pipes format specification for details. |
e6db28447957
documentation for readString() and writeString() methods
František Kučera <franta-hg@frantovo.cz>
parents:
3
diff
changeset
|
31 |
*/ |
1 | 32 |
virtual void writeString(std::ostream& output, const string_t &stringValue) = 0; |
33 |
||
34 |
/** |
|
35 |
* @param dataType data type code as defined in DDP L0 |
|
36 |
* @return whether this class supports conversions of this type |
|
37 |
*/ |
|
38 |
virtual bool supports(const integer_t &dataType); |
|
39 |
||
40 |
/** |
|
41 |
* @param dataType data type name as defined in DDP L0 |
|
42 |
* @return whether this class supports conversions of this type |
|
43 |
*/ |
|
44 |
virtual bool supports(const string_t &dataType); |
|
45 |
||
46 |
integer_t getTypeId(); |
|
47 |
||
48 |
string_t getTypeCode(); |
|
49 |
}; |
|
50 |
||
51 |
} |
|
52 |
} |