18 #include "key_iterator.h"
27 return new xorn_selection();
28 }
catch (std::bad_alloc
const &) {
39 rsel =
new xorn_selection();
40 }
catch (std::bad_alloc
const &) {
45 }
catch (std::bad_alloc
const &) {
63 if (ob != NULL && rev->obstates.find(ob) == rev->obstates.end())
68 rsel =
new xorn_selection();
69 }
catch (std::bad_alloc
const &) {
73 std::map<xorn_object_t, std::vector<xorn_object_t> >::const_iterator i
74 = rev->children.find(ob);
75 if (i == rev->children.end())
79 copy(i->second.begin(), i->second.end(),
80 inserter(*rsel, rsel->begin()));
81 }
catch (std::bad_alloc
const &) {
94 rsel =
new xorn_selection();
95 }
catch (std::bad_alloc
const &) {
99 copy(iterate_keys(rev->obstates.begin()),
100 iterate_keys(rev->obstates.end()),
101 inserter(*rsel, rsel->begin()));
102 }
catch (std::bad_alloc
const &) {
117 rsel =
new xorn_selection();
118 }
catch (std::bad_alloc
const &) {
122 set_difference(iterate_keys(rev->obstates.begin()),
123 iterate_keys(rev->obstates.end()),
124 sel->begin(), sel->end(),
125 inserter(*rsel, rsel->begin()));
126 }
catch (std::bad_alloc
const &) {
140 rsel =
new xorn_selection(*sel);
141 }
catch (std::bad_alloc
const &) {
146 }
catch (std::bad_alloc
const &) {
160 rsel =
new xorn_selection(*sel);
161 }
catch (std::bad_alloc
const &) {
165 xorn_selection::const_iterator i = rsel->find(ob);
166 if (i != rsel->end())
168 }
catch (std::bad_alloc
const &) {
183 rsel =
new xorn_selection();
184 }
catch (std::bad_alloc
const &) {
188 set_union(sel0->begin(), sel0->end(),
189 sel1->begin(), sel1->end(),
190 inserter(*rsel, rsel->begin()));
191 }
catch (std::bad_alloc
const &) {
206 rsel =
new xorn_selection();
207 }
catch (std::bad_alloc
const &) {
211 set_intersection(sel0->begin(), sel0->end(),
212 sel1->begin(), sel1->end(),
213 inserter(*rsel, rsel->begin()));
214 }
catch (std::bad_alloc
const &) {
229 rsel =
new xorn_selection();
230 }
catch (std::bad_alloc
const &) {
234 set_difference(sel0->begin(), sel0->end(),
235 sel1->begin(), sel1->end(),
236 inserter(*rsel, rsel->begin()));
237 }
catch (std::bad_alloc
const &) {
248 std::map<xorn_object_t, obstate *>::const_iterator i
249 = rev->obstates.begin();
250 std::set<xorn_object_t>::const_iterator j = sel->begin();
252 while (i != rev->obstates.end() && j != sel->end())
255 else if (i->first > *j)
269 return rev->obstates.find(ob) != rev->obstates.end() &&
270 sel->find(ob) != sel->end();
xorn_selection_t xorn_select_excluding(xorn_selection_t sel, xorn_object_t ob)
Create a selection which contains all the objects in an existing selection minus a given object...
struct xorn_revision * xorn_revision_t
Opaque type representing the contents of a file.
bool xorn_selection_is_empty(xorn_revision_t rev, xorn_selection_t sel)
Return whether a selection is empty in a given revision.
xorn_selection_t xorn_select_attached_to(xorn_revision_t rev, xorn_object_t ob)
Create a selection containing all objects in a revision attached to a given object.
xorn_selection_t xorn_select_none()
Create an empty selection.
bool xorn_object_is_selected(xorn_revision_t rev, xorn_selection_t sel, xorn_object_t ob)
Return whether an object exists in a revision and is selected in a selection.
struct xorn_selection * xorn_selection_t
Opaque type representing the identity of a set of objects.
xorn_selection_t xorn_select_all_except(xorn_revision_t rev, xorn_selection_t sel)
Create a selection containing all objects in a revision except those in a given selection.
xorn_selection_t xorn_select_object(xorn_object_t ob)
Create a selection containing a single object.
xorn_selection_t xorn_select_including(xorn_selection_t sel, xorn_object_t ob)
Create a selection which contains all the objects in an existing selection plus a given object...
xorn_selection_t xorn_select_difference(xorn_selection_t sel0, xorn_selection_t sel1)
Create a selection containing the objects contained in one given selection, but not the other...
void xorn_free_selection(xorn_selection_t sel)
Free the memory used for storing a selection.
xorn_selection_t xorn_select_all(xorn_revision_t rev)
Create a selection containing all objects in a revision.
xorn_selection_t xorn_select_union(xorn_selection_t sel0, xorn_selection_t sel1)
Create a selection containing the objects in either given selection.
struct xorn_object * xorn_object_t
Opaque type representing the identity of an object.
xorn_selection_t xorn_select_intersection(xorn_selection_t sel0, xorn_selection_t sel1)
Create a selection containing the objects in both given selections.