home *** CD-ROM | disk | FTP | other *** search
- //
- // _MiscMergeCopyCommand.m -- "copy" merge command implementation
- // Written by Don Yacktman Copyright (c) 1995 by Don Yacktman.
- // Version 1.0. All rights reserved.
- // This notice may not be removed from this source code.
- //
- // This object is included in the MiscKit by permission from the author
- // and its use is governed by the MiscKit license, found in the file
- // "LICENSE.rtf" in the MiscKit distribution. Please refer to that file
- // for a list of all applicable permissions and restrictions.
- //
-
-
- #import <misckit/miscmerge.h>
- #import "_MiscMergeCopyCommand.h"
-
- @implementation _MiscMergeCopyCommand
-
- static MiscString *myKey = nil;
-
- - parseFromString:(MiscString *)aString
- {
- MiscString *escapedStart = [MiscString newWithString:"\\"];
- MiscString *escapedEnd = [MiscString newWithString:"\\"];
-
- if (!myKey) {
- myKey = [MiscString new];
- [myKey setStringValue:"copy"];
- }
- if ([self eatKeyWord:myKey from:aString isOptional:YES])
- [aString trimLeadWhiteSpaces];
- theText = [aString copy];
- [escapedStart addChar:[MiscMergeTemplate startFieldDelimiter]];
- [escapedEnd addChar:[MiscMergeTemplate endFieldDelimiter]];
- [theText replaceEveryOccurrenceOfString:escapedStart
- withChar:[MiscMergeTemplate startFieldDelimiter]
- caseSensitive:NO overlap:NO];
- [theText replaceEveryOccurrenceOfString:escapedEnd
- withChar:[MiscMergeTemplate endFieldDelimiter]
- caseSensitive:NO overlap:NO];
- [escapedEnd free];
- [escapedStart free];
- return self;
- }
-
- - executeForMerge:(MiscMergeEngine *)aMerger
- {
- [aMerger appendToOutput:theText];
- return self;
- }
-
- @end
-