summaryrefslogtreecommitdiffstats
path: root/src/lib/util/csv_file.h
diff options
context:
space:
mode:
authorTomek Mrugalski <tomasz@isc.org>2014-10-21 14:10:06 +0200
committerTomek Mrugalski <tomasz@isc.org>2014-10-21 14:10:06 +0200
commit0984c85a59fd353ddc97c54e9054f053ebab58f7 (patch)
treedb7a4e0920b204aa0b103d14aa364aaf8cc1f211 /src/lib/util/csv_file.h
parent[3555] Lease4,Lease6 now uses HWAddr structure. (diff)
downloadkea-0984c85a59fd353ddc97c54e9054f053ebab58f7.tar.xz
kea-0984c85a59fd353ddc97c54e9054f053ebab58f7.zip
[3555] CSVRow.append() implemented.
Diffstat (limited to 'src/lib/util/csv_file.h')
-rw-r--r--src/lib/util/csv_file.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/util/csv_file.h b/src/lib/util/csv_file.h
index aab9decfde..561d182262 100644
--- a/src/lib/util/csv_file.h
+++ b/src/lib/util/csv_file.h
@@ -178,6 +178,20 @@ public:
writeAt(at, value.c_str());
}
+ /// @brief Appends the value as a new column.
+ ///
+ /// @param value Value to be written.
+ /// @tparam T Type of the value being written.
+ template<typename T>
+ void append(const T value) {
+ try {
+ values_.push_back(boost::lexical_cast<std::string>(value));
+ } catch (const boost::bad_lexical_cast& ex) {
+ isc_throw(CSVFileError, "unable to stringify the value to be "
+ "appended to the CSV file row.");
+ }
+ }
+
/// @brief Replaces the value at specified index.
///
/// This function is used to set values to be rendered using