1 /*
2  * ====================================================================
3  * Copyright (c) 2002-2009 The RapidSvn Group.  All rights reserved.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program (in the file GPL.txt.
17  * If not, see <http://www.gnu.org/licenses/>.
18  *
19  * This software consists of voluntary contributions made by many
20  * individuals.  For exact contribution history, see the revision
21  * history and logs, available at http://rapidsvn.tigris.org/.
22  * ====================================================================
23  */
24 
25 #ifndef _SVNCPP_STATUS_SELECTION_HPP_
26 #define _SVNCPP_STATUS_SELECTION_HPP_
27 
28 // svncpp
29 #include "kdevsvncpp/status.hpp"
30 #include "kdevsvncpp/path.hpp"
31 
32 
33 namespace svn
34 {
35   // forward declarations
36   class Pool;
37   class Targets;
38 
39   /**
40    * Container for a vector full of @ref Status
41    */
42   class StatusSel
43   {
44   public:
45     /**
46      * default constructor
47      */
48     StatusSel();
49 
50     /**
51      * Destructor
52      */
53     virtual ~ StatusSel();
54 
55     /**
56      * Copy Constructor
57      *
58      * @param src Source
59      */
60     StatusSel(const StatusSel & src);
61 
62     /**
63      * Assignment operator
64      */
65     StatusSel &
66     operator = (const StatusSel & src);
67 
68     /**
69      * Returns an apr array containing
70      * char *.
71      *
72      * @param pool Pool used for conversion
73      */
74     const apr_array_header_t *
75     array(const Pool & pool) const;
76 
77     /**
78      * Returns a vector of statuses
79      *
80      * @return vector of statuses
81      */
82     const StatusVector &
83     statusVector() const;
84 
85     /**
86      * Returns a vector of paths
87      *
88      * @return vector of paths
89      */
90     const Targets &
91     targets() const;
92 
93     /**
94      * returns the first target in the list
95      * or an empty Path if no entries
96      * are present
97      * @return the first @ref Path in the list
98      */
99     const Path &
100     target() const;
101 
102     /**
103      * @return the number of targets
104      */
105     size_t size() const;
106 
107     /**
108      * reserves @a size
109      */
110     void
111     reserve(size_t size);
112 
113     /**
114      * add and check the next entry
115      *
116      * @param status The @ref Status to add
117      */
118     void
119     push_back(const Status & status);
120 
121     /**
122      * cleans out all entries
123      */
124     void
125     clear();
126 
127     /**
128      * operator to return the vector
129      *
130      * @return vector with targets
131      */
132     operator const PathVector & () const;
133 
134     /** at least one target is a file */
135     bool
136     hasFiles() const;
137 
138     /** at least one target is a directory */
139     bool
140     hasDirs() const;
141 
142     /** at least one target is versioned */
143     bool
144     hasVersioned() const;
145 
146     /** at least one target is unversioned */
147     bool
148     hasUnversioned() const;
149 
150     /** at least one target is a repository URL */
151     bool
152     hasUrl() const;
153 
154     /** at least one target is a local file or dir */
155     bool
156     hasLocal() const;
157 
158   private:
159     struct Data;
160     Data * m;
161   };
162 }
163 
164 #endif
165 /* -----------------------------------------------------------------
166  * local variables:
167  * eval: (load-file "../../rapidsvn-dev.el")
168  * end:
169  */
170