mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
increased default XML name pool size, added Document constructor taking name pool size as argument
This commit is contained in:
parent
b5036266be
commit
ad99e73a60
@ -62,11 +62,15 @@ class XML_API Document: public AbstractContainerNode, public DocumentEvent
|
||||
public:
|
||||
typedef Poco::AutoReleasePool<DOMObject> AutoReleasePool;
|
||||
|
||||
Document(NamePool* pNamePool = 0);
|
||||
explicit Document(NamePool* pNamePool = 0);
|
||||
/// Creates a new document. If pNamePool == 0, the document
|
||||
/// creates its own name pool, otherwise it uses the given name pool.
|
||||
/// Sharing a name pool makes sense for documents containing instances
|
||||
/// of the same schema, thus reducing memory usage.
|
||||
|
||||
explicit Document(unsigned long namePoolSize);
|
||||
/// Creates a new document using a name pool with the given size, which
|
||||
/// should be a prime number (e.g., 251, 509, 1021, 4093).
|
||||
|
||||
Document(DocumentType* pDocumentType, NamePool* pNamePool = 0);
|
||||
/// Creates a new document. If pNamePool == 0, the document
|
||||
@ -74,6 +78,10 @@ public:
|
||||
/// Sharing a name pool makes sense for documents containing instances
|
||||
/// of the same schema, thus reducing memory usage.
|
||||
|
||||
Document(DocumentType* pDocumentType, unsigned long namePoolSize);
|
||||
/// Creates a new document using a name pool with the given size, which
|
||||
/// should be a prime number (e.g., 251, 509, 1021, 4093).
|
||||
|
||||
NamePool& namePool();
|
||||
/// Returns a pointer to the documents Name Pool.
|
||||
|
||||
|
@ -25,6 +25,11 @@
|
||||
#include "Poco/XML/Name.h"
|
||||
|
||||
|
||||
#ifndef POCO_XML_NAMEPOOL_DEFAULT_SIZE
|
||||
#define POCO_XML_NAMEPOOL_DEFAULT_SIZE 509
|
||||
#endif
|
||||
|
||||
|
||||
namespace Poco {
|
||||
namespace XML {
|
||||
|
||||
@ -37,7 +42,7 @@ class XML_API NamePool
|
||||
/// local name and a qualified name.
|
||||
{
|
||||
public:
|
||||
NamePool(unsigned long size = 251);
|
||||
NamePool(unsigned long size = POCO_XML_NAMEPOOL_DEFAULT_SIZE);
|
||||
/// Creates a name pool with room for up to size strings.
|
||||
|
||||
const Name& insert(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName);
|
||||
|
@ -57,6 +57,15 @@ Document::Document(NamePool* pNamePool):
|
||||
}
|
||||
|
||||
|
||||
Document::Document(unsigned long namePoolSize):
|
||||
AbstractContainerNode(0),
|
||||
_pDocumentType(0),
|
||||
_pNamePool(new NamePool(namePoolSize)),
|
||||
_eventSuspendLevel(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Document::Document(DocumentType* pDocumentType, NamePool* pNamePool):
|
||||
AbstractContainerNode(0),
|
||||
_pDocumentType(pDocumentType),
|
||||
@ -79,6 +88,20 @@ Document::Document(DocumentType* pDocumentType, NamePool* pNamePool):
|
||||
}
|
||||
|
||||
|
||||
Document::Document(DocumentType* pDocumentType, unsigned long namePoolSize):
|
||||
AbstractContainerNode(0),
|
||||
_pDocumentType(pDocumentType),
|
||||
_pNamePool(new NamePool(namePoolSize)),
|
||||
_eventSuspendLevel(0)
|
||||
{
|
||||
if (_pDocumentType)
|
||||
{
|
||||
_pDocumentType->duplicate();
|
||||
_pDocumentType->setOwnerDocument(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Document::~Document()
|
||||
{
|
||||
if (_pDocumentType) _pDocumentType->release();
|
||||
|
Loading…
Reference in New Issue
Block a user