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


DateTools.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2014 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 public:
30  virtual ~DateTools();
31 
33 
34 public:
35  enum Resolution {
43  RESOLUTION_MILLISECOND
44  };
45 
46  enum DateOrder {
50  DATEORDER_MDY
51  };
52 
53 protected:
55 
56 public:
61  static String dateToString(const boost::posix_time::ptime& date, Resolution resolution);
62 
67  static String timeToString(int64_t time, Resolution resolution);
68 
73  static int64_t stringToTime(const String& dateString);
74 
78  static boost::posix_time::ptime stringToDate(const String& dateString);
79 
84  static boost::posix_time::ptime round(const boost::posix_time::ptime& date, Resolution resolution);
85 
91  static int64_t round(int64_t time, Resolution resolution);
92 
94  static void setDateOrder(DateTools::DateOrder order);
95 
97  static DateTools::DateOrder getDateOrder(std::locale locale = std::locale());
98 
103  static boost::posix_time::ptime parseDate(const String& dateString, std::locale locale = std::locale());
104 };
105 
106 }
107 
108 #endif
Definition: DateTools.h:49
Definition: DateTools.h:41
Definition: DateTools.h:39
DateOrder
Definition: DateTools.h:46
Definition: DateTools.h:36
Definition: DateTools.h:38
Base class for all Lucene classes.
Definition: LuceneObject.h:31
#define LUCENE_CLASS(Name)
Definition: LuceneObject.h:24
Definition: AbstractAllTermDocs.h:12
Definition: DateTools.h:47
Resolution
Definition: DateTools.h:35
Definition: DateTools.h:48
Definition: DateTools.h:37
Definition: DateTools.h:42
Provides support for converting dates to strings and vice-versa. The strings are structured so that l...
Definition: DateTools.h:28
static DateOrder dateOrder
Definition: DateTools.h:54
Definition: DateTools.h:40

clucene.sourceforge.net