"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/common/classes/auto.h" between
Firebird-3.0.2.32703-0.tar.bz2 and Firebird-3.0.4.33054-0.tar.bz2

About: Firebird is a relational database offering many ANSI SQL standard features.

auto.h  (Firebird-3.0.2.32703-0.tar.bz2):auto.h  (Firebird-3.0.4.33054-0.tar.bz2)
skipping to change at line 48 skipping to change at line 48
template <typename What> template <typename What>
class SimpleDelete class SimpleDelete
{ {
public: public:
static void clear(What* ptr) static void clear(What* ptr)
{ {
delete ptr; delete ptr;
} }
}; };
template <>
inline void SimpleDelete<FILE>::clear(FILE* f)
{
if (f) {
fclose(f);
}
}
template <typename What> template <typename What>
class ArrayDelete class ArrayDelete
{ {
public: public:
static void clear(What* ptr) static void clear(What* ptr)
{ {
delete[] ptr; delete[] ptr;
} }
}; };
skipping to change at line 84 skipping to change at line 92
public: public:
static void clear(T* ptr) static void clear(T* ptr)
{ {
if (ptr) if (ptr)
{ {
ptr->dispose(); ptr->dispose();
} }
} }
}; };
template <typename Where, typename Clear = SimpleDelete<Where> > template <typename Where, template <typename W> class Clear = SimpleDelete >
class AutoPtr class AutoPtr
{ {
private: private:
Where* ptr; Where* ptr;
public: public:
AutoPtr<Where, Clear>(Where* v = NULL) AutoPtr(Where* v = NULL)
: ptr(v) : ptr(v)
{} {}
~AutoPtr() ~AutoPtr()
{ {
Clear::clear(ptr); Clear<Where>::clear(ptr);
} }
AutoPtr<Where, Clear>&amp; operator= (Where* v) AutoPtr& operator= (Where* v)
{ {
Clear::clear(ptr); Clear<Where>::clear(ptr);
ptr = v; ptr = v;
return *this; return *this;
} }
operator Where*() operator Where*()
{ {
return ptr; return ptr;
} }
Where* get() Where* get()
skipping to change at line 157 skipping to change at line 165
{ {
Where* tmp = ptr; Where* tmp = ptr;
ptr = NULL; ptr = NULL;
return tmp; return tmp;
} }
void reset(Where* v = NULL) void reset(Where* v = NULL)
{ {
if (v != ptr) if (v != ptr)
{ {
Clear::clear(ptr); Clear<Where>::clear(ptr);
ptr = v; ptr = v;
} }
} }
private: private:
AutoPtr<Where, Clear>(AutoPtr<Where, Clear>&); AutoPtr(AutoPtr&);
void operator=(AutoPtr<Where, Clear>&); void operator=(AutoPtr&);
};
template <typename Where>
class AutoDispose : public AutoPtr<Where, SimpleDispose>
{
public:
AutoDispose(Where* v = NULL)
: AutoPtr<Where, SimpleDispose>(v)
{ }
}; };
template <typename T> template <typename T>
class AutoSetRestore class AutoSetRestore
{ {
public: public:
AutoSetRestore(T* aValue, T newValue) AutoSetRestore(T* aValue, T newValue)
: value(aValue), : value(aValue),
oldValue(*aValue) oldValue(*aValue)
{ {
 End of changes. 8 change blocks. 
8 lines changed or deleted 25 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)