[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/lib/store
From: David Faure <faure () kde ! org>
Date: 2004-05-03 17:24:34
Message-ID: 20040503172434.C986A9250 () office ! kde ! org
[Download RAW message or body]
CVS commit by faure:
Added convenience method addManifestEntry.
M +8 -0 koxmlwriter.cc 1.7
M +9 -0 koxmlwriter.h 1.7
M +4 -0 tests/xmlwritertest.cpp 1.7
--- koffice/lib/store/koxmlwriter.cc #1.6:1.7
@@ -257,2 +257,10 @@ char* KoXmlWriter::escapeForXML( const c
return output;
}
+
+void KoXmlWriter::addManifestEntry( const QString& fullPath, const QString& \
mediaType ) +{
+ startElement( "manifest:file-entry" );
+ addAttribute( "manifest:media-type", mediaType );
+ addAttribute( "manifest:full-path", fullPath );
+ endElement();
+}
--- koffice/lib/store/koxmlwriter.h #1.6:1.7
@@ -141,4 +141,13 @@ public:
void addTextNode( const char* cstr );
+ // #### Maybe we want to subclass KoXmlWriter for manifest files.
+ /**
+ * Special helper for writing "manifest" files
+ * This is equivalent to startElement/2*addAttribute/endElement
+ * This API will probably have to change (or not be used anymore)
+ * when we add support for encrypting/signing.
+ */
+ void addManifestEntry( const QString& fullPath, const QString& mediaType );
+
private:
struct Tag {
--- koffice/lib/store/tests/xmlwritertest.cpp #1.6:1.7
@@ -76,4 +76,8 @@ int main( int argc, char** argv ) {
TEST_END( "textnode test", "<!DOCTYPE r>\n<r>\n <a>\n <b>\n <c/>text</b>\n \
</a>\n</r>\n" );
+ TEST_BEGIN( 0, 0 );
+ writer.addManifestEntry( "foo/bar/blah", "mime/type" );
+ TEST_END( "addManifestEntry", "<!DOCTYPE r>\n<r>\n <manifest:file-entry \
manifest:media-type=\"mime/type\" manifest:full-path=\"foo/bar/blah\"/>\n</r>\n" ); +
int sz = 15000; // must be more than KoXmlWriter::s_escapeBufferLen
QCString x( sz );
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic