Eneboo - Documentación para desarrolladores
tools/aqods/odf-gen/celladdress.h
Ir a la documentación de este archivo.
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 CELLADDRESS_H
00022 #define CELLADDRESS_H
00023 
00024 #include <iostream>
00025 
00026 class CellAddress 
00027 {
00028 public:
00029     CellAddress( const std::string &sheet,
00030                  unsigned int column,
00031                  unsigned int row )
00032         : _sheet( sheet ),
00033           _column( column ),
00034           _row( row )
00035     {}
00036 
00037     std::ostream& operator << ( std::ostream& ostream ) const
00038     {
00039         ostream << "'" << _sheet << "'" 
00040                 << "." << (char)('A' + _column - 1) // XXX
00041                 << _row;
00042         return ostream;
00043     }
00044 
00045 private:
00046     std::string _sheet;
00047     unsigned int _column,
00048                  _row;
00049 };
00050 
00051 inline
00052 std::ostream& operator << ( std::ostream &ostream,
00053                             const CellAddress& address ) 
00054 {
00055     return address.operator << (ostream);
00056 }
00057 
00058 class CellRange 
00059 {
00060 public:
00061     CellRange( const CellAddress &start,
00062                const CellAddress &end )
00063         : _start( start ),
00064           _end( end )
00065     {}
00066 
00067     std::ostream& operator << ( std::ostream& ostream ) const
00068     {
00069         ostream << _start << ":" << _end;
00070         return ostream;
00071     }
00072 
00073 private:
00074     CellAddress _start,
00075                 _end;
00076 };
00077 
00078 inline 
00079 std::ostream& operator << ( std::ostream &ostream,
00080                             const CellRange& range ) 
00081 {
00082     return range.operator << (ostream);
00083 }
00084 
00085 #endif // CELLADDRESS_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'