From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../nel/form__body__elt__struct_8cpp-source.html | 361 +++++++++++++++++++++ 1 file changed, 361 insertions(+) create mode 100644 docs/doxygen/nel/form__body__elt__struct_8cpp-source.html (limited to 'docs/doxygen/nel/form__body__elt__struct_8cpp-source.html') diff --git a/docs/doxygen/nel/form__body__elt__struct_8cpp-source.html b/docs/doxygen/nel/form__body__elt__struct_8cpp-source.html new file mode 100644 index 00000000..0427303d --- /dev/null +++ b/docs/doxygen/nel/form__body__elt__struct_8cpp-source.html @@ -0,0 +1,361 @@ + + + + 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_body_elt_struct.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/form_body_elt_struct.h"
+00028 #include "nel/georges/form_body_elt_list.h"
+00029 #include "nel/georges/form_body_elt_atom.h"
+00030 
+00031 namespace NLGEORGES
+00032 {
+00033 
+00035 // Construction/Destruction
+00037 
+00038 CFormBodyEltStruct::CFormBodyEltStruct()
+00039 {
+00040 }
+00041 
+00042 CFormBodyEltStruct::CFormBodyEltStruct( const CFormBodyEltStruct& _fbes )
+00043 {
+00044         sxname = _fbes.sxname;
+00045         for( std::vector< CFormBodyElt* >::const_iterator it = _fbes.vpbodyelt.begin(); it != _fbes.vpbodyelt.end(); ++it )
+00046                 vpbodyelt.push_back( (*it)->Clone() );
+00047 }
+00048 
+00049 CFormBodyEltStruct::~CFormBodyEltStruct()
+00050 {
+00051         Clear();
+00052 }
+00053 
+00054 void CFormBodyEltStruct::Clear()
+00055 {
+00056         for( std::vector< CFormBodyElt* >::iterator it = vpbodyelt.begin(); it != vpbodyelt.end(); ++it )
+00057                 if( *it )
+00058                         delete *it;
+00059         vpbodyelt.clear();
+00060 }
+00061 
+00062 void CFormBodyEltStruct::serial( NLMISC::IStream& s)
+00063 {
+00064         s.xmlPushBegin( "Body" );
+00065                 s.xmlSetAttrib( "Name" );
+00066                         s.serial( sxname );
+00067         s.xmlPushEnd();
+00068                 s.serialContPolyPtr( vpbodyelt );
+00069         s.xmlPop();
+00070 }
+00071 
+00072 std::vector< CFormBodyElt* >::iterator CFormBodyEltStruct::Find( const CStringEx _sxname ) 
+00073 {
+00074   std::vector< CFormBodyElt* >::iterator it;
+00075         for( it = vpbodyelt.begin(); it != vpbodyelt.end(); ++it )
+00076                 if( (*it)->GetName() == _sxname )
+00077                         return it;
+00078         return it;
+00079 }
+00080 
+00081 std::vector< CFormBodyElt* >::const_iterator CFormBodyEltStruct::Find( const CStringEx _sxname ) const 
+00082 {
+00083   std::vector< CFormBodyElt* >::const_iterator it;
+00084         for( it = vpbodyelt.begin(); it != vpbodyelt.end(); ++it )
+00085                 if( (*it)->GetName() == _sxname )
+00086                         return it;
+00087         return it;
+00088 }
+00089 
+00090 CFormBodyElt& CFormBodyEltStruct::operator =( const CFormBodyElt& _fbe )
+00091 {
+00092         const CFormBodyEltStruct* pfbes = dynamic_cast< const CFormBodyEltStruct* >( &_fbe );      
+00093         nlassert( pfbes );
+00094         Clear();
+00095         sxname = pfbes->sxname;
+00096         for( std::vector< CFormBodyElt* >::const_iterator it = pfbes->vpbodyelt.begin(); it != pfbes->vpbodyelt.end(); ++it )
+00097                 vpbodyelt.push_back( (*it)->Clone() );
+00098         return( *this );
+00099 }
+00100 
+00101 CFormBodyElt& CFormBodyEltStruct::operator =( const CFormBodyEltStruct& _fbes )
+00102 {
+00103         Clear();
+00104         sxname = _fbes.sxname;
+00105         for( std::vector< CFormBodyElt* >::const_iterator it = _fbes.vpbodyelt.begin(); it != _fbes.vpbodyelt.end(); ++it )
+00106                 vpbodyelt.push_back( (*it)->Clone() );
+00107         return( *this );
+00108 }
+00109 
+00110 CFormBodyElt& CFormBodyEltStruct::operator +=( const CFormBodyElt& _fbe )
+00111 {
+00112         const CFormBodyEltStruct* pfbes = dynamic_cast< const CFormBodyEltStruct* >( &_fbe );      
+00113         nlassert( pfbes );
+00114         for( std::vector< CFormBodyElt* >::const_iterator it = pfbes->vpbodyelt.begin(); it != pfbes->vpbodyelt.end(); ++it )
+00115         {
+00116                 std::vector< CFormBodyElt* >::iterator iu = Find( (*it)->GetName() );
+00117                 if( iu == vpbodyelt.end() )
+00118                 {
+00119                         vpbodyelt.push_back( (*it)->Clone() );
+00120                         iu = vpbodyelt.end();                                                                   
+00121                         --iu;
+00122                 }
+00123                 **iu += **it;   
+00124         }
+00125         return( *this );
+00126 }
+00127 
+00128 CFormBodyElt& CFormBodyEltStruct::operator -=( const CFormBodyElt& _fbe )
+00129 {
+00130         const CFormBodyEltStruct* pfbes = dynamic_cast< const CFormBodyEltStruct* >( &_fbe );      
+00131         nlassert( pfbes );
+00132         for( std::vector< CFormBodyElt* >::const_iterator it = pfbes->vpbodyelt.begin(); it != pfbes->vpbodyelt.end(); ++it )
+00133         {
+00134                 std::vector< CFormBodyElt* >::iterator iu = Find( (*it)->GetName() );
+00135                 if( iu == vpbodyelt.end() )
+00136                         continue;
+00137                 **iu -= **it;
+00138                 if( (*iu)->Empty() )
+00139                 {
+00140                         delete( *iu );
+00141                         vpbodyelt.erase( iu );
+00142                 }
+00143         }
+00144         return( *this );
+00145 }
+00146 
+00147 bool CFormBodyEltStruct::operator ==( const CFormBodyElt& _fbe ) const
+00148 {
+00149         const CFormBodyEltStruct* pfbes = dynamic_cast< const CFormBodyEltStruct* >( &_fbe );      
+00150         nlassert( pfbes );
+00151         if( vpbodyelt.size() != pfbes->vpbodyelt.size() )
+00152                 return( false );
+00153         for( std::vector< CFormBodyElt* >::const_iterator it = pfbes->vpbodyelt.begin(); it != pfbes->vpbodyelt.end(); ++it )
+00154         {
+00155                 std::vector< CFormBodyElt* >::const_iterator iu =  Find( (*it)->GetName() );
+00156                 if( ( iu == vpbodyelt.end() )||( !(**iu == **it) ) )
+00157                         return false;
+00158         }
+00159         return( true );
+00160 }
+00161 
+00162 CFormBodyElt* CFormBodyEltStruct::Clone() const 
+00163 {
+00164         return( new CFormBodyEltStruct( *this ) );
+00165 }
+00166 
+00167 bool CFormBodyEltStruct::Empty() const
+00168 {
+00169         return( vpbodyelt.empty() );
+00170 }
+00171 
+00172 uint32 CFormBodyEltStruct::GetNbElt () const
+00173 {
+00174         return vpbodyelt.size();
+00175 }
+00176 
+00177 CFormBodyElt* CFormBodyEltStruct::GetElt( const unsigned int _index ) const
+00178 {
+00179         if( _index >= vpbodyelt.size() )
+00180                 return( 0 );
+00181         return( vpbodyelt[_index] ); 
+00182 }
+00183 
+00184 CFormBodyElt* CFormBodyEltStruct::GetElt( const CStringEx _sxname ) const
+00185 {
+00186         std::vector< CFormBodyElt* >::const_iterator it = Find( _sxname );
+00187         if( it == vpbodyelt.end() ) 
+00188                 return( 0 );
+00189         return( *it );
+00190 }
+00191 
+00192 CStringEx CFormBodyEltStruct::GetComment() const
+00193 {
+00194         std::vector< CFormBodyElt* >::const_iterator it =  Find( SXCOMMENT );
+00195         if( it == vpbodyelt.end() )
+00196           {
+00197             CStringEx object;
+00198                 return( object );
+00199           }                                                     
+00200         const CFormBodyEltAtom* pfbea = dynamic_cast< CFormBodyEltAtom* >( *it );      
+00201         nlassert( pfbea );
+00202         return pfbea->GetValue();
+00203 }
+00204 
+00205 void CFormBodyEltStruct::SetComment( const CStringEx _sxcomment )
+00206 {
+00207         // todo
+00208 }
+00209 
+00210 CStringEx CFormBodyEltStruct::GetParent( unsigned int _index ) const
+00211 {
+00212         std::vector< CFormBodyElt* >::const_iterator it =  Find( SXPARENTS );
+00213         if( it == vpbodyelt.end() )
+00214           {
+00215             CStringEx object;
+00216                 return( object );
+00217           }                                                                     
+00218         const CFormBodyEltList* pfbel = dynamic_cast< CFormBodyEltList* >( *it );      
+00219         if( !pfbel )
+00220           {
+00221             CStringEx object;
+00222                 return( object );
+00223           }                                                                     
+00224         const CFormBodyEltStruct* pfbes = dynamic_cast< CFormBodyEltStruct* >( pfbel->GetElt( _index ) );      
+00225         if( !pfbes )
+00226           {
+00227             CStringEx object;
+00228                 return( object );
+00229           }                                                                     
+00230 /*
+00231 
+00232         const CFormBodyEltAtom* pfbea = dynamic_cast< CFormBodyEltAtom* >( pfbes->GetElt( "Activity" ) );      
+00233         if( !pfbea )
+00234                 return( CStringEx() );
+00235         CStringEx sxactivity = pfbea->GetValue();
+00236         if( sxactivity != "true" )
+00237                 return( CStringEx(" ") );
+00238 */
+00239                 const CFormBodyEltAtom* pfbea = dynamic_cast< CFormBodyEltAtom* >( pfbes->GetElt( "Filename" ) );      
+00240 //      pfbea = dynamic_cast< CFormBodyEltAtom* >( pfbes->GetElt( "Filename" ) );
+00241         if( !pfbea )
+00242           {
+00243             CStringEx object;
+00244             return( object );
+00245           }
+00246         return pfbea->GetValue();
+00247 
+00248 }
+00249 
+00250 CStringEx CFormBodyEltStruct::GetActivity( unsigned int _index ) const
+00251 {
+00252         std::vector< CFormBodyElt* >::const_iterator it =  Find( SXPARENTS );
+00253         if( it == vpbodyelt.end() )
+00254           {
+00255             CStringEx object;
+00256                 return( object );
+00257           }                                                                     
+00258         const CFormBodyEltList* pfbel = dynamic_cast< CFormBodyEltList* >( *it );      
+00259         if( !pfbel )
+00260           {
+00261             CStringEx object;
+00262                 return( object );
+00263           }                                                                     
+00264         const CFormBodyEltStruct* pfbes = dynamic_cast< CFormBodyEltStruct* >( pfbel->GetElt( _index ) );      
+00265         if( !pfbes )
+00266           {
+00267             CStringEx object;
+00268                 return( object );
+00269           }                                                                     
+00270         const CFormBodyEltAtom* pfbea = dynamic_cast< CFormBodyEltAtom* >( pfbes->GetElt( "Activity" ) );      
+00271         if( !pfbea )
+00272           {
+00273             CStringEx object;
+00274                 return( object );
+00275           }                                                                     
+00276 /*
+00277         CStringEx sxactivity = pfbea->GetValue();
+00278         if( sxactivity != "true" )
+00279                 return( CStringEx(" ") );
+00280         pfbea = dynamic_cast< CFormBodyEltAtom* >( pfbes->GetElt( "Filename" ) );
+00281         if( !pfbea )
+00282                 return( CStringEx() );
+00283 */
+00284         return pfbea->GetValue();
+00285 }
+00286 
+00287 void CFormBodyEltStruct::AddElt( CFormBodyElt* const pfbe )
+00288 {
+00289         if( !pfbe )
+00290                 return;
+00291         vpbodyelt.push_back( pfbe );
+00292 }
+00293 
+00294 }
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1