Ticket #7022: date_generators.cpp

File date_generators.cpp, 915 bytes (added by g.gupta@…, 10 years ago)

Fix for the reported Bug.

Line 
1/* Copyright (c) 2002,2003 CrystalClear Software, Inc.
2 * Use, modification and distribution is subject to the
3 * Boost Software License, Version 1.0. (See accompanying
4 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5 * Author: Jeff Garland, Bart Garst
6 * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $
7 */
8
9
10
11#ifndef BOOST_DATE_TIME_SOURCE
12#define BOOST_DATE_TIME_SOURCE
13#endif
14#include "boost/date_time/date_generators.hpp"
15
16namespace boost {
17namespace date_time {
18
19 const char* const _nth_as_str[] = {"out of range", "first", "second",
20 "third", "fourth", "fifth"};
21
22 //! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5.
23 BOOST_DATE_TIME_DECL const char* nth_as_str(int ele)
24 {
25 if(ele >= 1 && ele <= 5) {
26 return _nth_as_str[ele];
27 }
28 else {
29 return _nth_as_str[0];
30 }
31 }
32
33} } //namespace date_time