DCL 4.0
Loading...
Searching...
No Matches
__ARRAY.cpp File Reference

Go to the source code of this file.

Macros

#define constructElements(_pElements, _size)
#define destructElements(_pElements, _size)

Functions

 IMPLEMENT_CLASSINFO (ARRAY_T, Object) String ARRAY_T

Macro Definition Documentation

◆ constructElements

#define constructElements ( _pElements,
_size )

◆ destructElements

#define destructElements ( _pElements,
_size )

Function Documentation

◆ IMPLEMENT_CLASSINFO()

IMPLEMENT_CLASSINFO ( ARRAY_T ,
Object  )

Definition at line 46 of file __ARRAY.cpp.

49{
50 StringBuilder r = __T("{");
51 for (ConstIterator it = begin(); it != end(); it++)
52 {
53 if (it != begin())
54 r += __T(", ");
55#ifdef __COMPILE_StringArray__
56 r += __T("\"");
57 r += String::escape((*it), (*it).length());
58 r += __T("\"");
59#elif defined(__COMPILE_ByteStringArray__)
60 r += __T("\"");
61 r += String::tryString((*it), 8);
62 r += __T("\"");
63#elif defined(__COMPILE_PointerArray__)
64 r.format(__T("%p"), (*it));
65#else
66 r += (*it).toString();
67#endif
68 }
69 r += __T("}");
70 return r;
71}
72
73#undef constructElements
74#undef destructElements
75
76#if HAVE_CONSTRUCTOR
77inline
78void
79ARRAY_T::constructElements(ELEMENT_T* _pElements, size_t _size)
80{
81 for(; _size; _size--, _pElements++)
82 {
83#if __DCL_HAVE_ALLOC_DEBUG
84 #undef new
85#endif
86
87 new((void*)_pElements) ELEMENT_T;
88
89#if __DCL_HAVE_ALLOC_DEBUG
90 #define new __DCL_DEBUG_NEW
91#endif
92 }
93}
94
95inline
96void
97ARRAY_T::destructElements(ELEMENT_T* _pElements, size_t _size)
98{
99 for( ; _size; _size--, _pElements++)
100 {
101 _pElements->~ELEMENT_T();
102 }
103}
104#else
105 #define constructElements(_pElements, _size)
106 #define destructElements(_pElements, _size)
107#endif
108
109ARRAY_T::ARRAY_T(size_t _size)
110{
111 __pData = NULL;
112 resize(_size);
113}
#define NULL
Definition Config.h:340
#define __T(str)
Definition Object.h:44
ByteString r
ELEMENT_T * __pData
Definition __ARRAY.h:104
void resize(size_t _size)
Definition __ARRAY.cpp:167
ARRAY_T(size_t _size=0)