From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/form__file_8cpp-source.html | 175 +++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 docs/doxygen/nel/form__file_8cpp-source.html (limited to 'docs/doxygen/nel/form__file_8cpp-source.html') diff --git a/docs/doxygen/nel/form__file_8cpp-source.html b/docs/doxygen/nel/form__file_8cpp-source.html new file mode 100644 index 00000000..974f637b --- /dev/null +++ b/docs/doxygen/nel/form__file_8cpp-source.html @@ -0,0 +1,175 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

form_file.cpp

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 
+00026 #include "stdgeorges.h"
+00027 #include "nel/misc/file.h"
+00028 #include "nel/misc/i_xml.h"
+00029 #include "nel/misc/o_xml.h"
+00030 #include "nel/georges/form_file.h"
+00031 
+00032 namespace NLGEORGES
+00033 {
+00034 
+00036 // Construction/Destruction
+00038 
+00039 CFormFile::CFormFile()
+00040 {
+00041 }
+00042 
+00043 CFormFile::~CFormFile()
+00044 {
+00045 }
+00046 
+00047 void CFormFile::serial( NLMISC::IStream& s )
+00048 {
+00049         s.xmlPush( "File_of_forms" );
+00050                 s.serialCheck( (uint32)'FORM' );
+00051                 s.serialVersion( 0 );
+00052                 s.serialCont( lform );
+00053         s.xmlPop();
+00054 }
+00055 
+00056 void CFormFile::Load( const CStringEx _sxfullname )
+00057 {
+00058         NLMISC::CIFile fileIn;
+00059         fileIn.open( CStringEx( _sxfullname ) );
+00060         NLMISC::CIXml input;                                                                                    
+00061         input.init( fileIn );
+00062         serial( input );
+00063 }                                                                                                                                       // Exception if fileIn.close();
+00064 
+00065 void CFormFile::Save( const CStringEx _sxfullname )
+00066 {
+00067         lform.front().SetDate( "Temporary out of date" );
+00068         NLMISC::COFile fileOut;
+00069         fileOut.open( CStringEx( _sxfullname ) );
+00070         NLMISC::COXml output;                                                                                   
+00071         output.init( &fileOut );
+00072         serial( output );
+00073         output.flush();
+00074         fileOut.close();
+00075 }                                                                                                                                       // Exception if fileOut.close();
+00076 
+00077 void CFormFile::GetForm( CForm& _f ) const 
+00078 {
+00079         _f = lform.front();                                                                                             // The first form is copying
+00080 }
+00081 
+00082 void CFormFile::GetForm( CForm& _f, const CStringEx& _sxdate ) const 
+00083 {
+00084         std::list< CForm >::const_iterator cit = lform.begin();
+00085         _f = *cit;                                                                                                              // The first form is copying
+00086         while( (cit != lform.end())&&( _sxdate <= cit->GetDate() ) )
+00087                 _f += *(++cit);                                                                                         // While history's date is after the date, add history's form.
+00088 }
+00089 
+00090 void CFormFile::SetForm( CForm& _f ) 
+00091 {
+00092         if( lform.empty() )                                     
+00093         {
+00094                 lform.push_front( _f );
+00095                 return;
+00096         }
+00097 
+00098         if( ( !_f.GetModified() )||( _f == lform.front() ) )
+00099                 return;                                                                                                         // It's the same! Don't save...
+00100 
+00101         CForm f = lform.front();                                                                                // Copy the old first form
+00102         f -= _f;                                                                                                                // overwrite with differences
+00103         lform.pop_front();                                                                                              // Delete the old fist form
+00104         lform.push_front( f );                                                                                  // Replace it by differences
+00105         lform.push_front( _f );                                                                                 // Place the new form in first position
+00106 }
+00107 
+00108 }
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1