TimeTableCatalogUtil.hh
1.36 KB
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
/*
* TimeTableCatalogUtil.hh
*
* Created on: 6 août 2013
* Author: CS
*/
#ifndef TIMETABLECATALOGUTIL_HH_
#define TIMETABLECATALOGUTIL_HH_
#include <string>
#include "TimeTable.hh"
/**
* Some convenient method to handle ISO time representations.
*/
namespace TimeTableCatalog {
/**
* Gets ISO time format, with or without msk.
*/
TimeTable::TIME_FORMAT getTimeFormat(const std::string& ptime, int& size);
/**
* Reads an ISO time, automatically detect time format.
*/
double readISOTime(const std::string& ptime);
/**
* Reads an ISO time of the given format.
*/
double readISOTime(const std::string& ptime,
const TimeTable::TIME_FORMAT pformat);
/**
* Writes an ISO time to a given stream qith a given format.
*/
void writeISOTime(const double ptime, const TimeTable::TIME_FORMAT pformat,
std::ostream& pOut);
/**
* Checks a line contains or not a metadata keyword.
*/
bool contains(const std::string & pline, const std::string & pkeyword, const std::string& pprefix=std::string());
/**
* Extracts a metadata value (a metadata is formated as key:value).
*/
void extractvalue(const std::string & pline, std::string& pvalue);
/**
* Splits a string around a given delimiter.
*/
std::vector<std::string> &split(const std::string &s, char delim,
std::vector<std::string> &elems);
} /* namespace TimeTableCatalog */
#endif /* TIMETABLECATALOGUTIL_HH_ */