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


 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 
34 
35  public:
37  {
45  RESOLUTION_MILLISECOND
46  };
47 
48  enum DateOrder
49  {
53  DATEORDER_MDY
54  };
55 
56  protected:
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