src/share/vm/utilities/xmlstream.hpp

Print this page


   1 /*
   2  * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 






  25 class xmlStream;
  26 class defaultStream;
  27 
  28 // Sub-stream for writing quoted text, as opposed to markup.
  29 // Characters written to this stream are subject to quoting,
  30 // as '<' => "&lt;", etc.
  31 class xmlTextStream : public outputStream {
  32   friend class xmlStream;
  33   friend class defaultStream; // tty
  34  private:
  35 
  36   xmlStream* _outer_xmlStream;
  37 
  38   xmlTextStream() { _outer_xmlStream = NULL; }
  39 
  40  public:
  41    virtual void flush(); // _outer.flush();
  42    virtual void write(const char* str, size_t len); // _outer->write_text()
  43 };
  44 


 158       tail("X");                </X> \n
 159 
 160       // Compound element, general case.
 161       begin_head("X Y='Z'");    <X Y='Z'
 162       ...attrs...               ...attrs...
 163       end_head();               > \n
 164       ...body...                ...body...
 165       tail("X");                </X> \n
 166 
 167       // Printf-style formatting:
 168       elem("X Y='%s'", "Z");    <X Y='Z'/> \n
 169 
 170    */
 171 
 172 };
 173 
 174 // Standard log file, null if no logging is happening.
 175 extern xmlStream* xtty;
 176 
 177 // Note:  If ::xtty != NULL, ::tty == ::xtty->text().


   1 /*
   2  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_UTILITIES_XMLSTREAM_HPP
  26 #define SHARE_VM_UTILITIES_XMLSTREAM_HPP
  27 
  28 #include "runtime/handles.hpp"
  29 #include "utilities/ostream.hpp"
  30 
  31 class xmlStream;
  32 class defaultStream;
  33 
  34 // Sub-stream for writing quoted text, as opposed to markup.
  35 // Characters written to this stream are subject to quoting,
  36 // as '<' => "&lt;", etc.
  37 class xmlTextStream : public outputStream {
  38   friend class xmlStream;
  39   friend class defaultStream; // tty
  40  private:
  41 
  42   xmlStream* _outer_xmlStream;
  43 
  44   xmlTextStream() { _outer_xmlStream = NULL; }
  45 
  46  public:
  47    virtual void flush(); // _outer.flush();
  48    virtual void write(const char* str, size_t len); // _outer->write_text()
  49 };
  50 


 164       tail("X");                </X> \n
 165 
 166       // Compound element, general case.
 167       begin_head("X Y='Z'");    <X Y='Z'
 168       ...attrs...               ...attrs...
 169       end_head();               > \n
 170       ...body...                ...body...
 171       tail("X");                </X> \n
 172 
 173       // Printf-style formatting:
 174       elem("X Y='%s'", "Z");    <X Y='Z'/> \n
 175 
 176    */
 177 
 178 };
 179 
 180 // Standard log file, null if no logging is happening.
 181 extern xmlStream* xtty;
 182 
 183 // Note:  If ::xtty != NULL, ::tty == ::xtty->text().
 184 
 185 #endif // SHARE_VM_UTILITIES_XMLSTREAM_HPP