Update of /cvsroot/eas-dev/eas-dev/libs/libsxmlstream/src
In directory sc8-pr-cvs1:/tmp/cvs-serv8015/libs/libsxmlstream/src
Modified Files:
Makefile.am sxmlstream.cxx
Log Message:
SAL_UNX moved to config.h.top;
GLIB 1.2.0 is now required;
libsxmlstream got output for binary stream
Index: Makefile.am
===================================================================
RCS file: /cvsroot/eas-dev/eas-dev/libs/libsxmlstream/src/Makefile.am,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Makefile.am 25 Jan 2003 21:51:28 -0000 1.1
+++ Makefile.am 28 Jan 2003 06:44:32 -0000 1.2
@@ -1,3 +1,5 @@
lib_LTLIBRARIES = libsxmlstream.la
libsxmlstream_la_SOURCES = sxml.cxx sxmlstream.cxx
-INCLUDES = -I../include
\ No newline at end of file
+INCLUDES = -I../include -I$(top_srcdir)
+CFLAGS = @GLIB_CFLAGS@
+libsxmlstream_la_LIBADD = -lglib
\ No newline at end of file
Index: sxmlstream.cxx
===================================================================
RCS file: /cvsroot/eas-dev/eas-dev/libs/libsxmlstream/src/sxmlstream.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- sxmlstream.cxx 28 Jan 2003 05:04:08 -0000 1.5
+++ sxmlstream.cxx 28 Jan 2003 06:44:32 -0000 1.6
@@ -23,6 +23,9 @@
#include <vector>
#include <sxmlstream.hxx>
+#include <glib.h>
+#include <config.h>
+
using namespace std;
typedef vector<SXml>::iterator sxml_iterator;
@@ -57,7 +60,120 @@
}
+/* SXmlBinaryStream */
+
+SXmlBinaryStream::SXmlBinaryStream()
+{
+ m_queue = new queue<SXml>();
+}
+
+SXmlBinaryStream::~SXmlBinaryStream()
+{
+ delete m_queue;
+}
+#define BIN_LBRACKET "("
+#define BIN_RBRACKET ")"
+
+#define BIN_SIGN_ATTR "@"
+#define BIN_SIGN_NS "!"
+#define BIN_SIGN_CHAR "C"
+#define BIN_SIGN "*"
+
+#if (SIZEOF_SIZE_T == 4) && (G_BYTE_ORDER == G_LITTLE_ENDIAN)
+#define BIN_PORTABLE_SIZE(x) x
+#elif (SIZEOF_SIZE_T == 4) && (G_BYTE_ORDER == G_LITTLE_ENDIAN)
+#define BIN_PORTABLE_SIZE(x) GINT32_TO_LE(x)
+#elif (SIZEOF_SIZE_T == 8)
+#error "64 bit architecture is currently unsupported by libsxmlstream. To be fixed."
+#endif
+
+
+ostream& SXml_BinaryOutput(ostream& os, SXml e)
+{
+ sxml_iterator iter;
+ switch (e.type)
+ {
+ case SXml_Element_t:
+ os << BIN_LBRACKET;
+ os << BIN_SIGN << BIN_PORTABLE_SIZE(e.data.length()) <<
+ e.data;
+ // Output attributes
+ iter = (e.childs)->begin();
+ while (iter!=(e.childs)->end())
+ {
+ if (Is_SXml_Attribute((*iter)))
+ {
+ os << BIN_LBRACKET << BIN_SIGN_ATTR;
+ SXml_BinaryOutput(os,(*iter));
+ os << BIN_RBRACKET;
+ }
+ iter++;
+ }
+ // Output childs
+ iter = (e.childs)->begin();
+ while (iter!=(e.childs)->end())
+ {
+ if (!Is_SXml_Attribute((*iter)))
+ {
+ SXml_BinaryOutput(os,(*iter));
+ }
+ iter++;
+ }
+
+ os << BIN_RBRACKET;
+ break;
+ case SXml_Attribute_t:
+ if (SXml_has_property(e))
+ {
+ os << BIN_LBRACKET <<
+ BIN_PORTABLE_SIZE(e.data.length()) <<
+ e.data <<
+ BIN_PORTABLE_SIZE(SXml_get_property(e).length()) <<
+ SXml_get_property(e) << BIN_LBRACKET;
+ } else
+ {
+ os << BIN_LBRACKET <<
+ BIN_PORTABLE_SIZE(e.data.length()) <<
+ e.data << BIN_RBRACKET;
+
+ }
+ break;
+ case SXml_Char_t:
+ os << BIN_SIGN_CHAR <<
+ BIN_PORTABLE_SIZE(e.data.length()) <<
+ e.data;
+ break;
+ case SXml_Namespace_t:
+ os << BIN_LBRACKET << BIN_SIGN_NS;
+ os << BIN_PORTABLE_SIZE(e.data.length());
+ if (SXml_has_property(e))
+ os << BIN_PORTABLE_SIZE(SXml_get_property(e).length()) << SXml_get_property(e);
+ os << BIN_RBRACKET;
+ break;
+ default:
+ break;
+ }
+ return os;
+}
+
+ostream& operator<<(ostream& os, SXmlBinaryStream& s)
+{
+ SXml e;
+ while (!s.queueIsEmpty())
+ {
+ e = s.pop();
+ SXml_BinaryOutput(os,e);
+ }
+ return os;
+};
+
+SXmlBinaryStream& operator<<(SXmlBinaryStream& s, const ostream& os)
+{
+ SXmlBinaryStream bs();
+ // TODO
+}
+
/* SXmlTextStream */
SXmlTextStream::SXmlTextStream()
@@ -140,3 +256,10 @@
}
return os;
};
+
+SXmlTextStream& operator<<(SXmlTextStream& s, const ostream& os)
+{
+ SXmlTextStream ts();
+ // TODO
+}
+
|