Skip to content

Commit af8eded

Browse files
author
Koen Zwikstra
authored
Merge pull request #1 from firstfloorsoftware/fixes
adds documentation and private ctor to static classes
2 parents c4f7a7a + af6e3fd commit af8eded

File tree

2 files changed

+60
-5
lines changed

2 files changed

+60
-5
lines changed

lib/src/semantic/calendar_enums.dart

Lines changed: 59 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ enum AlarmAction { audio, display, email, procedure }
33

44
/// Names for [AlarmAction] enum values
55
class AlarmActionNames {
6+
/// Private constructor to prevent instantiation.
7+
AlarmActionNames._();
8+
69
/// The name for the audio action.
710
static const audio = 'AUDIO';
811

@@ -32,7 +35,7 @@ class AlarmActionNames {
3235
}
3336
}
3437

35-
// Map between enum and names
38+
/// Extensions for [AlarmAction] enum.
3639
extension AlarmActionExtensions on AlarmAction {
3740
/// Converts the enum value to its corresponding string name.
3841
String toName() => switch (this) {
@@ -43,11 +46,14 @@ extension AlarmActionExtensions on AlarmAction {
4346
};
4447
}
4548

46-
/// Calendar user types.
49+
/// Calendar user types.
4750
enum CalendarUserType { individual, group, resource, room, unknown }
4851

4952
/// Names for [CalendarUserType] enum values
5053
class CalendarUserTypeNames {
54+
/// The private constructor to prevent instantiation.
55+
CalendarUserTypeNames._();
56+
5157
/// The name for the individual user type.
5258
static const individual = 'INDIVIDUAL';
5359

@@ -82,6 +88,7 @@ class CalendarUserTypeNames {
8288
}
8389
}
8490

91+
/// Extensions for [CalendarUserType] enum.
8592
extension CalendarUserTypeExtensions on CalendarUserType {
8693
/// Converts the enum value to its corresponding string name.
8794
String toName() => switch (this) {
@@ -98,6 +105,9 @@ enum Classification { public, private, confidential }
98105

99106
/// Names for [Classification] enum values
100107
class ClassificationNames {
108+
/// The private constructor to prevent instantiation.
109+
ClassificationNames._();
110+
101111
/// The name for the public classification.
102112
static const public = 'PUBLIC';
103113

@@ -122,6 +132,7 @@ class ClassificationNames {
122132
}
123133
}
124134

135+
/// Extensions for [Classification] enum.
125136
extension ClassificationExtensions on Classification {
126137
/// Converts the enum value to its corresponding string name.
127138
String toName() => switch (this) {
@@ -136,6 +147,9 @@ enum EventStatus { tentative, confirmed, cancelled }
136147

137148
/// Names for [EventStatus] enum values
138149
class EventStatusNames {
150+
/// The private constructor to prevent instantiation.
151+
EventStatusNames._();
152+
139153
/// The name for the tentative status.
140154
static const tentative = 'TENTATIVE';
141155

@@ -160,6 +174,7 @@ class EventStatusNames {
160174
}
161175
}
162176

177+
/// Extensions for [EventStatus] enum.
163178
extension EventStatusExtensions on EventStatus {
164179
/// Converts the enum value to its corresponding string name.
165180
String toName() => switch (this) {
@@ -174,6 +189,9 @@ enum FreeBusyType { free, busy, busyUnavailable, busyTentative }
174189

175190
/// Names for [FreeBusyType] enum values
176191
class FreeBusyTypeNames {
192+
/// Private constructor to prevent instantiation.
193+
FreeBusyTypeNames._();
194+
177195
/// The name for the free type.
178196
static const free = 'FREE';
179197

@@ -203,6 +221,7 @@ class FreeBusyTypeNames {
203221
}
204222
}
205223

224+
/// Extensions for [FreeBusyType] enum.
206225
extension FreeBusyTypeExtensions on FreeBusyType {
207226
/// Converts the enum value to its corresponding string name.
208227
String toName() => switch (this) {
@@ -218,6 +237,9 @@ enum JournalStatus { draft, final_, amended }
218237

219238
/// Names for [JournalStatus] enum values
220239
class JournalStatusNames {
240+
/// The private constructor to prevent instantiation.
241+
JournalStatusNames._();
242+
221243
/// The name for the draft status.
222244
static const draft = 'DRAFT';
223245

@@ -242,6 +264,7 @@ class JournalStatusNames {
242264
}
243265
}
244266

267+
/// Extensions for [JournalStatus] enum.
245268
extension JournalStatusExtensions on JournalStatus {
246269
/// Converts the enum value to its corresponding string name.
247270
String toName() => switch (this) {
@@ -263,8 +286,10 @@ enum ParticipationStatus {
263286
}
264287

265288
/// Names for [ParticipationStatus] enum values
266-
267289
class ParticipationStatusNames {
290+
/// The private constructor to prevent instantiation.
291+
ParticipationStatusNames._();
292+
268293
/// The name for the needs-action status.
269294
static const needsAction = 'NEEDS-ACTION';
270295

@@ -309,6 +334,7 @@ class ParticipationStatusNames {
309334
}
310335
}
311336

337+
/// Extensions for [ParticipationStatus] enum.
312338
extension ParticipationStatusExtensions on ParticipationStatus {
313339
/// Converts the enum value to its corresponding string name.
314340
String toName() => switch (this) {
@@ -327,6 +353,9 @@ enum ParticipationRole { chair, reqParticipant, optParticipant, nonParticipant }
327353

328354
/// Names for [ParticipationRole] enum values
329355
class ParticipationRoleNames {
356+
/// The private constructor to prevent instantiation.
357+
ParticipationRoleNames._();
358+
330359
/// The name for the chair role.
331360
static const chair = 'CHAIR';
332361

@@ -356,6 +385,7 @@ class ParticipationRoleNames {
356385
}
357386
}
358387

388+
/// Extensions for [ParticipationRole] enum.
359389
extension ParticipationRoleExtensions on ParticipationRole {
360390
/// Converts the enum value to its corresponding string name.
361391
String toName() => switch (this) {
@@ -378,8 +408,10 @@ enum RecurrenceFrequency {
378408
}
379409

380410
/// Names for [RecurrenceFrequency] enum values
381-
382411
class RecurrenceFrequencyNames {
412+
/// The private constructor to prevent instantiation.
413+
RecurrenceFrequencyNames._();
414+
383415
/// The name for the secondly frequency.
384416
static const secondly = 'SECONDLY';
385417

@@ -424,6 +456,7 @@ class RecurrenceFrequencyNames {
424456
}
425457
}
426458

459+
/// Extensions for [RecurrenceFrequency] enum.
427460
extension RecurrenceFrequencyExtensions on RecurrenceFrequency {
428461
/// Converts the enum value to its corresponding string name.
429462
String toName() => switch (this) {
@@ -440,7 +473,11 @@ extension RecurrenceFrequencyExtensions on RecurrenceFrequency {
440473
/// Relationship types.
441474
enum RelationshipType { child, parent, sibling }
442475

476+
/// Names for [RelationshipType] enum values
443477
class RelationshipTypeNames {
478+
/// The private constructor to prevent instantiation.
479+
RelationshipTypeNames._();
480+
444481
/// The name for the child relationship type.
445482
static const child = 'CHILD';
446483

@@ -465,6 +502,7 @@ class RelationshipTypeNames {
465502
}
466503
}
467504

505+
/// Extensions for [RelationshipType] enum.
468506
extension RelationshipTypeExtensions on RelationshipType {
469507
/// Converts the enum value to its corresponding string name.
470508
String toName() => switch (this) {
@@ -477,7 +515,11 @@ extension RelationshipTypeExtensions on RelationshipType {
477515
/// Time transparency types.
478516
enum TimeTransparency { opaque, transparent }
479517

518+
/// Names for [TimeTransparency] enum values
480519
class TimeTransparencyNames {
520+
/// The private constructor to prevent instantiation.
521+
TimeTransparencyNames._();
522+
481523
/// The name for the opaque transparency.
482524
static const opaque = 'OPAQUE';
483525

@@ -497,6 +539,7 @@ class TimeTransparencyNames {
497539
}
498540
}
499541

542+
/// Extensions for [TimeTransparency] enum.
500543
extension TimeTransparencyExtensions on TimeTransparency {
501544
/// Converts the enum value to its corresponding string name.
502545
String toName() => switch (this) {
@@ -510,6 +553,9 @@ enum TodoStatus { needsAction, completed, inProcess, cancelled }
510553

511554
/// Names for [TodoStatus] enum values
512555
class TodoStatusNames {
556+
/// The private constructor to prevent instantiation.
557+
TodoStatusNames._();
558+
513559
/// The name for the needs-action status.
514560
static const needsAction = 'NEEDS-ACTION';
515561

@@ -539,6 +585,7 @@ class TodoStatusNames {
539585
}
540586
}
541587

588+
/// Extensions for [TodoStatus] enum.
542589
extension TodoStatusExtensions on TodoStatus {
543590
/// Converts the enum value to its corresponding string name.
544591
String toName() => switch (this) {
@@ -569,6 +616,9 @@ enum ValueType {
569616

570617
/// Names for [ValueType] enum values
571618
class ValueTypeNames {
619+
/// The private constructor to prevent instantiation.
620+
ValueTypeNames._();
621+
572622
/// The name for the binary value type.
573623
static const binary = 'BINARY';
574624

@@ -648,6 +698,7 @@ class ValueTypeNames {
648698
}
649699
}
650700

701+
/// Extensions for [ValueType] enum.
651702
extension ValueTypeExtensions on ValueType {
652703
/// Converts the enum value to its corresponding string name.
653704
String toName() => switch (this) {
@@ -673,6 +724,9 @@ enum Weekday { su, mo, tu, we, th, fr, sa }
673724

674725
/// Names for [Weekday] enum values
675726
class WeekdayNames {
727+
/// The private constructor to prevent instantiation.
728+
WeekdayNames._();
729+
676730
/// The name for Sunday.
677731
static const su = 'SU';
678732

@@ -717,6 +771,7 @@ class WeekdayNames {
717771
}
718772
}
719773

774+
/// Extensions for [Weekday] enum.
720775
extension WeekdayExtensions on Weekday {
721776
/// Converts the enum value to its corresponding string name.
722777
String toName() => switch (this) {

lib/src/semantic/calendar_types.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:timezone/standalone.dart' as tz;
55

66
import 'semantic.dart';
77

8-
// Represents an ATTACH property, which can be either a URI or binary data.
8+
/// Represents an ATTACH property, which can be either a URI or binary data.
99
abstract class Attachment {
1010
/// The MIME type of the attachment, defaults to 'application/octet-stream'.
1111
final String fmtType;

0 commit comments

Comments
 (0)