Objectively 1.0.0
Ultra-lightweight object oriented framework for GNU C.
MutableSet.h
Go to the documentation of this file.
1/*
2 * Objectively: Ultra-lightweight object oriented framework for GNU C.
3 * Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source distribution.
22 */
23
24#pragma once
25
26#include <Objectively/Set.h>
27
33typedef struct MutableSetInterface MutableSetInterface;
34
40struct MutableSet {
41
46
51 MutableSetInterface *interface;
52};
53
57struct MutableSetInterface {
58
62 SetInterface setInterface;
63
71 void (*addObject)(MutableSet *self, const ident obj);
72
80 void (*addObjectsFromArray)(MutableSet *self, const Array *array);
81
89 void (*addObjectsFromSet)(MutableSet *self, const Set *set);
90
99 void (*filter)(MutableSet *self, Predicate predicate, ident data);
100
108 MutableSet *(*init)(MutableSet *self);
109
118 MutableSet *(*initWithCapacity)(MutableSet *self, size_t capacity);
119
126 void (*removeAllObjects)(MutableSet *self);
127
135 void (*removeObject)(MutableSet *self, const ident obj);
136
144 MutableSet *(*set)(void);
145
154 MutableSet *(*setWithCapacity)(size_t capacity);
155};
156
#define obj
static void removeObject(MutableArray *self, const ident obj)
Definition: MutableArray.c:270
static void removeAllObjects(MutableArray *self)
Definition: MutableArray.c:232
static MutableArray * array(void)
Definition: MutableArray.c:153
static void filter(MutableArray *self, Predicate predicate, ident data)
Definition: MutableArray.c:171
static void addObjectsFromArray(MutableArray *self, const Array *array)
Definition: MutableArray.c:140
static void addObject(MutableArray *self, const ident obj)
Definition: MutableArray.c:99
static MutableData * data(void)
Definition: MutableData.c:75
static void addObjectsFromSet(MutableSet *self, const Set *set)
Definition: MutableSet.c:144
static MutableSet * set(void)
Definition: MutableSet.c:259
Immutable sets.
void * ident
The identity type, similar to Objective-C id.
Definition: Types.h:49
#define OBJECTIVELY_EXPORT
Definition: Types.h:36
_Bool(* Predicate)(const ident obj, ident data)
The Predicate function type for filtering Objects.
Definition: Types.h:111
Immutable arrays.
Definition: Array.h:56
The runtime representation of a Class.
Definition: Class.h:95
Mutable sets.
Definition: MutableSet.h:40
MutableSetInterface * interface
The interface.
Definition: MutableSet.h:51
Set set
The superclass.
Definition: MutableSet.h:45
Class * _MutableSet(void)
The MutableSet archetype.
Definition: MutableSet.c:298
Immutable sets.
Definition: Set.h:55