Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.8

Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

XalanAllocator.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright 1999-2004 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #if !defined(XALANALLOCATOR_INCLUDE_GUARD_1357924680)
00018 #define XALANALLOCATOR_INCLUDE_GUARD_1357924680
00019 
00020 
00021 
00022 #include <cstddef>
00023 
00024 
00025 
00026 XALAN_CPP_NAMESPACE_BEGIN
00027 
00028 
00029 
00030 template <class Type>
00031 class XalanAllocator
00032 {
00033 public:
00034     typedef size_t          size_type;
00035     typedef ptrdiff_t       difference_type;
00036     typedef Type*           pointer;
00037     typedef const Type*     const_pointer;
00038     typedef Type&           reference;
00039     typedef const Type&     const_reference;
00040     typedef Type            value_type;
00041 
00042     XalanAllocator()
00043     {
00044     }
00045 
00046     XalanAllocator(const XalanAllocator<Type>&)
00047     {
00048     };
00049 
00050     ~XalanAllocator()
00051     {
00052     }
00053 
00054     pointer
00055     address(reference   x) const
00056     {
00057         return &x;
00058     }
00059 
00060     const_pointer
00061     address(const_reference     x) const
00062     {
00063         return &x;
00064     }
00065 
00066     pointer
00067     allocate(
00068             size_type       size,
00069             const void*     /* hint */ = 0)
00070     {
00071         return (pointer)operator new(size * sizeof(Type));
00072     }
00073 
00074     void
00075     deallocate(
00076                 pointer     p,
00077                 size_type   /* n */)
00078     {
00079         operator delete(p);
00080     }
00081 
00082     size_type
00083     max_size() const
00084     {
00085         return ~0;
00086     }
00087 
00088     void
00089     construct(
00090             pointer         p,
00091             const Type&     val)
00092     {
00093         new (p) Type(val);
00094     }
00095 
00096     void
00097     destroy(pointer     p)
00098     {
00099         p->Type::~Type();
00100     }
00101 };
00102 
00103 
00104 
00105 XALAN_CPP_NAMESPACE_END
00106 
00107 
00108 
00109 #endif  // XALANALLOCATOR_INCLUDE_GUARD_1357924680

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.8
Copyright © 1999-2004 The Apache Software Foundation. All Rights Reserved.