-
Notifications
You must be signed in to change notification settings - Fork 8
/
ValueFormatter.hpp
66 lines (54 loc) · 1.7 KB
/
ValueFormatter.hpp
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
////////////////////////////////////////////////////////////////////////////////
//! \file ValueFormatter.hpp
//! \brief The ValueFormatter class declaration.
//! \author Chris Oldwood
// Check for previous inclusion
#ifndef APP_VALUEFORMATTER_HPP
#define APP_VALUEFORMATTER_HPP
#if _MSC_VER > 1000
#pragma once
#endif
////////////////////////////////////////////////////////////////////////////////
//! The formatter used to create the final string to output for a DDE link
//! value.
class ValueFormatter
{
public:
//! Trim whitespace around value.
const static bool TRIM_VALUE = true;
//! Don't trim whitespace around value.
const static bool NO_TRIM_VALUE = false;
//! The default single-item format.
const static tstring DEFAULT_SINGLE_ITEM_FORMAT;
//! The default multi-item format.
const static tstring DEFAULT_MULTI_ITEM_FORMAT;
//! The default timestamp date format.
const static tstring DEFAULT_DATE_FORMAT;
//! The default timestamp time format.
const static tstring DEFAULT_TIME_FORMAT;
public:
//! Full constructor.
ValueFormatter(const tstring& valueFormat,
bool trimValue,
const tstring& dateFormat,
const tstring& timeFormat);
//! Destructor.
~ValueFormatter();
//
// Methods.
//
//! Format the value using the configured style.
tstring format(const tstring& server,
const tstring& topic,
const tstring& item,
const tstring& value) const;
private:
//
// Members.
//
tstring m_valueFormat; //!< The output format.
bool m_trimValue; //!< Trim whitespace around the value.
tstring m_dateFormat; //!< The format for the timestamp date.
tstring m_timeFormat; //!< The format for the timestamp time.
};
#endif // APP_VALUEFORMATTER_HPP