Software and Services, Portable Libraries  2019.Mar.01
A library for managing digital certificates
recur.hpp
Go to the documentation of this file.
1 //
2 // BEGIN_DOUGLAS_MARK_ROYER_COPYRIGHT
3 //
4 // Copyright (C) 1993-2012 Douglas Mark Royer, All Rights Reserved.
5 //
6 // NOTICE:
7 //
8 // THIS SOURCE CODE BELONGS TO DOUGLAS MARK ROYER
9 // THIS CODE IS CONSIDERED A
10 // TRADE SECRET AND IS NOT TO BE DIVULGED OR USED BY PARTIES WHO HAVE
11 // NOT RECEIVED WRITTEN AUTHORIZATION FROM THE OWNER.
12 //
13 //
14 // THIS SOFTWARE AND MANUAL ARE BOTH PROTECTED BY UNITED STATES
15 // COPYRIGHT LAW (TITLE 17 UNITED STATES CODE). UNAUTHORIZED REPRODUCTION
16 // AND/OR SALE MAY RESULT IN IMPRISONMENT OF UP TO ONE YEAR AND FINES
17 // OF UP TO $100,000 (17 USC 506). COPYRIGHT INFRINGERS MAY ALSO
18 // BE SUBJECT TO CIVIL LIABILITY.
19 //
20 // THIS NOTICE AND THE ABOVE COPYRIGHT NOTICE MUST REMAIN IN ALL
21 // COPIES AND ANY DERIVED WORK.
22 //
23 // ALL OF THIS CODE IS ORIGINAL WORK BY THE COPYRIGHT HOLDER.
24 //
25 // THIS DOCUMENT AND THE INFORMATION CONTAINED HEREIN IS
26 // PROVIDED ON AN "AS IS" BASIS AND INET-CONSULTING.COM, INC.
27 // DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
28 // NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
29 // HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
30 // WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
31 // PURPOSE. ANY SERVICE CONTRACT WILL BE UNDER A SEPARATE
32 // LICENSE.
33 //
34 // END_DOUGLAS_MARK_ROYER_COPYRIGHT
35 //
36 
44 #ifndef __DOUGLAS_MARK_ROYER_LIBRARY_ICALENDAR_RECUR_HPP__
45 #define __DOUGLAS_MARK_ROYER_LIBRARY_ICALENDAR_RECUR_HPP__
46 
47 #ifndef EXPORT_ICALENDAR
48 #ifdef BUILDING_LIBRARY_ICALENDAR
49 #define EXPORT_ICALENDAR EXPORT_OUT
50 #else
51 #define EXPORT_ICALENDAR EXPORT_IN
52 #endif
53 #endif
54 
55 #ifdef BUILDING_LIBRARY_ICALENDAR
56 #include "iCalendar.hpp"
57 #include "BaseValueType.hpp"
58 #include "date_time.hpp"
59 #include "property.hpp"
60 #include "text.hpp"
61 #else
62 #include <SaS/iCalendar/iCalendar.hpp>
63 #include <SaS/iCalendar/BaseValueType.hpp>
64 #include <SaS/iCalendar/date_time.hpp>
65 #include <SaS/iCalendar/property.hpp>
66 #include <SaS/iCalendar/text.hpp>
67 #endif
68 
69 using namespace std;
73 
74 namespace SoftwareAndServices
75 {
76  namespace Library
77  {
78  namespace iCalendar
79  {
84  class EXPORT_ICALENDAR recur
85  : public BaseValueType
86  {
87 
88  public:
89 
94  enum frequency {
95  UNKNOWN_t = UnknownToken_t,
96  SECONDLY_t = SECONDLY,
97  MINUTELY_t = MINUTELY,
98  HOURLY_t = HOURLY,
99  DAILY_t = DAILY,
100  WEEKLY_t = WEEKLY,
101  MONTHLY_t = MONTHLY,
102  YEARLY_t = YEARLY
103  };
104 
109  enum weekday {
110  SU_t = SU,
111  MO_t = MO,
112  TU_t = TU,
113  WE_t = WE,
114  TH_t = TH,
115  FR_t = FR,
116  SA_t = SA
117  };
118 
124  recur(frequency freq = UNKNOWN_t);
125 
129  virtual ~recur();
130 
140  bool parse(Parse & in, component *);
141 
151  bool parse(const char * in, component * errors);
152 
158  bool valid() const;
159 
167  virtual bool sprint(String * Results) const;
168 
173  unsigned int maxInstanceExpansion() const;
174 
178  bool isBounded() const;
179 
192  date_time * getNthInstance(const date_time * start, unsigned int nTh) const;
193 
216  propertyVec * getInstanceArray(iCalendar * ical, const date_time * start, unsigned int inst_count = 0) const;
217 
240  propertyVec * getInstanceArray(iCalendar * ical, const date_time * start, const date_time * until = NULL) const;
241 
246  class EXPORT_ICALENDAR weekdaynum
247  {
248 
249  public:
257  weekdaynum(int ordwk, weekday wday);
258 
262  virtual ~weekdaynum();
263 
268 
272  int day;
273  };
274 
284  bool addXValue(const text * name, const text * val);
285 
286 
287  frequency freq;
288  date_time * untilDateTime;
289  date * untilDate;
290  unsigned int count;
291  unsigned int interval;
292  vector<int> * byseclist;
293  vector<int> * bymonlist;
294  vector<int> * byhrlist;
295  vector<weekdaynum*> * bywdaylist;
296  vector<int> * byminlist;
297  vector<int> * bymodaylist;
298  vector<int> * byyrdaylist;
299  vector<int> * bywknolist;
300  vector<int> * bysplist;
301  Tokens_t wkst;
302  value * xValueList; // Of class parameter
303 
304  private:
305 
329  propertyVec * _expandRRule(iCalendar * ical, const date_time * startDate, const date_time * endDate, unsigned int instances, const date_time * fromDate) const;
330 
331 
332  mutable propertyVec * _recurrenceIds;
333  };
334 
339  typedef vector<recur*> recurVec;
340 
341  }
342  }
343 }
344 
345 #endif /*__DOUGLAS_MARK_ROYER_LIBRARY_ICALENDAR_RECUR_HPP__*/
frequency
freq = "SECONDLY" / "MINUTELY" / "HOURLY" / "DAILY" / "WEEKLY" / "MONTHLY" / "YEARLY" ...
Definition: recur.hpp:94
STL namespace.
This class represents any iCalendar TEXT value type.
Definition: text.hpp:76
Generic text parsing routines.
Definition: Parse.hpp:102
An RFC-iCalendar implementation of a DATE-TIME parameter.
Definition: date_time.hpp:90
This is the base class for all values, that includes parameters and properties.
Definition: value.hpp:78
An RFC-iCalendar implementation of NAME property.
Definition: name.hpp:78
EXPORT_ICALENDAR typedef vector< property * > propertyVec
An array of property.
Definition: iCalendar.hpp:425
This is a class that allows:
Definition: String.hpp:114
Copyright Douglas Mark Royer DouglasRoyer@gmail.com.
Definition: Base.hpp:98
The base class for calendar objects.
Definition: iCalendar.hpp:434
The class is an RFC-iCalendar RECUR object.
Definition: recur.hpp:84
All (almost all) values are derived from this base class.
WEEKDAYNUM (51 week, 2nd from last week, ...)
Definition: recur.hpp:246
vector< recur * > recurVec
An array of recur.
Definition: recur.hpp:339
This object represents an RFC-iCalendar DATE object.
Definition: date.hpp:80
Base class for all RFC-iCalendar components.
Definition: component.hpp:98