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

kig

  • sources
  • kde-4.14
  • kdeedu
  • kig
  • objects
object_type.cc
Go to the documentation of this file.
1 // Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
2 
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
7 
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16 // 02110-1301, USA.
17 
18 #include "object_type.h"
19 
20 #include "bogus_imp.h"
21 #include "object_type_factory.h"
22 
23 #include "../misc/coordinate.h"
24 
25 #include <qstringlist.h>
26 
27 #include <klocale.h>
28 
29 #include <iterator>
30 
31 const char* ObjectType::fullName() const
32 {
33  return mfulltypename;
34 }
35 
36 ObjectType::~ObjectType()
37 {
38 }
39 
40 ObjectType::ObjectType( const char fulltypename[] )
41  : mfulltypename( fulltypename )
42 {
43  ObjectTypeFactory::instance()->add( this );
44 }
45 
46 bool ObjectType::canMove( const ObjectTypeCalcer& ) const
47 {
48  return false;
49 }
50 
51 bool ObjectType::isFreelyTranslatable( const ObjectTypeCalcer& ) const
52 {
53  return false;
54 }
55 
56 void ObjectType::move( ObjectTypeCalcer&, const Coordinate&, const KigDocument& ) const
57 {
58  // we can't do an assert here, because sometimes ( like in
59  // ObjectABType::move, ObjectType::move is called without checking
60  // the object's canMove().
61 // assert( false );
62 }
63 
64 bool ObjectType::inherits( int ) const
65 {
66  return false;
67 }
68 
69 ArgsParserObjectType::ArgsParserObjectType( const char fulltypename[],
70  const struct ArgsParser::spec argsspec[],
71  int n )
72  : ObjectType( fulltypename ), margsparser( argsspec, n )
73 {
74 }
75 
76 const ObjectImpType* ArgsParserObjectType::impRequirement( const ObjectImp* o, const Args& parents ) const
77 {
78  return margsparser.impRequirement( o, parents );
79 }
80 
81 const ArgsParser& ArgsParserObjectType::argsParser() const
82 {
83  return margsparser;
84 }
85 
86 bool ObjectType::isTransform() const
87 {
88  return false;
89 }
90 
91 QStringList ObjectType::specialActions() const
92 {
93  return QStringList();
94 }
95 
96 void ObjectType::executeAction( int, ObjectHolder&, ObjectTypeCalcer&, KigPart&, KigWidget&,
97  NormalMode& ) const
98 {
99  assert( false );
100 }
101 
102 const Coordinate ObjectType::moveReferencePoint( const ObjectTypeCalcer& ) const
103 {
104  assert( false );
105  return Coordinate::invalidCoord();
106 }
107 
108 std::vector<ObjectCalcer*> ArgsParserObjectType::sortArgs( const std::vector<ObjectCalcer*>& args ) const
109 {
110  return margsparser.parse( args );
111 }
112 
113 Args ArgsParserObjectType::sortArgs( const Args& args ) const
114 {
115  return margsparser.parse( args );
116 }
117 
118 std::vector<ObjectCalcer*> ObjectType::movableParents( const ObjectTypeCalcer& ) const
119 {
120  return std::vector<ObjectCalcer*>();
121 }
122 
123 bool ArgsParserObjectType::isDefinedOnOrThrough( const ObjectImp* o, const Args& parents ) const
124 {
125  return margsparser.isDefinedOnOrThrough( o, parents );
126 }
127 
ObjectImpType
Instances of this class represent a certain ObjectImp type.
Definition: object_imp.h:95
ObjectType::specialActions
virtual QStringList specialActions() const
return i18n'd names for the special actions.
Definition: object_type.cc:91
ObjectType::inherits
virtual bool inherits(int type) const
Definition: object_type.cc:64
ObjectTypeFactory::add
void add(const ObjectType *type)
Definition: object_type_factory.cc:56
ObjectTypeCalcer
This is an ObjectCalcer that uses one of the various ObjectType's to calculate its ObjectImp...
Definition: object_calcer.h:183
ObjectType::movableParents
virtual std::vector< ObjectCalcer * > movableParents(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:118
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components...
Definition: coordinate.h:33
ObjectType::ObjectType
ObjectType(const char fulltypename[])
Definition: object_type.cc:40
ArgsParserObjectType::ArgsParserObjectType
ArgsParserObjectType(const char fulltypename[], const struct ArgsParser::spec argsspec[], int n)
Definition: object_type.cc:69
object_type.h
ArgsParserObjectType::margsparser
const ArgsParser margsparser
Definition: object_type.h:117
ObjectType::isTransform
virtual bool isTransform() const
is this object type a transformation type.
Definition: object_type.cc:86
object_type_factory.h
ObjectHolder
An ObjectHolder represents an object as it is known to the document.
Definition: object_holder.h:40
bogus_imp.h
Args
std::vector< const ObjectImp * > Args
Definition: objects/common.h:47
ObjectType::executeAction
virtual void executeAction(int i, ObjectHolder &o, ObjectTypeCalcer &t, KigPart &d, KigWidget &w, NormalMode &m) const
execute the i 'th action from the specialActions above.
Definition: object_type.cc:96
ObjectTypeFactory::instance
static ObjectTypeFactory * instance()
Definition: object_type_factory.cc:50
KigWidget
This class is the real widget showing the document.
Definition: kig_view.h:50
ArgsParserObjectType::argsParser
const ArgsParser & argsParser() const
Definition: object_type.cc:81
QStringList
ArgsParser::spec
Definition: argsparser.h:113
ArgsParser
This class is meant to take care of checking the types of the parents to ObjectCalcer's, and to put them in the correct order.
Definition: argsparser.h:106
ObjectType::canMove
virtual bool canMove(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:46
ObjectType
The ObjectType class is a thing that represents the "behaviour" for a certain type.
Definition: object_type.h:32
ArgsParser::isDefinedOnOrThrough
bool isDefinedOnOrThrough(const ObjectImp *o, const Args &parents) const
Supposing that parents would be given as parents, this function returns whether the returned ObjectIm...
Definition: argsparser.cpp:236
ObjectType::moveReferencePoint
virtual const Coordinate moveReferencePoint(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:102
ArgsParserObjectType::isDefinedOnOrThrough
bool isDefinedOnOrThrough(const ObjectImp *o, const Args &parents) const
Supposing that parents would be given as parents to this type's calc function, this function returns ...
Definition: object_type.cc:123
Coordinate::invalidCoord
static Coordinate invalidCoord()
Create an invalid Coordinate.
Definition: coordinate.cpp:171
ArgsParser::impRequirement
const ObjectImpType * impRequirement(const ObjectImp *o, const Args &parents) const
returns the minimal ObjectImp ID that o needs to inherit in order to be useful.
Definition: argsparser.cpp:185
ObjectType::move
virtual void move(ObjectTypeCalcer &ourobj, const Coordinate &to, const KigDocument &d) const
Definition: object_type.cc:56
KigDocument
KigDocument is the class holding the real data in a Kig document.
Definition: kig_document.h:36
ObjectType::~ObjectType
virtual ~ObjectType()
Definition: object_type.cc:36
ObjectType::fullName
const char * fullName() const
Definition: object_type.cc:31
ObjectImp
The ObjectImp class represents the behaviour of an object after it is calculated. ...
Definition: object_imp.h:226
KigPart
This is a "Part".
Definition: kig_part.h:68
ArgsParserObjectType::sortArgs
std::vector< ObjectCalcer * > sortArgs(const std::vector< ObjectCalcer * > &args) const
Definition: object_type.cc:108
ArgsParserObjectType::impRequirement
const ObjectImpType * impRequirement(const ObjectImp *o, const Args &parents) const
Supposing that parents would be given as parents to this type's calc function, this function returns ...
Definition: object_type.cc:76
NormalMode
Definition: normal.h:26
ObjectType::isFreelyTranslatable
virtual bool isFreelyTranslatable(const ObjectTypeCalcer &ourobj) const
Definition: object_type.cc:51
ArgsParser::parse
Args parse(const Args &os) const
Definition: argsparser.cpp:135
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:12:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kig

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

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal