/* * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
// Sub-stream for writing quoted text, as opposed to markup. // Characters written to this stream are subject to quoting, // as '<' => "<", etc. class xmlTextStream : public outputStream { friendclass xmlStream; friendclass defaultStream; // tty private:
// Output stream for writing XML-structured logs. // To write markup, use special calls elem, head/tail, etc. // Use the xmlStream::text() stream to write unmarked text. // Text written that way will be quoted as necessary using '<', etc. // Characters written directly to an xmlStream via print_cr, etc., // are directly written to the encapsulated stream, xmlStream::out(). // This can be used to produce markup directly, character by character. // (Such writes are not checked for markup syntax errors.)
class xmlStream : public outputStream { friendclass defaultStream; // tty public: enum MarkupState { BODY, // after end_head() call, in text
HEAD, // after begin_head() call, in attrs
ELEM }; // after begin_elem() call, in attrs
protected:
outputStream* _out; // file stream by which it goes
julong _last_flush; // last position of flush
MarkupState _markup_state; // where in the elem/head/tail dance
outputStream* _text; // text stream
xmlTextStream _text_init;
// for subclasses
xmlStream() {} void initialize(outputStream* out);
// protect this from public use:
outputStream* out() { return _out; }
// helpers for writing XML elements void va_tag(bool push, constchar* format, va_list ap) ATTRIBUTE_PRINTF(3, 0); virtualvoid see_tag(constchar* tag, bool push) NOT_DEBUG({}); virtualvoid pop_tag(constchar* tag) NOT_DEBUG({});
#ifdef ASSERT // in debug mode, we verify matching of opening and closing tags int _element_depth; // number of unfinished elements char* _element_close_stack_high; // upper limit of down-growing stack char* _element_close_stack_low; // upper limit of down-growing stack char* _element_close_stack_ptr; // pointer of down-growing stack #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.