1 /* 2 * Copyright (C) 2008 Vadim Zeitlin (vz-xmlwrapp@zeitlins.org) 3 * All Rights Reserved 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in 13 * the documentation and/or other materials provided with the 14 * distribution. 15 * 3. Neither the name of the Author nor the names of its contributors 16 * may be used to endorse or promote products derived from this software 17 * without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' 20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 22 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 23 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33 /** 34 @file 35 36 This file contains the declaration of the xslt::result class. 37 */ 38 39 #ifndef _xsltwrapp_result_h_ 40 #define _xsltwrapp_result_h_ 41 42 // standard includes 43 #include <string> 44 45 // forward declarations 46 typedef struct _xmlDoc *xmlDocPtr; 47 48 namespace xslt 49 { 50 51 namespace impl 52 { 53 54 /** 55 @internal 56 57 The xslt::result class is used as a callback by xml::document to allow 58 special treatment of XML documents which were created by XSLT. 59 60 This class is only meant to be used internally by the library and is 61 necessary to avoid the dependency of xml::document, which is part of 62 libxmlwrapp, on libxslt which should be only a dependency of libxsltwrapp 63 as this precludes calling the XSLT functions which must be used with such 64 "result" documents directly from xml::document code. 65 */ 66 class result 67 { 68 public: 69 /** 70 Save the contents of the given XML document in the provided string. 71 72 @param s The string to place the XML text data. 73 */ 74 virtual void save_to_string(std::string &s) const = 0; 75 76 /** 77 Save the contents of the given XML document in the provided filename. 78 79 @param filename 80 The name of the file to place the XML text data into. 81 @param compression_level 82 0 is no compression, 1-9 allowed, where 1 is for better speed, 83 and 9 is for smaller size 84 @return True if the data was saved successfully, false otherwise. 85 */ 86 virtual bool save_to_file(const char *filename, 87 int compression_level) const = 0; 88 89 /// Trivial but virtual base class destructor. ~result()90 virtual ~result() {} 91 }; 92 93 } // end impl namespace 94 95 } // end xslt namespace 96 97 #endif // _xsltwrapp_result_h_ 98