diff options
| author | antonovvk <[email protected]> | 2022-02-10 16:47:51 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:51 +0300 |
| commit | 37a63debdc21e372d99e1808cdd31aecf75018c3 (patch) | |
| tree | fd84293fb9a1b16381dd6c1a5e14c78afacb8710 /contrib/libs/antlr3_cpp_runtime/include/antlr3memory.hpp | |
| parent | 1fe621e70df847cc201ac942fe6d7804ea10508d (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/antlr3_cpp_runtime/include/antlr3memory.hpp')
| -rw-r--r-- | contrib/libs/antlr3_cpp_runtime/include/antlr3memory.hpp | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/contrib/libs/antlr3_cpp_runtime/include/antlr3memory.hpp b/contrib/libs/antlr3_cpp_runtime/include/antlr3memory.hpp index 7b85f67545d..543df041fd8 100644 --- a/contrib/libs/antlr3_cpp_runtime/include/antlr3memory.hpp +++ b/contrib/libs/antlr3_cpp_runtime/include/antlr3memory.hpp @@ -1,39 +1,39 @@ #ifndef _ANTLR3MEMORY_HPP #define _ANTLR3MEMORY_HPP - -// [The "BSD licence"] -// Copyright (c) 2005-2009 Gokulakannan Somasundaram, ElectronDB - -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// 3. The name of the author may not be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + +// [The "BSD licence"] +// Copyright (c) 2005-2009 Gokulakannan Somasundaram, ElectronDB + +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// 3. The name of the author may not be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + namespace antlr3 { - -class DefaultAllocPolicy -{ -public: + +class DefaultAllocPolicy +{ +public: //limitation of c++. unable to write a typedef template <class TYPE> class AllocatorType : public std::allocator<TYPE> @@ -49,12 +49,12 @@ public: template<class U> struct rebind { typedef AllocatorType<U> other; }; - + AllocatorType() noexcept {} AllocatorType( const AllocatorType& ) noexcept {} template<typename U> AllocatorType(const AllocatorType<U>& ) noexcept{} }; - + template<class TYPE> class VectorType : public std::vector< TYPE, AllocatorType<TYPE> > { @@ -64,7 +64,7 @@ public: class ListType : public std::deque< TYPE, AllocatorType<TYPE> > { }; - + template<class TYPE> class StackType : public std::deque< TYPE, AllocatorType<TYPE> > { @@ -76,30 +76,30 @@ public: const TYPE& peek() const { return this->back(); } const TYPE& top() const { return this->back(); } }; - - + + template<class TYPE> class OrderedSetType : public std::set< TYPE, std::less<TYPE>, AllocatorType<TYPE> > { }; - + template<class TYPE> class UnOrderedSetType : public std::set< TYPE, std::less<TYPE>, AllocatorType<TYPE> > { }; - + template<class KeyType, class ValueType> class UnOrderedMapType : public std::map< KeyType, ValueType, std::less<KeyType>, AllocatorType<std::pair<const KeyType, ValueType> > > { }; - + template<class KeyType, class ValueType> class OrderedMapType : public std::map< KeyType, ValueType, std::less<KeyType>, AllocatorType<std::pair<KeyType, ValueType> > > { }; - + template<class TYPE> class SmartPtrType : public std::unique_ptr<TYPE, std::default_delete<TYPE> > { @@ -119,7 +119,7 @@ public: SmartPtrType & operator=(const SmartPtrType&) /*= delete*/; SmartPtrType(const SmartPtrType&) /*= delete*/; }; - + ANTLR_INLINE static void* operator new (std::size_t bytes) { void* p = alloc(bytes); @@ -136,12 +136,12 @@ public: DefaultAllocPolicy::free(p); } ANTLR_INLINE static void operator delete(void* , void* ) {} //placement delete - + ANTLR_INLINE static void operator delete[](void* p) { DefaultAllocPolicy::free(p); } - + ANTLR_INLINE static void* alloc( std::size_t bytes ) { void* p = malloc(bytes); @@ -149,7 +149,7 @@ public: throw std::bad_alloc(); return p; } - + ANTLR_INLINE static void* alloc0( std::size_t bytes ) { void* p = calloc(1, bytes); @@ -157,7 +157,7 @@ public: throw std::bad_alloc(); return p; } - + ANTLR_INLINE static void free( void* p ) { return ::free(p); @@ -167,8 +167,8 @@ public: { return ::realloc( ptr, size ); } -}; - +}; + } - + #endif /* _ANTLR3MEMORY_H */ |
