• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kig

bogus_imp.cc

Go to the documentation of this file.
00001 // Copyright (C)  2002  Dominique Devriese <devriese@kde.org>
00002 
00003 // This program is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU General Public License
00005 // as published by the Free Software Foundation; either version 2
00006 // of the License, or (at your option) any later version.
00007 
00008 // This program is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 // GNU General Public License for more details.
00012 
00013 // You should have received a copy of the GNU General Public License
00014 // along with this program; if not, write to the Free Software
00015 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00016 // 02110-1301, USA.
00017 
00018 #include "bogus_imp.h"
00019 
00020 #include <qstringlist.h>
00021 #include <klocale.h>
00022 
00023 #include "../misc/rect.h"
00024 
00025 Coordinate BogusImp::attachPoint( ) const
00026 {
00027   return Coordinate::invalidCoord();
00028 }
00029 
00030 void BogusImp::draw( KigPainter& ) const
00031 {
00032 }
00033 
00034 bool BogusImp::contains( const Coordinate&, int, const KigWidget& ) const
00035 {
00036   return false;
00037 }
00038 
00039 bool BogusImp::inRect( const Rect&, int, const KigWidget& ) const
00040 {
00041   return false;
00042 }
00043 
00044 DoubleImp::DoubleImp( const double d )
00045   : mdata( d )
00046 {
00047 }
00048 
00049 IntImp::IntImp( const int d )
00050   : mdata( d )
00051 {
00052 }
00053 
00054 StringImp::StringImp( const QString& d )
00055   : mdata( d )
00056 {
00057 }
00058 
00059 DoubleImp* DoubleImp::copy() const
00060 {
00061   return new DoubleImp( mdata );
00062 }
00063 
00064 IntImp* IntImp::copy() const
00065 {
00066   return new IntImp( mdata );
00067 }
00068 
00069 StringImp* StringImp::copy() const
00070 {
00071   return new StringImp( mdata );
00072 }
00073 
00074 ObjectImp* BogusImp::transform( const Transformation& ) const
00075 {
00076   return copy();
00077 }
00078 
00079 InvalidImp* InvalidImp::copy() const
00080 {
00081   return new InvalidImp();
00082 }
00083 
00084 InvalidImp::InvalidImp()
00085 {
00086 }
00087 
00088 void InvalidImp::fillInNextEscape( QString& s, const KigDocument& ) const
00089 {
00090   s = s.arg( "[invalid]" );
00091 }
00092 
00093 void DoubleImp::fillInNextEscape( QString& s, const KigDocument& ) const
00094 {
00095   s = s.arg( mdata );
00096 }
00097 
00098 void IntImp::fillInNextEscape( QString& s, const KigDocument& ) const
00099 {
00100   s = s.arg( mdata );
00101 }
00102 
00103 void StringImp::fillInNextEscape( QString& s, const KigDocument& ) const
00104 {
00105   s = s.arg( mdata );
00106 }
00107 
00108 HierarchyImp::HierarchyImp( const ObjectHierarchy& h )
00109   : BogusImp(), mdata( h )
00110 {
00111 }
00112 
00113 HierarchyImp* HierarchyImp::copy() const
00114 {
00115   return new HierarchyImp( mdata );
00116 }
00117 
00118 void InvalidImp::visit( ObjectImpVisitor* vtor ) const
00119 {
00120   vtor->visit( this );
00121 }
00122 
00123 void DoubleImp::visit( ObjectImpVisitor* vtor ) const
00124 {
00125   vtor->visit( this );
00126 }
00127 
00128 void IntImp::visit( ObjectImpVisitor* vtor ) const
00129 {
00130   vtor->visit( this );
00131 }
00132 
00133 void StringImp::visit( ObjectImpVisitor* vtor ) const
00134 {
00135   vtor->visit( this );
00136 }
00137 
00138 void HierarchyImp::visit( ObjectImpVisitor* vtor ) const
00139 {
00140   vtor->visit( this );
00141 }
00142 
00143 TransformationImp::TransformationImp( const Transformation& h )
00144   : mdata( h )
00145 {
00146 }
00147 
00148 TransformationImp* TransformationImp::copy() const
00149 {
00150   return new TransformationImp( mdata );
00151 }
00152 
00153 void TransformationImp::visit( ObjectImpVisitor* vtor ) const
00154 {
00155   vtor->visit( this );
00156 }
00157 
00158 bool InvalidImp::equals( const ObjectImp& rhs ) const
00159 {
00160   return !rhs.valid();
00161 }
00162 
00163 bool DoubleImp::equals( const ObjectImp& rhs ) const
00164 {
00165   return rhs.inherits( DoubleImp::stype() ) &&
00166     static_cast<const DoubleImp&>( rhs ).data() == mdata;
00167 }
00168 
00169 bool IntImp::equals( const ObjectImp& rhs ) const
00170 {
00171   return rhs.inherits( IntImp::stype() ) &&
00172     static_cast<const IntImp&>( rhs ).data() == mdata;
00173 }
00174 
00175 bool StringImp::equals( const ObjectImp& rhs ) const
00176 {
00177   return rhs.inherits( StringImp::stype() ) &&
00178     static_cast<const StringImp&>( rhs ).data() == mdata;
00179 }
00180 
00181 bool HierarchyImp::equals( const ObjectImp& rhs ) const
00182 {
00183   return rhs.inherits( HierarchyImp::stype() ) &&
00184     static_cast<const HierarchyImp&>( rhs ).data() == mdata;
00185 }
00186 
00187 bool TransformationImp::equals( const ObjectImp& rhs ) const
00188 {
00189   return rhs.inherits( TransformationImp::stype() ) &&
00190     static_cast<const TransformationImp&>( rhs ).data() == mdata;
00191 }
00192 
00193 bool InvalidImp::canFillInNextEscape() const
00194 {
00195   return true;
00196 }
00197 
00198 bool DoubleImp::canFillInNextEscape() const
00199 {
00200   return true;
00201 }
00202 
00203 bool IntImp::canFillInNextEscape() const
00204 {
00205   return true;
00206 }
00207 
00208 bool StringImp::canFillInNextEscape() const
00209 {
00210   return true;
00211 }
00212 
00213 const ObjectImpType* InvalidImp::stype()
00214 {
00215   static const ObjectImpType t(
00216     Parent::stype(), "invalid", "", "", "", "", "", "", "", "", "" );
00217   return &t;
00218 }
00219 
00220 const ObjectImpType* StringImp::stype()
00221 {
00222   static const ObjectImpType t(
00223     Parent::stype(), "string",
00224     "string", "", "", "", "", "", "", "", "" );
00225   return &t;
00226 }
00227 const ObjectImpType* HierarchyImp::stype()
00228 {
00229   static const ObjectImpType t(
00230     Parent::stype(), "hierarchy", "", "", "", "", "", "", "", "", "" );
00231   return &t;
00232 }
00233 const ObjectImpType* TransformationImp::stype()
00234 {
00235   static const ObjectImpType t(
00236     Parent::stype(), "transformation", "", "", "", "", "", "", "", "", "");
00237   return &t;
00238 }
00239 
00240 const ObjectImpType* InvalidImp::type() const
00241 {
00242   return InvalidImp::stype();
00243 }
00244 
00245 const ObjectImpType* DoubleImp::type() const
00246 {
00247   return DoubleImp::stype();
00248 }
00249 
00250 const ObjectImpType* IntImp::type() const
00251 {
00252   return IntImp::stype();
00253 }
00254 
00255 const ObjectImpType* StringImp::type() const
00256 {
00257   return StringImp::stype();
00258 }
00259 
00260 const ObjectImpType* HierarchyImp::type() const
00261 {
00262   return HierarchyImp::stype();
00263 }
00264 
00265 const ObjectImpType* TransformationImp::type() const
00266 {
00267   return TransformationImp::stype();
00268 }
00269 
00270 const ObjectImpType* DoubleImp::stype()
00271 {
00272   static const ObjectImpType t(
00273     Parent::stype(), "double",
00274     "double", "", "", "", "", "", "", "", "" );
00275   return &t;
00276 }
00277 
00278 const ObjectImpType* IntImp::stype()
00279 {
00280   static const ObjectImpType t(
00281     Parent::stype(), "int",
00282     "int", "", "", "", "", "", "", "", "" );
00283   return &t;
00284 }
00285 
00286 const ObjectImpType* BogusImp::stype()
00287 {
00288   static const ObjectImpType t(
00289     Parent::stype(), "bogus",
00290     "", "", "", "", "", "", "", "", "" );
00291   return &t;
00292 }
00293 
00294 const ObjectImpType* TestResultImp::stype()
00295 {
00296   static const ObjectImpType t(
00297     Parent::stype(), "testresult", "", "", "", "", "", "", "", "", "" );
00298   return &t;
00299 
00300 }
00301 
00302 TestResultImp::TestResultImp( bool t, const QString& s )
00303   : StringImp( s ), mtruth( t )
00304 {
00305 }
00306 
00307 TestResultImp* TestResultImp::copy() const
00308 {
00309   return new TestResultImp( mtruth, data() );
00310 }
00311 
00312 const ObjectImpType* TestResultImp::type() const
00313 {
00314   return stype();
00315 }
00316 
00317 void TestResultImp::visit( ObjectImpVisitor* vtor ) const
00318 {
00319   vtor->visit( this );
00320 }
00321 
00322 bool TestResultImp::equals( const ObjectImp& rhs ) const
00323 {
00324   return rhs.inherits( TestResultImp::stype() ) &&
00325 // (FIXME?)    static_cast<const TestResultImp&>( rhs ).mdata == mdata &&
00326     static_cast<const TestResultImp&>( rhs ).mtruth == mtruth;
00327 
00328 }
00329 
00330 int TestResultImp::numberOfProperties() const
00331 {
00332   return Parent::numberOfProperties() + 1;
00333 }
00334 
00335 const QByteArrayList TestResultImp::properties() const
00336 {
00337   QByteArrayList l = Parent::properties();
00338   l << I18N_NOOP( "Test Result" );
00339   assert( l.size() == TestResultImp::numberOfProperties() );
00340   return l;
00341 }
00342 
00343 const QByteArrayList TestResultImp::propertiesInternalNames() const
00344 {
00345   QByteArrayList s = Parent::propertiesInternalNames();
00346   s << "test-result";
00347   assert( s.size() == TestResultImp::numberOfProperties() );
00348   return s;
00349 }
00350 
00351 ObjectImp* TestResultImp::property( int which, const KigDocument& d ) const
00352 {
00353   if ( which < Parent::numberOfProperties() )
00354     return Parent::property( which, d );
00355   if ( which == Parent::numberOfProperties() )
00356     return new StringImp( data() );
00357   else assert( false );
00358   return new InvalidImp;
00359 }
00360 
00361 const char* TestResultImp::iconForProperty( int which ) const
00362 {
00363   if ( which < Parent::numberOfProperties() )
00364     return Parent::iconForProperty( which );
00365   if ( which == Parent::numberOfProperties() )
00366     return ""; // test-result
00367   else assert( false );
00368   return "";
00369 }
00370 
00371 const ObjectImpType* TestResultImp::impRequirementForProperty( int which ) const
00372 {
00373   if ( which < Parent::numberOfProperties() )
00374     return Parent::impRequirementForProperty( which );
00375   else return TestResultImp::stype();
00376 }
00377 
00378 bool TestResultImp::isPropertyDefinedOnOrThroughThisImp( int which ) const
00379 {
00380   if ( which < Parent::numberOfProperties() )
00381     return Parent::impRequirementForProperty( which );
00382   else return false;
00383 }
00384 
00385 Rect BogusImp::surroundingRect() const
00386 {
00387   return Rect::invalidRect();
00388 }

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal