cargilld 2005/04/04 08:03:14
Modified: c/src/xercesc/framework XMLGrammarPool.hpp
c/src/xercesc/internal XTemplateSerializer.cpp
Log:
Add support for not creating xsannotations when deserializing a grammar.
Revision Changes Path
1.17 +19 -1 xml-xerces/c/src/xercesc/framework/XMLGrammarPool.hpp
Index: XMLGrammarPool.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLGrammarPool.hpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XMLGrammarPool.hpp 3 Mar 2005 08:02:55 -0000 1.16
+++ XMLGrammarPool.hpp 4 Apr 2005 15:03:14 -0000 1.17
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.17 2005/04/04 15:03:14 cargilld
+ * Add support for not creating xsannotations when deserializing a grammar.
+ *
* Revision 1.16 2005/03/03 08:02:55 dbertoni
* Removed superfluous const qualifier.
*
@@ -342,6 +345,19 @@
virtual void serializeGrammars(BinOutputStream* const) = 0;
virtual void deserializeGrammars(BinInputStream* const) = 0;
+ /*
+ * Set/get a flag to not create XSAnnotations when deserializing the
grammar.
+ * Defaults to false (create XSAnnotations when deserializing the
grammar).
+ */
+ inline void setIgnoreSerializedAnnotations(const bool flag)
+ {
+ fIgnoreSerializedAnnotations = flag;
+ };
+ inline bool getIgnoreSerializedAnnotations() const
+ {
+ return fIgnoreSerializedAnnotations;
+ };
+
protected :
//
-----------------------------------------------------------------------
/** Hidden Constructors */
@@ -349,6 +365,7 @@
//@{
XMLGrammarPool(MemoryManager* const memMgr =
XMLPlatformUtils::fgMemoryManager)
:fMemMgr(memMgr)
+ ,fIgnoreSerializedAnnotations(false)
{
};
//@}
@@ -371,6 +388,7 @@
//
-----------------------------------------------------------------------
MemoryManager* const fMemMgr;
+ bool fIgnoreSerializedAnnotations;
};
1.13 +26 -12 xml-xerces/c/src/xercesc/internal/XTemplateSerializer.cpp
Index: XTemplateSerializer.cpp
===================================================================
RCS file:
/home/cvs/xml-xerces/c/src/xercesc/internal/XTemplateSerializer.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XTemplateSerializer.cpp 19 Feb 2005 22:26:19 -0000 1.12
+++ XTemplateSerializer.cpp 4 Apr 2005 15:03:14 -0000 1.13
@@ -17,6 +17,9 @@
/*
* $Id$
* $Log$
+ * Revision 1.13 2005/04/04 15:03:14 cargilld
+ * Add support for not creating xsannotations when deserializing a grammar.
+ *
* Revision 1.12 2005/02/19 22:26:19 cargilld
* Store key for recreating table instead of using enclosingscope.
*
@@ -59,6 +62,7 @@
// Includes
//
---------------------------------------------------------------------------
#include <xercesc/internal/XTemplateSerializer.hpp>
+#include <xercesc/framework/XMLGrammarPool.hpp>
#include <xercesc/validators/common/Grammar.hpp>
#include <xercesc/util/HashPtr.hpp>
@@ -1883,17 +1887,27 @@
int itemNumber = 0;
serEng>>itemNumber;
- for (int itemIndex = 0; itemIndex < itemNumber; itemIndex++)
- {
- XSerializeEngine::XSerializedObjectId_t keyId = 0;
-
- serEng>>keyId;
-
- void* key = serEng.lookupLoadPool(keyId);
- XSAnnotation* data;
- serEng>>data;
-
- (*objToLoad)->put(key, data);
+ int itemIndex;
+ XSerializeEngine::XSerializedObjectId_t keyId;
+ void* key;
+ XSAnnotation* data;
+ if (!serEng.fGrammarPool->getIgnoreSerializedAnnotations()) {
+ for (itemIndex = 0; itemIndex < itemNumber; itemIndex++)
+ {
+ serEng>>keyId;
+ key = serEng.lookupLoadPool(keyId);
+ serEng>>data;
+ (*objToLoad)->put(key, data);
+ }
+ }
+ else {
+ for (itemIndex = 0; itemIndex < itemNumber; itemIndex++)
+ {
+ serEng>>keyId;
+ key = serEng.lookupLoadPool(keyId);
+ serEng>>data;
+ delete data;
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]