MI - Fimex
ReplaceStringTimeObject.h
Go to the documentation of this file.
1 /*
2  * Fimex
3  *
4  * (C) Copyright 2008, met.no
5  *
6  * Project Info: https://wiki.met.no/fimex/start
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA.
22  */
23 
24 #ifndef REPLACESTRINGTIMEOBJECT_H_
25 #define REPLACESTRINGTIMEOBJECT_H_
26 
28 #include <ctime>
29 
30 namespace MetNoFimex
31 {
32 
37 {
38  std::time_t myTime;
39  std::string myFormat;
40  std::time_t offset;
41 public:
42  ReplaceStringTimeObject() : myTime(0), myFormat(""), offset(0) {}
46  ReplaceStringTimeObject(std::time_t time, std::string format = "%Y-%m-%d %H:%M:%S%F%Q") : myTime(time), myFormat(format), offset(0) {}
49  virtual std::ostream& put(std::ostream& s) const { s << *this; return s;}
55  virtual void setFormatString(const std::string& format) {myFormat = format;}
60  virtual void setFormatStringAndOptions(const std::string& format, const std::vector<std::string>& options);
61 
62 };
63 
64 }
65 
66 #endif /*REPLACESTRINGTIMEOBJECT_H_*/
virtual void setFormatStringAndOptions(const std::string &format, const std::vector< std::string > &options)
Definition: ReplaceStringObject.h:40
basic_string< char > string
ReplaceStringTimeObject(std::time_t time, std::string format="%Y-%m-%d %H:%M:%S%F%Q")
Definition: ReplaceStringTimeObject.h:46
basic_ostream< char > ostream
Definition: C_CDMReader.h:35
friend std::ostream & operator<<(std::ostream &s, const ReplaceStringTimeObject &rsto)
virtual std::ostream & put(std::ostream &s) const
Definition: ReplaceStringTimeObject.h:49
virtual void setFormatString(const std::string &format)
Definition: ReplaceStringTimeObject.h:55
virtual ~ReplaceStringTimeObject()
Definition: ReplaceStringTimeObject.h:47
ReplaceStringTimeObject()
Definition: ReplaceStringTimeObject.h:42
Definition: ReplaceStringTimeObject.h:36