peiyongz 2004/04/02 08:51:05
Modified: c/src/xercesc/framework/psvi XSAnnotation.cpp
XSAnnotation.hpp
Log:
Better error report support
Revision Changes Path
1.9 +41 -20 xml-xerces/c/src/xercesc/framework/psvi/XSAnnotation.cpp
Index: XSAnnotation.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAnnotation.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XSAnnotation.cpp 19 Dec 2003 07:18:56 -0000 1.8
+++ XSAnnotation.cpp 2 Apr 2004 16:51:05 -0000 1.9
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.9 2004/04/02 16:51:05 peiyongz
+ * Better error report support
+ *
* Revision 1.8 2003/12/19 07:18:56 neilg
* remove a throw clause inserted during debugging (but should we really swallow
this exception?)
*
@@ -97,18 +100,24 @@
XERCES_CPP_NAMESPACE_BEGIN
-XSAnnotation::XSAnnotation(const XMLCh* const content,
- MemoryManager * const manager):
- XSObject(XSConstants::ANNOTATION, 0, manager)
- , fContents(XMLString::replicate(content, manager))
- , fNext(0)
+XSAnnotation::XSAnnotation(const XMLCh* const content,
+ MemoryManager * const manager)
+:XSObject(XSConstants::ANNOTATION, 0, manager)
+,fContents(XMLString::replicate(content, manager))
+,fNext(0)
+,fSystemId(0)
+,fLine(0)
+,fCol(0)
{
}
-XSAnnotation::XSAnnotation(MemoryManager * const manager):
- XSObject(XSConstants::ANNOTATION, 0, manager)
- , fContents(0)
- , fNext(0)
+XSAnnotation::XSAnnotation(MemoryManager * const manager)
+:XSObject(XSConstants::ANNOTATION, 0, manager)
+,fContents(0)
+,fNext(0)
+,fSystemId(0)
+,fLine(0)
+,fCol(0)
{
}
@@ -118,6 +127,8 @@
if (fNext)
delete fNext;
+
+ fMemoryManager->deallocate(fSystemId);
}
// XSAnnotation methods
@@ -201,6 +212,19 @@
return fNext;
}
+void XSAnnotation::setSystemId(const XMLCh* const systemId)
+{
+ if (fSystemId)
+ {
+ fMemoryManager->deallocate(fSystemId);
+ fSystemId = 0;
+ }
+
+ if (systemId)
+ fSystemId = XMLString::replicate(systemId, fMemoryManager);
+
+}
+
/***
* Support for Serialization/De-serialization
***/
@@ -209,25 +233,22 @@
void XSAnnotation::serialize(XSerializeEngine& serEng)
{
- /***
- * Since we are pretty sure that fIdMap and fHashTable is
- * not shared by any other object, therefore there is no owned/referenced
- * issue. Thus we can serialize the raw data only, rather than serializing
- * both fIdMap and fHashTable.
- *
- * And we can rebuild the fIdMap and fHashTable out of the raw data during
- * deserialization.
- *
- ***/
+
if (serEng.isStoring())
{
serEng.writeString(fContents);
serEng<<fNext;
+ serEng.writeString(fSystemId);
+ serEng<<fLine;
+ serEng<<fCol;
}
else
{
serEng.readString(fContents);
serEng>>fNext;
+ serEng.readString(fSystemId);
+ serEng>>fLine;
+ serEng>>fCol;
}
}
1.9 +42 -1 xml-xerces/c/src/xercesc/framework/psvi/XSAnnotation.hpp
Index: XSAnnotation.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/psvi/XSAnnotation.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XSAnnotation.hpp 1 Dec 2003 23:23:26 -0000 1.8
+++ XSAnnotation.hpp 2 Apr 2004 16:51:05 -0000 1.9
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.9 2004/04/02 16:51:05 peiyongz
+ * Better error report support
+ *
* Revision 1.8 2003/12/01 23:23:26 neilg
* fix for bug 25118; thanks to Jeroen Witmond
*
@@ -185,6 +188,20 @@
XSAnnotation* getNext();
//@}
+ //-----------------------------
+ /** Getter */
+ //@{
+ inline void getLineCol(int& line, int& col) const;
+ inline const XMLCh* getSystemId() const;
+ //@}
+
+ //-----------------------------
+ /** Setter */
+ //@{
+ inline void setLineCol(int line, int col);
+ void setSystemId(const XMLCh* const systemId);
+ //@}
+
/***
* Support for Serialization/De-serialization
***/
@@ -206,6 +223,13 @@
// -----------------------------------------------------------------------
XMLCh* fContents;
XSAnnotation* fNext;
+
+private:
+
+ XMLCh* fSystemId;
+ int fLine;
+ int fCol;
+
};
inline const XMLCh *XSAnnotation::getAnnotationString() const
@@ -216,6 +240,23 @@
inline XMLCh *XSAnnotation::getAnnotationString()
{
return fContents;
+}
+
+inline void XSAnnotation::getLineCol(int& line, int& col) const
+{
+ line = fLine;
+ col = fCol;
+}
+
+inline const XMLCh* XSAnnotation::getSystemId() const
+{
+ return fSystemId;
+}
+
+inline void XSAnnotation::setLineCol(int line, int col)
+{
+ fLine = line;
+ fCol = col;
}
XERCES_CPP_NAMESPACE_END
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]