~ubuntu-branches/ubuntu/jaunty/viewpdf.app/jaunty

« back to all changes in this revision

Viewing changes to Match.m

  • Committer: Bazaar Package Importer
  • Author(s): Gürkan Sengün
  • Date: 2006-09-16 18:13:34 UTC
  • mfrom: (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20060916181334-10mrzvpblr2jpvu7
Tags: 1:0.2dfsg1-2
* Rebuild against latest libgnustep-gui-dev.
* Added co-maintainers.
* Updated build-depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (C) 2003  Stefan Kleine Stegemann
3
 
 *
4
 
 * This program is free software; you can redistribute it and/or
5
 
 * modify it under the terms of the GNU General Public License
6
 
 * as published by the Free Software Foundation; either version 2
7
 
 * of the License, or (at your option) any later version.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful,
10
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
 * GNU General Public License for more details.
13
 
 *
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 
 */
18
 
 
19
 
#include "Match.h"
20
 
 
21
 
/*
22
 
 * Non-Public methods.
23
 
 */
24
 
@interface Match(Private)
25
 
@end
26
 
 
27
 
 
28
 
/*
29
 
 * Holds the informations about a match of a particular
30
 
 * search.
31
 
 */
32
 
@implementation Match
33
 
 
34
 
/*
35
 
 * Desginated initializer.
36
 
 */
37
 
- (id) initWithPosition: (DocumentPosition*)_position
38
 
                context: (NSString*)_context
39
 
             searchText: (NSString*)_searchText
40
 
{
41
 
   if ((self = [super init]))
42
 
   {
43
 
      position   = nil;
44
 
      context    = nil;
45
 
      searchText = nil;
46
 
      [self setPosition: _position];
47
 
      [self setContext: _context];
48
 
      [self setSearchText: _searchText];
49
 
   }
50
 
   return self;
51
 
}
52
 
 
53
 
 
54
 
/*
55
 
 * Initialize with empty properties.
56
 
 */
57
 
- (id) init
58
 
{
59
 
   return [self initWithPosition: nil context: nil searchText: nil];
60
 
}
61
 
 
62
 
 
63
 
- (void) dealloc
64
 
{
65
 
   [self setPosition: nil];
66
 
   [self setContext: nil];
67
 
   [self setSearchText: nil];
68
 
 
69
 
   [super dealloc];
70
 
}
71
 
 
72
 
 
73
 
/*
74
 
 * Create an (autoreleased) match with the specified
75
 
 * properties.
76
 
 */
77
 
+ (Match*) matchAt: (DocumentPosition*)_position
78
 
           context: (NSString*)_context
79
 
        searchText: (NSString*)_searchText
80
 
{
81
 
   Match* match;
82
 
 
83
 
   match = [[Match alloc] initWithPosition: _position
84
 
                          context: _context
85
 
                          searchText: _searchText];
86
 
 
87
 
   return [match autorelease];
88
 
}
89
 
 
90
 
 
91
 
/*
92
 
 * Returns the position in the document where this match
93
 
 * occured.
94
 
 */
95
 
- (DocumentPosition*) position
96
 
{
97
 
   return position;
98
 
}
99
 
 
100
 
 
101
 
/*
102
 
 * Set the position in the document where this match
103
 
 * occured.
104
 
 */
105
 
- (void) setPosition: (DocumentPosition*)_position
106
 
{
107
 
   [position release];
108
 
   position = _position;
109
 
   [position retain];
110
 
}
111
 
 
112
 
 
113
 
/*
114
 
 * Return the context of this match. This is some text
115
 
 * around the position where this match occured.
116
 
 */
117
 
- (NSString*) context
118
 
{
119
 
   return context;
120
 
}
121
 
 
122
 
 
123
 
/*
124
 
 * Set the context of this match. See context message for
125
 
 * more information.
126
 
 */
127
 
- (void) setContext: (NSString*)_context;
128
 
{
129
 
   [context release];
130
 
   context = [_context copy];
131
 
}
132
 
 
133
 
 
134
 
/*
135
 
 * Get the text that has been searched for when this
136
 
 * match occcured.
137
 
 */
138
 
- (NSString*) searchText
139
 
{
140
 
   return searchText;
141
 
}
142
 
 
143
 
 
144
 
/*
145
 
 * Set the text that has been searched for when this
146
 
 * match occcured.
147
 
 */
148
 
- (void) setSearchText: (NSString*)_searchText
149
 
{
150
 
   [searchText release];
151
 
   searchText = [_searchText copy];
152
 
}
153
 
 
154
 
@end