1 /* $Id: Date_std.hpp 394217 2013-04-01 18:37:02Z ucko $
2  * ===========================================================================
3  *
4  *                            PUBLIC DOMAIN NOTICE
5  *               National Center for Biotechnology Information
6  *
7  *  This software/database is a "United States Government Work" under the
8  *  terms of the United States Copyright Act.  It was written as part of
9  *  the author's official duties as a United States Government employee and
10  *  thus cannot be copyrighted.  This software/database is freely available
11  *  to the public for use. The National Library of Medicine and the U.S.
12  *  Government have not placed any restriction on its use or reproduction.
13  *
14  *  Although all reasonable efforts have been taken to ensure the accuracy
15  *  and reliability of the software and data, the NLM and the U.S.
16  *  Government do not and cannot warrant the performance or results that
17  *  may be obtained by using this software or data. The NLM and the U.S.
18  *  Government disclaim all warranties, express or implied, including
19  *  warranties of performance, merchantability or fitness for any particular
20  *  purpose.
21  *
22  *  Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Author:  Aaron Ucko, NCBI
27  *
28  * File Description:
29  *   Useful member functions for standard dates: comparison and formatting
30  *
31  * Remark:
32  *   This code was originally generated by application DATATOOL
33  *   using specifications from the ASN data definition file
34  *   'general.asn'.
35  */
36 
37 #ifndef OBJECTS_GENERAL_DATE_STD_HPP
38 #define OBJECTS_GENERAL_DATE_STD_HPP
39 
40 
41 // generated includes
42 #include <objects/general/Date_std_.hpp>
43 
44 #include <objects/general/Date.hpp>
45 
46 // generated classes
47 
48 BEGIN_NCBI_SCOPE
49 
50 BEGIN_objects_SCOPE // namespace ncbi::objects::
51 
52 class NCBI_GENERAL_EXPORT CDate_std : public CDate_std_Base
53 {
54     typedef CDate_std_Base Tparent;
55 public:
56     // constructors
57     CDate_std(void);
58     CDate_std(const CTime& time,
59               CDate::EPrecision prec = CDate::ePrecision_second);
60     explicit CDate_std(time_t time,
61                        CDate::EPrecision prec = CDate::ePrecision_second);
62 
63     // destructor
64     ~CDate_std(void);
65 
66     // conversion to/from CTime
67     void  SetToTime(const CTime& time,
68                     CDate::EPrecision prec = CDate::ePrecision_second);
69     CTime AsCTime  (CTime::ETimeZone tz = CTime::eLocal) const;
70 
71     /// Indicate how *this relates to another date.
72     CDate::ECompare Compare(const CDate_std& date) const;
73 
74     /// Append a custom string representation of the date to the label.
75     ///
76     /// @sa CDate::GetDate
77     void GetDate(string* label, const string& format) const;
78 
79 private:
80     // Prohibit copy constructor and assignment operator
81     CDate_std(const CDate_std& value);
82     CDate_std& operator=(const CDate_std& value);
83 
84 };
85 
86 
87 
88 /////////////////// CDate_std inline methods
89 
90 // constructor
91 inline
CDate_std(void)92 CDate_std::CDate_std(void)
93 {
94 }
95 
96 inline
CDate_std(const CTime & time,CDate::EPrecision prec)97 CDate_std::CDate_std(const CTime& time, CDate::EPrecision prec)
98 {
99     SetToTime(time, prec);
100 }
101 
102 inline
CDate_std(time_t time,CDate::EPrecision prec)103 CDate_std::CDate_std(time_t time, CDate::EPrecision prec)
104 {
105     SetToTime(CTime(time), prec);
106 }
107 
108 
109 /////////////////// end of CDate_std inline methods
110 
111 
112 END_objects_SCOPE // namespace ncbi::objects::
113 
114 END_NCBI_SCOPE
115 
116 #endif // OBJECTS_GENERAL_DATE_STD_HPP
117 /* Original file checksum: lines: 90, chars: 2388, CRC32: 3888bc05 */
118