Blame view

src/TimeTableCatalog/TimeTableCatalogUtil.hh 1.51 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
 * 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.
 */
818d2ea6   Benjamin Renard   Support new time ...
22
TimeTable::TIME_FORMAT getTimeFormat(const std::string& ptime, int& size);
fbe3c2bb   Benjamin Renard   First commit
23
24
25
26
27
28
29
30
31
32
33
34
35

/**
 * 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);

/**
5b387233   Vincent Cephirins   RM7926 - Evol - C...
36
 * Writes an ISO time to a given stream with a given format.
fbe3c2bb   Benjamin Renard   First commit
37
 */
5b387233   Vincent Cephirins   RM7926 - Evol - C...
38
39
40
41
42
43
44
void writeISOTime(const double pTime, const TimeTable::TIME_FORMAT pFormat, std::ostream& pOut);

/**
 * Writes an time into a stream with a given format.
 */
void writeTimeData(const double pTime, const AMDA::OutputFormatTime pFormat, std::ostream& pOut);

fbe3c2bb   Benjamin Renard   First commit
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

/**
 * 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_ */