| 1 | /*************************************************************************** |
| 2 | persistence.h - description |
| 3 | ------------------- |
| 4 | begin : june 6th, 2003 |
| 5 | copyright : (C) 2003-2006 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: persistence.h 375 2008-10-28 14:47:15Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #ifndef _OPENCITY_PERSISTENCE_H_ |
| 21 | #define _OPENCITY_PERSISTENCE_H_ 1 |
| 22 | |
| 23 | #include "main.h" |
| 24 | |
| 25 | #include <fstream> |
| 26 | |
| 27 | /** |
| 28 | Any class which needs to save their data in the external memory for |
| 29 | future use should implement this interface. |
| 30 | */ |
| 31 | class Persistence { |
| 32 | public: |
| 33 | Persistence(); |
| 34 | virtual ~Persistence( ); |
| 35 | |
| 36 | |
| 37 | //======================================================================== |
| 38 | /** Save the data to the specified fstream |
| 39 | \param rfs A reference to a file stream which is ready for writing |
| 40 | */ |
| 41 | virtual void |
| 42 | SaveTo( std::fstream& rfs ) = 0; |
| 43 | |
| 44 | |
| 45 | //======================================================================== |
| 46 | /** Load the data from the specified stream |
| 47 | \param rfs A reference to a file stream which is ready for reading |
| 48 | */ |
| 49 | virtual void |
| 50 | LoadFrom( std::fstream& rfs ) = 0; |
| 51 | }; |
| 52 | |
| 53 | #endif |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 |