mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-22 10:25:50 +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,18 +62,26 @@ class XML_API Document: public AbstractContainerNode, public DocumentEvent
|
|||||||
public:
|
public:
|
||||||
typedef Poco::AutoReleasePool<DOMObject> AutoReleasePool;
|
typedef Poco::AutoReleasePool<DOMObject> AutoReleasePool;
|
||||||
|
|
||||||
Document(NamePool* pNamePool = 0);
|
explicit Document(NamePool* pNamePool = 0);
|
||||||
/// Creates a new document. If pNamePool == 0, the document
|
/// Creates a new document. If pNamePool == 0, the document
|
||||||
/// creates its own name pool, otherwise it uses the given name pool.
|
/// creates its own name pool, otherwise it uses the given name pool.
|
||||||
/// Sharing a name pool makes sense for documents containing instances
|
/// Sharing a name pool makes sense for documents containing instances
|
||||||
/// of the same schema, thus reducing memory usage.
|
/// 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);
|
Document(DocumentType* pDocumentType, NamePool* pNamePool = 0);
|
||||||
/// Creates a new document. If pNamePool == 0, the document
|
/// Creates a new document. If pNamePool == 0, the document
|
||||||
/// creates its own name pool, otherwise it uses the given name pool.
|
/// creates its own name pool, otherwise it uses the given name pool.
|
||||||
/// Sharing a name pool makes sense for documents containing instances
|
/// Sharing a name pool makes sense for documents containing instances
|
||||||
/// of the same schema, thus reducing memory usage.
|
/// 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();
|
NamePool& namePool();
|
||||||
/// Returns a pointer to the documents Name Pool.
|
/// Returns a pointer to the documents Name Pool.
|
||||||
|
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
#include "Poco/XML/Name.h"
|
#include "Poco/XML/Name.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef POCO_XML_NAMEPOOL_DEFAULT_SIZE
|
||||||
|
#define POCO_XML_NAMEPOOL_DEFAULT_SIZE 509
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
namespace XML {
|
namespace XML {
|
||||||
|
|
||||||
@ -37,7 +42,7 @@ class XML_API NamePool
|
|||||||
/// local name and a qualified name.
|
/// local name and a qualified name.
|
||||||
{
|
{
|
||||||
public:
|
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.
|
/// Creates a name pool with room for up to size strings.
|
||||||
|
|
||||||
const Name& insert(const XMLString& qname, const XMLString& namespaceURI, const XMLString& localName);
|
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):
|
Document::Document(DocumentType* pDocumentType, NamePool* pNamePool):
|
||||||
AbstractContainerNode(0),
|
AbstractContainerNode(0),
|
||||||
_pDocumentType(pDocumentType),
|
_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()
|
Document::~Document()
|
||||||
{
|
{
|
||||||
if (_pDocumentType) _pDocumentType->release();
|
if (_pDocumentType) _pDocumentType->release();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user