Documentation

COCommandGroup class documentation

COCommandGroup : NSObject <COTrackNode, ETCollection, NSCopying>

A command group represents a commit done in an editing context

AuthorsGenerated by qmathe
Declared inCOCommandGroup.h

Overview

See COCommand for a detailed presentation.


Basic Properties

- (NSString *) kind

A localized string describing the command.

    - (COUndoTrack *) parentUndoTrack

    The undo track on which the command was recorded.

    Never returns nil once the command has been recorded, see -[COUndoTrack recordCommand:] .

      - (void) setParentUndoTrack: (COUndoTrack *)parentUndoTrack

      The undo track on which the command was recorded.

      Never returns nil once the command has been recorded, see -[COUndoTrack recordCommand:] .

        - (NSString *) trackName

        The undo track name on which the command was recorded.

          - (void) setTrackName: (NSString *)trackName

          The undo track name on which the command was recorded.

            - (ETUUID *) UUID

            The commit UUID.

            Allows an in-memory instance to be unambiguously mapped to a row in the SQL database behind COUndoTrack. Generated when the command is created, persists across reads and writes to the database, but not preserved across calls to -inverse .

              - (void) setUUID: (ETUUID *)UUID

              The commit UUID.

              Allows an in-memory instance to be unambiguously mapped to a row in the SQL database behind COUndoTrack. Generated when the command is created, persists across reads and writes to the database, but not preserved across calls to -inverse .

                - (NSMutableArray *) contents

                The atomic commands grouped in the receiver for a commit.

                Cannot contain COCommandGroup objects.

                  - (void) setContents: (NSMutableArray *)contents

                  The atomic commands grouped in the receiver for a commit.

                  Cannot contain COCommandGroup objects.

                    - (NSDictionary *) metadata

                    The commit metadata.

                      - (void) setMetadata: (NSDictionary *)metadata

                      The commit metadata.

                        - (COCommitDescriptor *) commitDescriptor

                        The commit descriptor matching the commit identifier in -metadata.

                        COCommand overrides -localizedTypeDescription and -localizedShortDescription to return the equivalent commit descriptor descriptions.

                          - (ETUUID *) parentUUID

                          The UUID of the parent command.

                          The parent command is the command upon on this one is based, it is not necessarily the previous command by -sequenceNumber .

                          An Undo track can contain divergences that look like "branches" in the Undo history. After an undo, any new commit makes the Undo track diverges. At this point, the last undo and the previously created commands that follow it, don't appear in the Undo track unless divergent commands are explicitly shown.

                          The first command in a track is always a non-persistent COEndOfUndoTrackPlaceholderNode instance; its parent UUID is nil. The first persistent commands in a track have a parent UUID equal to [[COEndOfUndoTrackPlaceholderNode sharedInstance] UUID].

                            - (void) setParentUUID: (ETUUID *)parentUUID

                            The UUID of the parent command.

                            The parent command is the command upon on this one is based, it is not necessarily the previous command by -sequenceNumber .

                            An Undo track can contain divergences that look like "branches" in the Undo history. After an undo, any new commit makes the Undo track diverges. At this point, the last undo and the previously created commands that follow it, don't appear in the Undo track unless divergent commands are explicitly shown.

                            The first command in a track is always a non-persistent COEndOfUndoTrackPlaceholderNode instance; its parent UUID is nil. The first persistent commands in a track have a parent UUID equal to [[COEndOfUndoTrackPlaceholderNode sharedInstance] UUID].

                              - (NSDate *) timestamp

                              The commit time.

                                - (void) setTimestamp: (NSDate *)timestamp

                                The commit time.

                                  - (int64_t) sequenceNumber

                                  The commit order in the Undo track store.

                                    - (void) setSequenceNumber: (int64_t)sequenceNumber

                                    The commit order in the Undo track store.

                                      - (id <COTrackNode>) parentNode

                                      The parent command, see -parentUUID .

                                      Returns [COEndOfUndoTrackPlaceholderNode sharedInstance] for the first COCommandGroup(s) on a track.

                                        - (id <COTrackNode>) mergeParentNode

                                        Returns nil.

                                          Applying and Reverting Changes

                                          - (COCommandGroup *) inverse

                                          Returns a command that represents an inverse action.

                                          You can use the inverse to unapply the receiver changes in an editing context.

                                          [[command inverse] inverse] must be equal [command inverse].

                                            - (BOOL) canApplyToContext: (COEditingContext *)aContext

                                            Returns whether the receiver changes can be applied to the editing context.

                                              - (void) applyToContext: (COEditingContext *)aContext

                                              Applies the receiver changes to the editing context.

                                                - (void) addToStoreTransaction: (COStoreTransaction *)txn withRevisionMetadata: (NSDictionary *)metadata assumingEditingContextState: (COEditingContext *)ctx

                                                Applies the receiver changes directly to a store transaction.

                                                  Framework Private

                                                  - (instancetype) initWithSerializedCommand: (COUndoTrackSerializedCommand *)aCommand owner: (COUndoTrack *)anOwner

                                                  Initializes a command group from a serialized represention and with a parent undo track.

                                                    - (COUndoTrackSerializedCommand *) serializedCommand

                                                    Returns a serialized represention.