mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-28 14:45:28 +00:00
Add method [iCalByDayMask asRuleArray]
This method is used to get a JSON representation of a BYDAY attribute of a recurrence rule.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
/* iCalByDayMask.h - this file is part of SOPE
|
||||
*
|
||||
* Copyright (C) 2010 Wolfgang Sourdeau
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Copyright (C) 2010-2015 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -71,6 +69,7 @@ typedef iCalWeekOccurrence iCalWeekOccurrences[7];
|
||||
|
||||
- (NSString *) asRuleString;
|
||||
- (NSString *) asRuleStringWithIntegers;
|
||||
- (NSArray *) asRuleArray;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
/* iCalByDayMask.m - this file is part of SOPE
|
||||
*
|
||||
* Copyright (C) 2010 Inverse inc.
|
||||
*
|
||||
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
* Copyright (C) 2010-2015 Inverse inc.
|
||||
*
|
||||
* This file is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -21,7 +19,9 @@
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
#import "iCalByDayMask.h"
|
||||
|
||||
@@ -344,4 +344,27 @@
|
||||
return s;
|
||||
}
|
||||
|
||||
- (NSArray *) asRuleArray
|
||||
{
|
||||
NSMutableArray *rules;
|
||||
NSMutableDictionary *rule;
|
||||
int i;
|
||||
|
||||
rules = [NSMutableArray array];
|
||||
for (i = 0; i < 7; i++)
|
||||
{
|
||||
if (days[i])
|
||||
{
|
||||
rule = [NSMutableDictionary dictionary];
|
||||
if (days[i] != iCalWeekOccurrenceAll)
|
||||
[rule setObject: [NSNumber numberWithInt: [self _iCalWeekOccurrenceIntValue: days[i]]]
|
||||
forKey: @"occurrence"];
|
||||
[rule setObject: iCalWeekDayString[i]
|
||||
forKey: @"day"];
|
||||
[rules addObject: rule];
|
||||
}
|
||||
}
|
||||
return rules;
|
||||
}
|
||||
|
||||
@end /* iCalByDayMask */
|
||||
|
||||
Reference in New Issue
Block a user