Eneboo - Documentación para desarrolladores
|
00001 /* 00002 odf-gen: Simple API to generate OpenDocument documents. 00003 Copyright (C) 2009 Pablo Jorge, FuDePAN 00004 00005 This file is part of the odf-gen project. 00006 00007 odf-gen is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 odf-gen is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with odf-gen. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef ELEMENT_H 00022 #define ELEMENT_H 00023 00024 #include <iostream> 00025 00026 class Element 00027 { 00028 public: 00029 Element( std::ostream &ostream = std::cout ) 00030 : _ostream( ostream ), 00031 _closed( false ) 00032 {} 00033 00034 Element( Element& other ) 00035 : _ostream( other._ostream ), 00036 _closed( false ) 00037 {} 00038 00039 virtual ~Element() 00040 {} 00041 00042 void close() { 00043 if( !_closed ) { 00044 this->close_(); 00045 _closed = true; 00046 } 00047 } 00048 00049 protected: 00050 virtual void close_() = 0; 00051 00052 protected: 00053 std::ostream &_ostream; 00054 private: 00055 bool _closed; 00056 }; 00057 00058 #endif // ELEMENT_H