Lucene++ - a full-featured, c++ search engine
API Documentation

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
DateTools.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2011 Alan Wright. All rights reserved.
3 // Distributable under the terms of either the Apache License (Version 2.0)
4 // or the GNU Lesser General Public License.
6
7 #ifndef DATETOOLS_H
8 #define DATETOOLS_H
9
10 #include "LuceneObject.h"
11
12 namespace Lucene
13 {
28 class LPPAPI DateTools : public LuceneObject
29 {
30 public:
31 virtual ~DateTools();
32
33 LUCENE_CLASS(DateTools);
34
35 public:
36 enum Resolution
37 {
38 RESOLUTION_NULL,
39 RESOLUTION_YEAR,
40 RESOLUTION_MONTH,
41 RESOLUTION_DAY,
42 RESOLUTION_HOUR,
43 RESOLUTION_MINUTE,
44 RESOLUTION_SECOND,
45 RESOLUTION_MILLISECOND
46 };
47
48 enum DateOrder
49 {
50 DATEORDER_LOCALE,
51 DATEORDER_YMD,
52 DATEORDER_DMY,
53 DATEORDER_MDY
54 };
55
56 protected:
57 static DateOrder dateOrder;
58
59 public:
64 static String dateToString(const boost::posix_time::ptime& date, Resolution resolution);
65
70 static String timeToString(int64_t time, Resolution resolution);
71
76 static int64_t stringToTime(const String& dateString);
77
81 static boost::posix_time::ptime stringToDate(const String& dateString);
82
87 static boost::posix_time::ptime round(const boost::posix_time::ptime& date, Resolution resolution);
88
94 static int64_t round(int64_t time, Resolution resolution);
95
97 static void setDateOrder(DateTools::DateOrder order);
98
100 static DateTools::DateOrder getDateOrder(std::locale locale = std::locale());
101
106 static boost::posix_time::ptime parseDate(const String& dateString, std::locale locale = std::locale());
107 };
108 }
109
110 #endif

clucene.sourceforge.net