Skip to content

Commit ba786aa

Browse files
committed
Removed using namespace from noda_time.
(cherry picked from commit b9f159b052c3da26adce83d470990dddb7b68a97) (cherry picked from commit 6f177cfe26fa10350a002abc66448ffe6af6e969)
1 parent 760fbcb commit ba786aa

8 files changed

Lines changed: 66 additions & 76 deletions

File tree

‎cpp/src/dotcpp/dot/noda_time/local_date.cpp‎

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ namespace dot
3838
/// does not accept the date 0001-01-01, we will instead use the Unix epoch
3939
/// 1970-01-01 as default constructed value.
4040
local_date::local_date()
41-
: gdate(1970, 1, 1)
41+
: boost::gregorian::date(1970, 1, 1)
4242
{
4343
}
4444

4545
/// Constructs an instance for the given year, month and day in the ISO calendar.
4646
local_date::local_date(int year, int month, int day)
47-
: gdate(year, month, day)
47+
: boost::gregorian::date(year, month, day)
4848
{}
4949

5050
/// Create from Boost gregorian date.
51-
local_date::local_date(gdate date)
52-
: gdate(date)
51+
local_date::local_date(boost::gregorian::date date)
52+
: boost::gregorian::date(date)
5353
{}
5454

5555
local_date::local_date(const local_date& other)
@@ -165,46 +165,46 @@ namespace dot
165165

166166
local_date local_date::operator+(const period& period) const
167167
{
168-
return static_cast<gdate>(*this) + static_cast<date_duration>(period);
168+
return static_cast<boost::gregorian::date>(*this) + static_cast<boost::gregorian::date_duration>(period);
169169
}
170170

171171
bool local_date::operator==(const local_date& other) const
172172
{
173-
return static_cast<gdate>(*this) == static_cast<gdate>(other);
173+
return static_cast<boost::gregorian::date>(*this) == static_cast<boost::gregorian::date>(other);
174174
}
175175

176176
bool local_date::operator!=(const local_date& other) const
177177
{
178-
return static_cast<gdate>(*this) != static_cast<gdate>(other);
178+
return static_cast<boost::gregorian::date>(*this) != static_cast<boost::gregorian::date>(other);
179179
}
180180

181181
bool local_date::operator>(const local_date& other) const
182182
{
183-
return static_cast<gdate>(*this) > static_cast<gdate>(other);
183+
return static_cast<boost::gregorian::date>(*this) > static_cast<boost::gregorian::date>(other);
184184
}
185185

186186
bool local_date::operator>=(const local_date& other) const
187187
{
188-
return static_cast<gdate>(*this) >= static_cast<gdate>(other);
188+
return static_cast<boost::gregorian::date>(*this) >= static_cast<boost::gregorian::date>(other);
189189
}
190190

191191
bool local_date::operator<(const local_date& other) const
192192
{
193-
return static_cast<gdate>(*this) < static_cast<gdate>(other);
193+
return static_cast<boost::gregorian::date>(*this) < static_cast<boost::gregorian::date>(other);
194194
}
195195

196196
bool local_date::operator<=(const local_date& other) const
197197
{
198-
return static_cast<gdate>(*this) <= static_cast<gdate>(other);
198+
return static_cast<boost::gregorian::date>(*this) <= static_cast<boost::gregorian::date>(other);
199199
}
200200

201201
period local_date::operator-(const local_date& other) const
202202
{
203-
return static_cast<gdate>(*this) - static_cast<gdate>(other);
203+
return static_cast<boost::gregorian::date>(*this) - static_cast<boost::gregorian::date>(other);
204204
}
205205

206206
local_date local_date::operator-(const period& period) const
207207
{
208-
return static_cast<gdate>(*this) - static_cast<date_duration>(period);
208+
return static_cast<boost::gregorian::date>(*this) - static_cast<boost::gregorian::date_duration>(period);
209209
}
210210
}

‎cpp/src/dotcpp/dot/noda_time/local_date.hpp‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ limitations under the License.
2929

3030
namespace dot
3131
{
32-
using gdate = boost::gregorian::date;
33-
3432
class string;
3533
class period;
3634
class local_time;
@@ -39,7 +37,7 @@ namespace dot
3937

4038
/// local_date is an immutable struct representing a date within the calendar,
4139
/// with no reference to a particular time zone or time of day.
42-
class DOT_CLASS local_date : public gdate
40+
class DOT_CLASS local_date : public boost::gregorian::date
4341
{
4442
typedef local_date self;
4543

@@ -56,7 +54,7 @@ namespace dot
5654
local_date(int year, int month, int day);
5755

5856
/// Create from Boost gregorian date.
59-
local_date(gdate date);
57+
local_date(boost::gregorian::date date);
6058

6159
/// Copy constructor.
6260
local_date(const local_date& other);

‎cpp/src/dotcpp/dot/noda_time/local_date_time.cpp‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,28 @@ namespace dot
3939
/// library does not accept the date 0001-01-01, we will instead use the Unix epoch
4040
/// 1970-01-01 as default constructed value.
4141
local_date_time::local_date_time()
42-
: ptime(local_date{ 1970, 1, 1 }, { 0, 0, 0 })
42+
: boost::posix_time::ptime(local_date{ 1970, 1, 1 }, { 0, 0, 0 })
4343
{
4444
}
4545

4646
/// Initializes a new instance of the local_date_time struct using the ISO calendar system.
4747
local_date_time::local_date_time(int year, int month, int day, int hour, int minute)
48-
: ptime(local_date {year, month, day}, {hour, minute, 0})
48+
: boost::posix_time::ptime(local_date {year, month, day}, {hour, minute, 0})
4949
{}
5050

5151
/// Initializes a new instance of the local_date_time struct using the ISO calendar system.
5252
local_date_time::local_date_time(int year, int month, int day, int hour, int minute, int second)
53-
: ptime(local_date {year, month, day}, {hour, minute, second})
53+
: boost::posix_time::ptime(local_date {year, month, day}, {hour, minute, second})
5454
{}
5555

5656
/// Initializes a new instance of the local_date_time struct using the ISO calendar system.
5757
local_date_time::local_date_time(int year, int month, int day, int hour, int minute, int second, int millisecond)
58-
: ptime(local_date {year, month, day}, {hour, minute, second, millisecond * 1000})
58+
: boost::posix_time::ptime(local_date {year, month, day}, {hour, minute, second, millisecond * 1000})
5959
{}
6060

6161
/// Create from Boost posix_time.
62-
local_date_time::local_date_time(const ptime& time)
63-
: ptime(time)
62+
local_date_time::local_date_time(const boost::posix_time::ptime& time)
63+
: boost::posix_time::ptime(time)
6464
{}
6565

6666
local_date_time::local_date_time(const local_date_time& other)
@@ -69,7 +69,7 @@ namespace dot
6969
}
7070

7171
local_date_time::local_date_time(const local_date& date, const local_time& time) :
72-
ptime(date, time)
72+
boost::posix_time::ptime(date, time)
7373
{}
7474

7575
local_date_time::local_date_time(object const& rhs) { *this = rhs.operator local_date_time(); }
@@ -179,46 +179,46 @@ namespace dot
179179

180180
local_date_time local_date_time::operator+(const period& period) const
181181
{
182-
return static_cast<ptime>(*this) + static_cast<time_duration>(period);
182+
return static_cast<boost::posix_time::ptime>(*this) + static_cast<boost::posix_time::time_duration>(period);
183183
}
184184

185185
bool local_date_time::operator==(const local_date_time& other) const
186186
{
187-
return static_cast<ptime>(*this) == static_cast<ptime>(other);
187+
return static_cast<boost::posix_time::ptime>(*this) == static_cast<boost::posix_time::ptime>(other);
188188
}
189189

190190
bool local_date_time::operator!=(const local_date_time& other) const
191191
{
192-
return static_cast<ptime>(*this) != static_cast<ptime>(other);
192+
return static_cast<boost::posix_time::ptime>(*this) != static_cast<boost::posix_time::ptime>(other);
193193
}
194194

195195
bool local_date_time::operator>(const local_date_time& other) const
196196
{
197-
return static_cast<ptime>(*this) > static_cast<ptime>(other);
197+
return static_cast<boost::posix_time::ptime>(*this) > static_cast<boost::posix_time::ptime>(other);
198198
}
199199

200200
bool local_date_time::operator>=(const local_date_time& other) const
201201
{
202-
return static_cast<ptime>(*this) >= static_cast<ptime>(other);
202+
return static_cast<boost::posix_time::ptime>(*this) >= static_cast<boost::posix_time::ptime>(other);
203203
}
204204

205205
bool local_date_time::operator<(const local_date_time& other) const
206206
{
207-
return static_cast<ptime>(*this) < static_cast<ptime>(other);
207+
return static_cast<boost::posix_time::ptime>(*this) < static_cast<boost::posix_time::ptime>(other);
208208
}
209209

210210
bool local_date_time::operator<=(const local_date_time& other) const
211211
{
212-
return static_cast<ptime>(*this) <= static_cast<ptime>(other);
212+
return static_cast<boost::posix_time::ptime>(*this) <= static_cast<boost::posix_time::ptime>(other);
213213
}
214214

215215
period local_date_time::operator-(const local_date_time& other) const
216216
{
217-
return static_cast<ptime>(*this) - static_cast<ptime>(other);
217+
return static_cast<boost::posix_time::ptime>(*this) - static_cast<boost::posix_time::ptime>(other);
218218
}
219219

220220
local_date_time local_date_time::operator-(const period& period) const
221221
{
222-
return static_cast<ptime>(*this) - static_cast<time_duration>(period);
222+
return static_cast<boost::posix_time::ptime>(*this) - static_cast<boost::posix_time::time_duration>(period);
223223
}
224224
}

‎cpp/src/dotcpp/dot/noda_time/local_date_time.hpp‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ limitations under the License.
3131

3232
namespace dot
3333
{
34-
using boost::posix_time::ptime;
35-
3634
class string;
3735
class period;
3836
class object;
@@ -42,10 +40,10 @@ namespace dot
4240
/// because it has no associated time zone: "November 12th 2009 7pm, ISO calendar"
4341
/// occurred at different instants for different people around the world.
4442
///
45-
class DOT_CLASS local_date_time : public ptime
43+
class DOT_CLASS local_date_time : public boost::posix_time::ptime
4644
{
4745
typedef local_date_time self;
48-
typedef ptime base;
46+
typedef boost::posix_time::ptime base;
4947
friend local_date;
5048
friend local_time;
5149

@@ -68,7 +66,7 @@ namespace dot
6866
local_date_time(int year, int month, int day, int hour, int minute, int second, int millisecond);
6967

7068
/// Create from Boost posix_time.
71-
local_date_time(const ptime& time);
69+
local_date_time(const boost::posix_time::ptime& time);
7270

7371
/// Create from object.
7472
local_date_time(object const& rhs);

‎cpp/src/dotcpp/dot/noda_time/local_time.cpp‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,32 +36,32 @@ namespace dot
3636
/// constructed value corresponds to 0001-01-01 00:00:00. We will
3737
/// replicate this behavior here.
3838
local_time::local_time()
39-
: ptime(boost::gregorian::date(1970, 1, 1), time_duration{ 0, 0, 0 })
39+
: boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1), boost::posix_time::time_duration{ 0, 0, 0 })
4040
{}
4141

4242
/// Creates a local time at the given hour and minute, with second, millisecond-of-second and tick-of-millisecond values of zero.
4343
local_time::local_time(int hour, int minute)
44-
: ptime(boost::gregorian::date(1970, 1, 1), time_duration {hour, minute, 0})
44+
: boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1), boost::posix_time::time_duration {hour, minute, 0})
4545
{}
4646

4747
/// Creates a local time at the given hour, minute and second, with millisecond-of-second and tick-of-millisecond values of zero.
4848
local_time::local_time(int hour, int minute, int second)
49-
: ptime(boost::gregorian::date(1970, 1, 1), time_duration {hour, minute, second})
49+
: boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1), boost::posix_time::time_duration {hour, minute, second})
5050
{}
5151

5252
/// Creates a local time at the given hour, minute, second and millisecond, with a tick-of-millisecond value of zero.
5353
local_time::local_time(int hour, int minute, int second, int millisecond)
54-
: ptime(boost::gregorian::date(1970, 1, 1), time_duration {hour, minute, second, millisecond * 1000})
54+
: boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1), boost::posix_time::time_duration {hour, minute, second, millisecond * 1000})
5555
{}
5656

5757
/// Create from Boost time_duration.
58-
local_time::local_time(const time_duration& time)
59-
: ptime(boost::gregorian::date(1970, 1, 1), time)
58+
local_time::local_time(const boost::posix_time::time_duration& time)
59+
: boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1), time)
6060
{}
6161

6262
/// Create from Boost posix_time.
63-
local_time::local_time(const ptime& time)
64-
: ptime(time)
63+
local_time::local_time(const boost::posix_time::ptime& time)
64+
: boost::posix_time::ptime(time)
6565
{}
6666

6767
local_time::local_time(object const& rhs) { *this = rhs.operator local_time(); }
@@ -151,7 +151,7 @@ namespace dot
151151

152152
local_time local_time::operator+(const period& period) const
153153
{
154-
return static_cast<ptime>(*this) + static_cast<time_duration>(period);
154+
return static_cast<boost::posix_time::ptime>(*this) + static_cast<boost::posix_time::time_duration>(period);
155155
}
156156

157157
bool local_time::operator==(const local_time& other) const
@@ -186,15 +186,15 @@ namespace dot
186186

187187
period local_time::operator-(const local_time& other) const
188188
{
189-
return static_cast<ptime>(*this) - static_cast<ptime>(other);
189+
return static_cast<boost::posix_time::ptime>(*this) - static_cast<boost::posix_time::ptime>(other);
190190
}
191191

192192
local_time local_time::operator-(const period& period) const
193193
{
194-
return static_cast<ptime>(*this) - static_cast<time_duration>(period);
194+
return static_cast<boost::posix_time::ptime>(*this) - static_cast<boost::posix_time::time_duration>(period);
195195
}
196196

197-
local_time::operator time_duration() const
197+
local_time::operator boost::posix_time::time_duration() const
198198
{
199199
return time_of_day();
200200
}

‎cpp/src/dotcpp/dot/noda_time/local_time.hpp‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ limitations under the License.
2929

3030
namespace dot
3131
{
32-
using boost::posix_time::ptime;
33-
using boost::posix_time::time_duration;
34-
3532
class string;
3633
class period;
3734
class local_date;
@@ -40,7 +37,7 @@ namespace dot
4037

4138
/// local_time is an immutable struct representing a time of day,
4239
/// with no reference to a particular calendar, time zone or date.
43-
class DOT_CLASS local_time : public ptime
40+
class DOT_CLASS local_time : public boost::posix_time::ptime
4441
{
4542
typedef local_time self;
4643

@@ -62,10 +59,10 @@ namespace dot
6259
local_time(int hour, int minute, int second, int millisecond);
6360

6461
/// Create from Boost time_duration.
65-
local_time(const time_duration& time);
62+
local_time(const boost::posix_time::time_duration& time);
6663

6764
/// Create from Boost posix_time.
68-
local_time(const ptime& time);
65+
local_time(const boost::posix_time::ptime& time);
6966

7067
/// Create from object.
7168
local_time(object const& rhs);
@@ -162,6 +159,6 @@ namespace dot
162159
local_time operator-(const period& period) const;
163160

164161
public:
165-
operator time_duration() const;
162+
operator boost::posix_time::time_duration() const;
166163
};
167164
}

0 commit comments

Comments
 (0)