~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/Misc/SearchAndReplace/Project/Engine/DocumentIterator/IDocumentIterator.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using ICSharpCode.SharpDevelop.Editor.Search;
 
5
using System;
 
6
 
 
7
namespace SearchAndReplace
 
8
{
 
9
        public enum DocumentIteratorType {
 
10
                CurrentDocument,
 
11
                CurrentSelection,
 
12
                AllOpenFiles,
 
13
                WholeProject,
 
14
                WholeSolution,
 
15
                Directory // only used for search in files
 
16
        }
 
17
        
 
18
        /// <summary>
 
19
        /// Represents a bi-directional iterator which could move froward/backward
 
20
        /// in a document queue. Note that after move forward is called
 
21
        /// move backward needn't to function correctly either move forward or move
 
22
        /// backward is called but they're not mixed. After a reset the move operation
 
23
        /// can be switched.
 
24
        /// </summary>
 
25
        public interface IDocumentIterator
 
26
        {
 
27
                /// <value>
 
28
                /// Returns the current ProvidedDocumentInformation. This method
 
29
                /// usually creates a new ProvidedDocumentInformation object which can
 
30
                /// be time consuming
 
31
                /// </value>
 
32
                ProvidedDocumentInformation Current {
 
33
                        get;
 
34
                }
 
35
                
 
36
                /// <value>
 
37
                /// Returns the file name of the current provided document information. This
 
38
                /// property usually is not time consuming
 
39
                /// </value>
 
40
                string CurrentFileName {
 
41
                        get;
 
42
                }
 
43
                
 
44
                /// <remarks>
 
45
                /// Moves the iterator one document forward.
 
46
                /// </remarks>
 
47
                bool MoveForward();
 
48
                
 
49
                /// <remarks>
 
50
                /// Moves the iterator one document backward.
 
51
                /// </remarks>
 
52
                bool MoveBackward();
 
53
                
 
54
                /// <remarks>
 
55
                /// Resets the iterator to the start position.
 
56
                /// </remarks>
 
57
                void Reset();
 
58
        }
 
59
        
 
60
        /// <summary>
 
61
        /// A document iterator which never returns any results.
 
62
        /// </summary>
 
63
        public sealed class DummyDocumentIterator : IDocumentIterator
 
64
        {
 
65
                public ProvidedDocumentInformation Current {
 
66
                        get {
 
67
                                return null;
 
68
                        }
 
69
                }
 
70
                
 
71
                public string CurrentFileName {
 
72
                        get {
 
73
                                return null;
 
74
                        }
 
75
                }
 
76
                
 
77
                public bool MoveForward()
 
78
                {
 
79
                        return false;
 
80
                }
 
81
                
 
82
                public bool MoveBackward()
 
83
                {
 
84
                        return false;
 
85
                }
 
86
                
 
87
                public void Reset()
 
88
                {
 
89
                }
 
90
        }
 
91
}