You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
3.3 KiB

16 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
  5. * Copyright (C) 1992-2010 KiCAd Developers, see change_log.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #ifndef XNODE_H_
  25. #define XNODE_H_
  26. #include <richio.h>
  27. // quiet the deprecated warnings with 3 lines:
  28. #include <wx/defs.h>
  29. #undef wxDEPRECATED
  30. #define wxDEPRECATED(x) x
  31. #include <wx/xml/xml.h>
  32. /**
  33. * Class XNODE
  34. * holds an XML or S-expression element. It is used for eXporting
  35. * a document tree in EITHER XML or S-expression.
  36. */
  37. class XNODE : public wxXmlNode
  38. {
  39. public:
  40. //-----<overloads>---------------------------------------------------------
  41. XNODE() :
  42. wxXmlNode()
  43. {
  44. }
  45. XNODE( wxXmlNodeType aType, const wxString& aName, const wxString& aContent = wxEmptyString ) :
  46. wxXmlNode( NULL, aType, aName, aContent )
  47. {
  48. }
  49. XNODE( XNODE* aParent, wxXmlNodeType aType, const wxString& aName,
  50. const wxString& aContent = wxEmptyString, wxXmlAttribute* aProperties = NULL ) :
  51. wxXmlNode( aParent, aType, aName, aContent, aProperties )
  52. {
  53. }
  54. XNODE* GetChildren() const
  55. {
  56. return (XNODE* )wxXmlNode::GetChildren();
  57. }
  58. XNODE* GetNext() const
  59. {
  60. return (XNODE* )wxXmlNode::GetNext();
  61. }
  62. XNODE* GetParent() const
  63. {
  64. return (XNODE* )wxXmlNode::GetParent();
  65. }
  66. //-----</overloads>--------------------------------------------------------
  67. /**
  68. * Function Format
  69. * writes this object as UTF8 out to an OUTPUTFORMATTER as an S-expression.
  70. * @param out The formatter to write to.
  71. * @param nestLevel A multiple of the number of spaces to preceed the output with.
  72. * @throw IO_ERROR if a system error writing the output, such as a full disk.
  73. */
  74. virtual void Format( OUTPUTFORMATTER* out, int nestLevel );
  75. /**
  76. * Function FormatContents
  77. * writes the contents of object as UTF8 out to an OUTPUTFORMATTER as an S-expression.
  78. * This is the same as Format() except that the outer wrapper is not included.
  79. * @param out The formatter to write to.
  80. * @param nestLevel A multiple of the number of spaces to preceed the output with.
  81. * @throw IO_ERROR if a system error writing the output, such as a full disk.
  82. */
  83. virtual void FormatContents( OUTPUTFORMATTER* out, int nestLevel );
  84. };
  85. #endif // XNODE_H_