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 SPAN_H 00022 #define SPAN_H 00023 00024 #include <iostream> 00025 00026 template < class K, class T > 00027 class Span 00028 { 00029 public: 00030 Span( const T& value, unsigned int count ) 00031 : _value( value ), 00032 _count( count ) 00033 {} 00034 00035 const T& value() const { return _value; } 00036 unsigned int count() const { return _count; } 00037 00038 private: 00039 T _value; 00040 unsigned int _count; 00041 }; 00042 00043 class ColumnK {}; 00044 class RowK {}; 00045 00046 template < class T > 00047 class ColumnSpan : public Span< ColumnK, T > 00048 { 00049 public: 00050 ColumnSpan( const T& value, unsigned int count ) 00051 : Span< ColumnK, T >( value, count ) 00052 {} 00053 }; 00054 00055 template < class T > 00056 class RowSpan : public Span< RowK, T > 00057 { 00058 public: 00059 RowSpan( const T& value, unsigned int count ) 00060 : Span< RowK, T >( value, count ) 00061 {} 00062 }; 00063 00064 class CoveredCell {}; 00065 static const CoveredCell covered_cell = CoveredCell(); 00066 00067 template < class T > 00068 inline ColumnSpan< T > column_span( T value, unsigned int count ) 00069 { 00070 return ColumnSpan< T >( value, count ); 00071 } 00072 00073 template < class T > 00074 inline RowSpan< T > row_span( T value, unsigned int count ) 00075 { 00076 return RowSpan< T >( value, count ); 00077 } 00078 00079 #endif // SPAN_H