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/georges__loader_8cpp-source.html | 405 ++++++++++++++++++++++ 1 file changed, 405 insertions(+) create mode 100644 docs/doxygen/nel/georges__loader_8cpp-source.html (limited to 'docs/doxygen/nel/georges__loader_8cpp-source.html') diff --git a/docs/doxygen/nel/georges__loader_8cpp-source.html b/docs/doxygen/nel/georges__loader_8cpp-source.html new file mode 100644 index 00000000..46a04b4b --- /dev/null +++ b/docs/doxygen/nel/georges__loader_8cpp-source.html @@ -0,0 +1,405 @@ + + + + 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  
+

georges_loader.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/georges/georges_loader.h"
+00028 
+00029 #include "nel/misc/path.h"
+00030 #include "nel/georges/form_body_elt_atom.h"
+00031 #include "nel/georges/form_body_elt_struct.h"
+00032 #include "nel/georges/form_body_elt_list.h"
+00033 #include "nel/georges/mold_elt_type.h"
+00034 
+00035 namespace NLGEORGES
+00036 {
+00037 
+00039 // Construction/Destruction
+00041 
+00042 bool CLoader::_Initialized = false;
+00043 
+00044 CLoader::CLoader()
+00045 {
+00046         ml.SetLoader( this );
+00047         if (!CLoader::_Initialized)
+00048         {
+00049                 NLMISC::IClassable *p = NLMISC::CClassRegistry::create("CFormBodyElt");
+00050                 if(p == NULL) 
+00051                 {
+00052                         NLMISC_REGISTER_CLASS (CFormBodyElt);
+00053                 }
+00054                 else 
+00055                         delete p;
+00056                 p = NLMISC::CClassRegistry::create("CFormBodyEltAtom");
+00057                 if(p == NULL) 
+00058                 {
+00059                         NLMISC_REGISTER_CLASS (CFormBodyEltAtom);
+00060                 }
+00061                 else 
+00062                         delete p;
+00063                 p = NLMISC::CClassRegistry::create("CFormBodyEltList");
+00064                 if(p == NULL)
+00065                 {
+00066                         NLMISC_REGISTER_CLASS (CFormBodyEltList);
+00067                 }
+00068                 else 
+00069                         delete p;
+00070                 p = NLMISC::CClassRegistry::create("CFormBodyEltStruct");
+00071                 if(p == NULL) 
+00072                 {
+00073                         NLMISC_REGISTER_CLASS (CFormBodyEltStruct);
+00074                 }
+00075                 else 
+00076                         delete p;
+00077                 CLoader::_Initialized = true;
+00078         }
+00079 }
+00080 
+00081 CLoader::~CLoader()
+00082 {
+00083 }
+00084 
+00085 void CLoader::LoadForm( CForm& _f, const CStringEx& _sxfullname )
+00086 {
+00087         fl.LoadForm( _f, _sxfullname );
+00088 }
+00089 
+00090 void CLoader::LoadForm( CForm& _f, const CStringEx& _sxfullname, const CStringEx& _sxdate ) 
+00091 {
+00092         fl.LoadForm( _f, _sxfullname, _sxdate );
+00093 }
+00094 
+00095 void CLoader::LoadSearchForm( CForm& _f, const CStringEx& _sxfilename )
+00096 {
+00097         fl.LoadForm( _f, WhereIsForm( _sxfilename ) );
+00098 }
+00099 
+00100 void CLoader::LoadSearchForm( CForm& _f, const CStringEx& _sxfilename, const CStringEx& _sxdate ) 
+00101 {
+00102         fl.LoadForm( _f, WhereIsForm( _sxfilename ), _sxdate );
+00103 }
+00104 
+00105 void CLoader::SaveForm( CForm& _f, const CStringEx& _sxfullname )
+00106 {
+00107         fl.SaveForm( _f, _sxfullname );
+00108 }
+00109 
+00110 CMoldElt* CLoader::LoadMold( const CStringEx &_sxfilename )
+00111 {
+00112         return( ml.LoadMold( _sxfilename ) );
+00113 }
+00114 
+00115 CMoldElt* CLoader::LoadMold( const CStringEx &_sxfilename, const CStringEx &_sxdate ) 
+00116 {
+00117         return( ml.LoadMold( _sxfilename, _sxdate ) );
+00118 }
+00119 
+00120 void CLoader::SetWorkDirectory( const CStringEx &_sxworkdirectory )
+00121 {
+00122         if( sxworkdirectory != _sxworkdirectory )
+00123         {
+00124                 sxworkdirectory = _sxworkdirectory;
+00125                 NLMISC::CPath::removeAllAlternativeSearchPath();
+00126                 NLMISC::CPath::addSearchPath( sxworkdirectory, true, true );
+00127                 NLMISC::CPath::addSearchPath( sxrootdirectory, true, true );
+00128         }
+00129 }
+00130 
+00131 void CLoader::SetRootDirectory( const CStringEx &_sxrootdirectory )
+00132 {
+00133         if( sxrootdirectory != _sxrootdirectory )
+00134         {
+00135                 sxrootdirectory = _sxrootdirectory;
+00136                 NLMISC::CPath::removeAllAlternativeSearchPath();
+00137                 NLMISC::CPath::addSearchPath( sxworkdirectory, true, true );
+00138                 NLMISC::CPath::addSearchPath( sxrootdirectory, true, true );
+00139         }
+00140 }
+00141 
+00142 CStringEx CLoader::GetWorkDirectory() const
+00143 {
+00144         return( sxworkdirectory );
+00145 }
+00146 
+00147 CStringEx CLoader::GetRootDirectory() const
+00148 {
+00149         return( sxrootdirectory );
+00150 }
+00151 
+00152 CStringEx CLoader::WhereIsDfnTyp( const CStringEx &_sxfilename )
+00153 {
+00154         return( NLMISC::CPath::lookup( _sxfilename, false ) );
+00155 }
+00156 
+00157 CStringEx CLoader::WhereIsForm( const CStringEx &_sxfilename )
+00158 {
+00159         return( NLMISC::CPath::lookup( _sxfilename, false ) );
+00160 }
+00161 
+00162 void CLoader::MakeDfn( const CStringEx &_sxfullname, const std::vector< std::pair< CStringEx, CStringEx > >* const _pvdefine )
+00163 {
+00164         CFormFile pff;
+00165         CForm f;
+00166 
+00167         CFormBodyEltStruct* pbody = f.GetBody();
+00168         CFormBodyEltAtom* pfbea;
+00169 
+00170         if( ( _pvdefine )&&( !_pvdefine->empty() ) )
+00171                 for( std::vector< std::pair< CStringEx, CStringEx > >::const_iterator it = _pvdefine->begin(); it != _pvdefine->end(); ++it )
+00172                 {
+00173                         pfbea = new CFormBodyEltAtom;
+00174                         pfbea->SetName( it->first );
+00175                         pfbea->SetValue( it->second );
+00176                         pbody->AddElt( pfbea );
+00177                 }
+00178 
+00179         pff.SetForm( f );
+00180         pff.Save( _sxfullname );
+00181 }
+00182 
+00183 void CLoader::MakeTyp( const CStringEx &_sxfullname, const CStringEx &_sxtype, const CStringEx &_sxformula, const CStringEx &_sxenum, const CStringEx &_sxlow, const CStringEx &_sxhigh, const CStringEx &_sxdefault, const std::vector< std::pair< CStringEx, CStringEx > >* const _pvpredef , const std::vector< std::pair< CStringEx, CStringEx > >* const _pvparent )
+00184 {
+00185         CFormFile pff;
+00186         CForm f;
+00187 
+00188         CFormBodyEltStruct* pbody = f.GetBody();
+00189         CFormBodyEltAtom* pfbea;
+00190         CFormBodyEltList* pfbel;
+00191         CFormBodyEltStruct* pfbes;
+00192 
+00193         pfbea = new CFormBodyEltAtom;
+00194         pfbea->SetName( "Type" );
+00195         pfbea->SetValue( _sxtype );
+00196         pbody->AddElt( pfbea );
+00197 
+00198         pfbea = new CFormBodyEltAtom;
+00199         pfbea->SetName( "Enum" );
+00200         pfbea->SetValue( _sxenum );
+00201         pbody->AddElt( pfbea );
+00202 
+00203         pfbea = new CFormBodyEltAtom;
+00204         pfbea->SetName( "Formula" );
+00205         pfbea->SetValue( _sxformula );
+00206         pbody->AddElt( pfbea );
+00207 
+00208         pfbea = new CFormBodyEltAtom;
+00209         pfbea->SetName( "Lowlimit" );
+00210         pfbea->SetValue( _sxlow );
+00211         pbody->AddElt( pfbea );
+00212 
+00213         pfbea = new CFormBodyEltAtom;
+00214         pfbea->SetName( "Highlimit" );
+00215         pfbea->SetValue( _sxhigh );
+00216         pbody->AddElt( pfbea );
+00217 
+00218         pfbea = new CFormBodyEltAtom;
+00219         pfbea->SetName( "DefaultValue" );
+00220         pfbea->SetValue( _sxdefault );
+00221         pbody->AddElt( pfbea );
+00222 
+00223         CStringEx sx;
+00224 
+00225         if( ( _pvpredef )&&( !_pvpredef->empty() ) )
+00226         {
+00227                 pfbel = new CFormBodyEltList;
+00228                 pfbel->SetName( "Predef" );
+00229                 int i = 0;
+00230                 for( std::vector< std::pair< CStringEx, CStringEx > >::const_iterator it = _pvpredef->begin(); it != _pvpredef->end(); ++it )
+00231                 {
+00232                         pfbes = new CFormBodyEltStruct;
+00233                         sx.format( "#%d", i++ );
+00234                         pfbes->SetName( sx );
+00235                         pfbel->AddElt( pfbes );
+00236                         
+00237                         pfbea = new CFormBodyEltAtom;
+00238                         pfbea->SetName( "Designation" );
+00239                         pfbea->SetValue( it->first );
+00240                         pfbes->AddElt( pfbea );
+00241 
+00242                         pfbea = new CFormBodyEltAtom;
+00243                         pfbea->SetName( "Substitute" );
+00244                         pfbea->SetValue( it->second );
+00245                         pfbes->AddElt( pfbea );
+00246                 }
+00247                 pbody->AddElt( pfbel );
+00248         }
+00249 
+00250         if( ( _pvparent )&&( !_pvparent->empty() ) )
+00251         {
+00252                 pfbel = new CFormBodyEltList;
+00253                 pfbel->SetName( "Parents" );
+00254                 int i = 0;
+00255                 for( std::vector< std::pair< CStringEx, CStringEx > >::const_iterator it = _pvparent->begin(); it != _pvparent->end(); ++it )
+00256                 {
+00257                         pfbes = new CFormBodyEltStruct;
+00258                         sx.format( "#%d", i++ );
+00259                         pfbes->SetName( sx );
+00260                         pfbel->AddElt( pfbes );
+00261 
+00262                         pfbea = new CFormBodyEltAtom;
+00263                         pfbea->SetName( "Activity" );
+00264                         pfbea->SetValue( it->first );
+00265                         pfbes->AddElt( pfbea );
+00266 
+00267                         pfbea = new CFormBodyEltAtom;
+00268                         pfbea->SetName( "Filename" );
+00269                         pfbea->SetValue( it->second );
+00270                         pfbes->AddElt( pfbea );
+00271                 }
+00272                 pbody->AddElt( pfbel );
+00273         }
+00274 
+00275         pff.SetForm( f );
+00276         pff.Save( _sxfullname );
+00277 }
+00278 
+00279 void CLoader::SetTypPredef( const CStringEx &_sxfilename, const std::vector< CStringEx >& _pvsx )
+00280 {
+00281         CMoldElt*pme = LoadMold( _sxfilename );
+00282         CMoldEltType* pmet = dynamic_cast< CMoldEltType* >( pme );
+00283         pmet->SetTypPredef( _pvsx );
+00284         pmet->Save();
+00285 }
+00286 
+00287 
+00288 /*
+00289 CStringEx CLoader::WhereIs( const CStringEx _sxdirectory, const CStringEx _sxfilename )
+00290 {
+00291         if( _sxfilename.empty() )
+00292                 return( CStringEx() );
+00293 
+00294         _finddata_t info;
+00295         CStringEx searchname = _sxdirectory +_sxfilename;
+00296         long lhandle = _findfirst( searchname.c_str(), &info );
+00297         if( lhandle != -1 )
+00298         {
+00299                 _findclose( lhandle );
+00300                 return( searchname );
+00301         }
+00302 
+00303         searchname = CStringEx( _sxdirectory + "*.*" );
+00304         lhandle = _findfirst( searchname.c_str(), &info ); 
+00305         do
+00306         {
+00307                 if( !(info.attrib & _A_SUBDIR ) )
+00308                         continue;
+00309                 if( ( info.name == "." )||( info.name == ".." ) )
+00310                         continue;
+00311                 CStringEx sxresult = WhereIs( CStringEx( _sxdirectory + info.name ), _sxfilename );
+00312                 if( !sxresult.empty() )
+00313                         return( sxresult );
+00314         }
+00315         while( _findnext( lhandle, &info ) != -1 );
+00316         
+00317         _findclose( lhandle );
+00318         return( CStringEx() );
+00319 }
+00320 
+00321 CStringEx CLoader::WhereIsDfnTyp( const CStringEx _sxfilename )
+00322 {
+00323         CStringEx sxfullname = WhereIs( CStringEx( sxworkdirectory +"dfn/" ), _sxfilename );
+00324         if( sxfullname.empty() && ( sxrootdirectory != sxworkdirectory ) )
+00325                 sxfullname = WhereIs( CStringEx( sxrootdirectory +"dfn/" ), _sxfilename );
+00326         return( sxfullname );
+00327 }
+00328 
+00329 CStringEx CLoader::WhereIsForm( const CStringEx _sxfilename )
+00330 {
+00331         CStringEx sxfullname = WhereIs( sxworkdirectory, _sxfilename );
+00332         if( sxfullname.empty() && ( sxrootdirectory != sxworkdirectory ) )
+00333                 sxfullname = WhereIs( sxrootdirectory, _sxfilename );
+00334         return( sxfullname );
+00335 }
+00336 */
+00337 
+00338 }
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1