/usr/include/falcon/genericlist.h is in falconpl-dev 0.9.6.9-git20120606-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | /*
FALCON - The Falcon Programming Language.
FILE: genlist.h
Generic list - a list holding generic values.
-------------------------------------------------------------------
Author: Giancarlo Niccolai
Begin: dom ott 15 2006
-------------------------------------------------------------------
(C) Copyright 2004: the FALCON developers (see list in AUTHORS file)
See LICENSE file for licensing details.
*/
/** \file
a list holding generic values.
*/
#ifndef flc_genlist_H
#define flc_genlist_H
#include <falcon/setup.h>
#include <falcon/types.h>
#include <falcon/traits.h>
#include <falcon/basealloc.h>
namespace Falcon {
/** Generic list element.
*/
class FALCON_DYN_CLASS ListElement: public BaseAlloc
{
ListElement *m_next;
ListElement *m_previous;
union {
const void *m_data;
uint32 m_iData;
} dt;
ListElement( const void *data )
{
dt.m_data = data;
}
ListElement( uint32 d )
{
dt.m_iData = d;
}
void data( const void *data ) { dt.m_data = data; }
void prev( ListElement *elem ) { m_previous = elem; }
void next( ListElement *elem ) { m_next = elem; }
friend class List;
public:
const void *data() const { return dt.m_data; }
uint32 iData() const { return dt.m_iData; }
void iData( uint32 d ) { dt.m_iData = d; }
ListElement *next() const { return m_next; }
ListElement *prev() const { return m_previous; }
};
/** Generic list.
*/
class FALCON_DYN_CLASS List: public BaseAlloc
{
ListElement *m_head;
ListElement *m_tail;
uint32 m_size;
void (*m_deletor)( void *);
friend class ListTraits;
public:
List():
m_head(0),
m_tail(0),
m_size(0),
m_deletor(0)
{
}
List( void (*deletor)(void *) ):
m_head(0),
m_tail(0),
m_size(0),
m_deletor( deletor )
{
}
~List()
{
clear();
}
ListElement *begin() const { return m_head; }
ListElement *end() const { return m_tail; }
const void *front() const { return m_head->data(); }
const void *back() const { return m_tail->data(); }
bool empty() const { return m_head == 0; }
void pushFront( const void *data );
void pushBack( const void *data );
void pushFront( uint32 data );
void pushBack( uint32 data );
void popFront();
void popBack();
void insertAfter( ListElement *position, const void *data );
void insertBefore( ListElement *position, const void *data );
ListElement *erase( ListElement *position );
uint32 size() const {return m_size;}
void clear();
void deletor( void (*del)( void * ) ) { m_deletor = del; }
};
class ListTraits: public ElementTraits
{
public:
virtual ~ListTraits() {}
virtual uint32 memSize() const;
virtual void init( void *itemZone ) const;
virtual void copy( void *targetZone, const void *sourceZone ) const;
virtual int compare( const void *first, const void *second ) const;
virtual void destroy( void *item ) const;
virtual bool owning() const;
};
namespace traits
{
extern FALCON_DYN_SYM ListTraits &t_List();
}
}
#endif
/* end of genlist.h */
|