Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <unotools/datetime.hxx>
21 : #include <tools/date.hxx>
22 : #include <tools/time.hxx>
23 : #include <tools/datetime.hxx>
24 :
25 : //.........................................................................
26 : namespace utl
27 : {
28 : //------------------------------------------------------------------
29 0 : void typeConvert(const Date& _rDate, starutil::Date& _rOut)
30 : {
31 0 : _rOut.Day = _rDate.GetDay();
32 0 : _rOut.Month = _rDate.GetMonth();
33 0 : _rOut.Year = _rDate.GetYear();
34 0 : }
35 :
36 : //------------------------------------------------------------------
37 0 : void typeConvert(const starutil::Date& _rDate, Date& _rOut)
38 : {
39 0 : _rOut = Date(_rDate.Day, _rDate.Month, _rDate.Year);
40 0 : }
41 :
42 : //------------------------------------------------------------------
43 0 : void typeConvert(const DateTime& _rDateTime, starutil::DateTime& _rOut)
44 : {
45 0 : _rOut.Year = _rDateTime.GetYear();
46 0 : _rOut.Month = _rDateTime.GetMonth();
47 0 : _rOut.Day = _rDateTime.GetDay();
48 0 : _rOut.Hours = _rDateTime.GetHour();
49 0 : _rOut.Minutes = _rDateTime.GetMin();
50 0 : _rOut.Seconds = _rDateTime.GetSec();
51 0 : _rOut.HundredthSeconds = _rDateTime.Get100Sec();
52 0 : }
53 :
54 : //------------------------------------------------------------------
55 0 : void typeConvert(const starutil::DateTime& _rDateTime, DateTime& _rOut)
56 : {
57 0 : Date aDate(_rDateTime.Day, _rDateTime.Month, _rDateTime.Year);
58 0 : Time aTime(_rDateTime.Hours, _rDateTime.Minutes, _rDateTime.Seconds, _rDateTime.HundredthSeconds);
59 0 : _rOut = DateTime(aDate, aTime);
60 0 : }
61 :
62 : //-------------------------------------------------------------------------
63 0 : sal_Bool operator ==(const starutil::DateTime& _rLeft, const starutil::DateTime& _rRight)
64 : {
65 : return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
66 : ( _rLeft.Seconds == _rRight.Seconds) &&
67 : ( _rLeft.Minutes == _rRight.Minutes) &&
68 : ( _rLeft.Hours == _rRight.Hours) &&
69 : ( _rLeft.Day == _rRight.Day) &&
70 : ( _rLeft.Month == _rRight.Month) &&
71 0 : ( _rLeft.Year == _rRight.Year) ;
72 : }
73 :
74 : //-------------------------------------------------------------------------
75 0 : sal_Bool operator ==(const starutil::Date& _rLeft, const starutil::Date& _rRight)
76 : {
77 : return ( _rLeft.Day == _rRight.Day) &&
78 : ( _rLeft.Month == _rRight.Month) &&
79 0 : ( _rLeft.Year == _rRight.Year) ;
80 : }
81 :
82 : //-------------------------------------------------------------------------
83 0 : sal_Bool operator ==(const starutil::Time& _rLeft, const starutil::Time& _rRight)
84 : {
85 : return ( _rLeft.HundredthSeconds == _rRight.HundredthSeconds) &&
86 : ( _rLeft.Seconds == _rRight.Seconds) &&
87 : ( _rLeft.Minutes == _rRight.Minutes) &&
88 0 : ( _rLeft.Hours == _rRight.Hours) ;
89 : }
90 :
91 : //.........................................................................
92 : } // namespace utl
93 : //.........................................................................
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|