TimeString.hpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 //==============================================================================
26 //
27 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
40 
41 #ifndef GNSSTK_TIMESTRING_HPP
42 #define GNSSTK_TIMESTRING_HPP
43 
44 #include "TimeTag.hpp"
45 #include "CommonTime.hpp"
46 
47 namespace gnsstk
48 {
50 
51 
127  std::string printTime( const CommonTime& t,
128  const std::string& fmt );
129 
134  template <class TimeTagType>
135  std::string printAs( const CommonTime& t,
136  const std::string& fmt )
137  {
138  TimeTagType ttt;
139  try
140  {
141  ttt.convertFromCommonTime(t);
142  return ttt.printf(fmt);
143  }
144  catch (InvalidRequest& ir)
145  {
146  return ttt.printError(fmt);
147  }
148  }
149 
154  template <class TimeTagType>
155  bool willPrintAs( const std::string& fmt )
156  {
157  TimeTagType ttt;
158  std::string chars = ttt.getPrintChars();
159  for(size_t i=0; i<chars.length(); i++) {
160  if(chars[i] == 'P') continue;
163  return true;
164  }
165  return false;
166  }
167 
170  void scanTime( TimeTag& btime,
171  const std::string& str,
172  const std::string& fmt );
173 
174  void scanTime( CommonTime& t,
175  const std::string& str,
176  const std::string& fmt );
177 
189  void mixedScanTime( CommonTime& t,
190  const std::string& str,
191  const std::string& fmt );
192 
194 
195 } // namespace
196 
197 #endif // GNSSTK_TIMESTRING_HPP
gnsstk::TimeTag::getFormatPrefixInt
static std::string getFormatPrefixInt()
Definition: TimeTag.hpp:152
gnsstk::scanTime
void scanTime(TimeTag &btime, const string &str, const string &fmt)
Definition: TimeString.cpp:93
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::mixedScanTime
void mixedScanTime(CommonTime &t, const string &str, const string &fmt)
Definition: TimeString.cpp:432
gnsstk::printAs
std::string printAs(const CommonTime &t, const std::string &fmt)
Definition: TimeString.hpp:135
gnsstk::TimeTag::getFormatPrefixFloat
static std::string getFormatPrefixFloat()
Definition: TimeTag.hpp:157
gnsstk::CommonTime
Definition: CommonTime.hpp:84
TimeTag.hpp
gnsstk::StringUtils::isLike
bool isLike(const std::string &s, const std::string &aPattern, const char zeroOrMore=' *', const char oneOrMore='+', const char anyChar='.')
Definition: StringUtils.hpp:948
gnsstk::printTime
std::string printTime(const CommonTime &t, const std::string &fmt)
Definition: TimeString.cpp:64
CommonTime.hpp
gnsstk::willPrintAs
bool willPrintAs(const std::string &fmt)
Definition: TimeString.hpp:155


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:42