21 #ifndef FXOBJECTLIST_H 22 #define FXOBJECTLIST_H 59 FXival
no()
const {
return *((FXival*)(ptr-1)); }
62 FXbool no(FXival num);
66 FXObject*
const& operator[](FXival i)
const {
return ptr[i]; }
70 FXObject*
const& at(FXival i)
const {
return ptr[i]; }
74 FXObject*
const& head()
const {
return ptr[0]; }
78 FXObject*
const& tail()
const {
return ptr[no()-1]; }
82 FXObject *
const * data()
const {
return ptr; }
85 FXival find(
const FXObject *
object,FXival pos=0)
const;
88 FXival rfind(
const FXObject *
object,FXival pos=2147483647)
const;
91 FXbool assign(FXObject*
object);
94 FXbool assign(FXObject*
object,FXival n);
97 FXbool assign(FXObject** objects,FXival n);
100 FXbool assign(
const FXObjectList& objects);
103 FXbool insert(FXival pos,FXObject*
object);
106 FXbool insert(FXival pos,FXObject*
object,FXival n);
109 FXbool insert(FXival pos,FXObject** objects,FXival n);
112 FXbool insert(FXival pos,
const FXObjectList& objects);
115 FXbool prepend(FXObject*
object);
118 FXbool prepend(FXObject*
object,FXival n);
121 FXbool prepend(FXObject** objects,FXival n);
124 FXbool prepend(
const FXObjectList& objects);
127 FXbool append(FXObject*
object);
130 FXbool append(FXObject*
object,FXival n);
133 FXbool append(FXObject** objects,FXival n);
136 FXbool append(
const FXObjectList& objects);
139 FXbool replace(FXival pos,FXObject*
object);
142 FXbool replace(FXival pos,FXival m,FXObject*
object,FXival n);
145 FXbool replace(FXival pos,FXival m,FXObject** objects,FXival n);
148 FXbool replace(FXival pos,FXival m,
const FXObjectList& objects);
151 FXbool erase(FXival pos);
154 FXbool erase(FXival pos,FXival n);
157 FXbool
remove(
const FXObject* object);
160 FXbool push(FXObject*
object);
169 void save(FXStream& store)
const;
172 void load(FXStream& store);
180 template<
typename TYPE>
206 TYPE*&
operator[](FXival i){
return reinterpret_cast<TYPE*&
>(ptr[i]); }
207 TYPE *
const&
operator[](FXival i)
const {
return reinterpret_cast<TYPE*const&
>(ptr[i]); }
210 TYPE*&
at(FXival i){
return reinterpret_cast<TYPE*&
>(ptr[i]); }
211 TYPE *
const&
at(FXival i)
const {
return reinterpret_cast<TYPE*const&
>(ptr[i]); }
214 TYPE*&
head(){
return reinterpret_cast<TYPE*&
>(ptr[0]); }
215 TYPE*
const&
head()
const {
return reinterpret_cast<TYPE*const&
>(ptr[0]); }
218 TYPE*&
tail(){
return reinterpret_cast<TYPE*&
>(ptr[
no()-1]); }
219 TYPE*
const&
tail()
const {
return reinterpret_cast<TYPE* const&
>(ptr[
no()-1]); }
222 TYPE**
data(){
return reinterpret_cast<TYPE**
>(ptr); }
223 TYPE *
const *
data()
const {
return reinterpret_cast<TYPE*const*
>(ptr); }
FXObjectListOf(TYPE *object)
Construct and init with single object.
Definition: FXObjectList.h:191
FXbool remove(const FXObject *object)
Remove object.
TYPE *& operator[](FXival i)
Indexing operator.
Definition: FXObjectList.h:206
FXbool prepend(TYPE *object, FXival n)
Prepend n copies of object.
Definition: FXObjectList.h:259
FXbool replace(FXival pos, TYPE *object)
Replace object at position by given object.
Definition: FXObjectList.h:280
FXbool append(FXObject *object)
Append object.
FXObject *& at(FXival i)
Indexing operator.
Definition: FXObjectList.h:69
FXival find(TYPE *object, FXival pos=0) const
Find object in list, searching forward; return position or -1.
Definition: FXObjectList.h:226
FXival rfind(const FXObject *object, FXival pos=2147483647) const
Find object in list, searching backward; return position or -1.
FXObject *& operator[](FXival i)
Indexing operator.
Definition: FXObjectList.h:65
FXival find(const FXObject *object, FXival pos=0) const
Find object in list, searching forward; return position or -1.
FXObjectList & adopt(FXObjectList &other)
Adopt objects from other, leaving other empty.
TYPE *& at(FXival i)
Indexing operator.
Definition: FXObjectList.h:210
FXival rfind(TYPE *object, FXival pos=2147483647) const
Find object in list, searching backward; return position or -1.
Definition: FXObjectList.h:229
TYPE ** data()
Access to content array.
Definition: FXObjectList.h:222
FXbool append(TYPE *object, FXival n)
Append n copies of object.
Definition: FXObjectList.h:271
List of pointers to objects.
Definition: FXObjectList.h:32
FXbool insert(FXival pos, TYPE *object)
Insert object at certain position.
Definition: FXObjectList.h:244
FXbool prepend(TYPE *object)
Prepend object.
Definition: FXObjectList.h:256
FXObjectListOf< TYPE > & adopt(FXObjectListOf< TYPE > &src)
Adopt objects from src, leaving src empty.
Definition: FXObjectList.h:203
FXbool insert(FXival pos, TYPE **objects, FXival n)
Insert n objects at specified position.
Definition: FXObjectList.h:250
FXObjectListOf(TYPE **objects, FXival n)
Construct and init with list of objects.
Definition: FXObjectList.h:197
FXbool insert(FXival pos, FXObject *object)
Insert object at certain position.
FXbool prepend(TYPE **objects, FXival n)
Prepend n objects.
Definition: FXObjectList.h:262
FXbool replace(FXival pos, FXival m, TYPE **objects, FXival n)
Replaces the m objects at pos with n objects.
Definition: FXObjectList.h:286
FXbool assign(const FXObjectListOf< TYPE > &objects)
Assign objects to list.
Definition: FXObjectList.h:241
FXbool replace(FXival pos, FXival m, const FXObjectListOf< TYPE > &objects)
Replace the m objects at pos with objects.
Definition: FXObjectList.h:289
FXbool assign(TYPE *object)
Assign object to list.
Definition: FXObjectList.h:232
Definition: FX4Splitter.h:28
FXbool prepend(FXObject *object)
Prepend object.
FXival no() const
Return number of objects.
Definition: FXObjectList.h:59
FXObject *& head()
First element in list.
Definition: FXObjectList.h:73
TYPE *& head()
First element in list.
Definition: FXObjectList.h:214
FXbool insert(FXival pos, TYPE *object, FXival n)
Insert n copies of object at specified position.
Definition: FXObjectList.h:247
FXObject ** data()
Access to content array.
Definition: FXObjectList.h:81
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
FXbool insert(FXival pos, const FXObjectListOf< TYPE > &objects)
Insert objects at specified position.
Definition: FXObjectList.h:253
FXbool assign(TYPE **objects, FXival n)
Assign n objects to list.
Definition: FXObjectList.h:238
FXbool append(TYPE **objects, FXival n)
Append n objects.
Definition: FXObjectList.h:274
FXbool append(const FXObjectListOf< TYPE > &objects)
Append objects.
Definition: FXObjectList.h:277
FXbool replace(FXival pos, FXival m, TYPE *object, FXival n)
Replaces the m objects at pos with n copies of object.
Definition: FXObjectList.h:283
FXbool push(TYPE *object)
Push object to end.
Definition: FXObjectList.h:295
FXbool replace(FXival pos, FXObject *object)
Replace object at position by given object.
FXbool push(FXObject *object)
Push object to end.
FXObjectListOf< TYPE > & operator=(const FXObjectListOf< TYPE > &orig)
Assignment operator.
Definition: FXObjectList.h:200
FXObjectListOf()
Default constructor.
Definition: FXObjectList.h:185
FXObject *& tail()
Last element in list.
Definition: FXObjectList.h:77
FXbool append(TYPE *object)
Append object.
Definition: FXObjectList.h:268
FXObjectList & operator=(const FXObjectList &other)
Assignment operator.
List to pointers to objects of TYPE.
Definition: FXObjectList.h:181
TYPE *& tail()
Last element in list.
Definition: FXObjectList.h:218
FXObjectListOf(TYPE *object, FXival n)
Construct and init with n copies of object.
Definition: FXObjectList.h:194
FXbool prepend(const FXObjectListOf< TYPE > &objects)
Prepend objects.
Definition: FXObjectList.h:265
FXbool assign(FXObject *object)
Assign object to list.
FXbool assign(TYPE *object, FXival n)
Assign n copies of object to list.
Definition: FXObjectList.h:235
FXObjectListOf(const FXObjectListOf< TYPE > &src)
Copy constructor.
Definition: FXObjectList.h:188