diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-11 21:51:45 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-12-11 21:51:45 +0900 |
commit | 65a9f54e1051ee8ab936975e78dcb7117b265ef5 (patch) | |
tree | 4eb0dc3c3c34f8e744e70a6478cce1b5d18d9eca /kig/scripting/python_type.cc | |
parent | 2f2f921072921d62baf5cffc44fb53ce516afebe (diff) | |
download | tdeedu-65a9f54e1051ee8ab936975e78dcb7117b265ef5.tar.gz tdeedu-65a9f54e1051ee8ab936975e78dcb7117b265ef5.zip |
Renaming of files in preparation for code style tools.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'kig/scripting/python_type.cc')
-rw-r--r-- | kig/scripting/python_type.cc | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/kig/scripting/python_type.cc b/kig/scripting/python_type.cc deleted file mode 100644 index cc5a00ea..00000000 --- a/kig/scripting/python_type.cc +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright (C) 2003 Dominique Devriese <devriese@kde.org> - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -// 02110-1301, USA. - -#include "python_type.h" - -#include "python_scripter.h" - -#include "../objects/object_imp.h" -#include "../objects/bogus_imp.h" - -class PythonCompiledScriptImp - : public BogusImp -{ - mutable CompiledPythonScript mscript; -public: - typedef BogusImp Parent; - static const ObjectImpType* stype(); - const ObjectImpType* type() const; - - PythonCompiledScriptImp( const CompiledPythonScript& s ); - - void visit( ObjectImpVisitor* vtor ) const; - ObjectImp* copy() const; - bool equals( const ObjectImp& rhs ) const; - - bool isCache() const; - - CompiledPythonScript& data() const { return mscript; }; -}; - -PythonCompiledScriptImp::PythonCompiledScriptImp( const CompiledPythonScript& s ) - : BogusImp(), mscript( s ) -{ - -} - -const ObjectImpType* PythonCompiledScriptImp::stype() -{ - static const ObjectImpType t( BogusImp::stype(), "python-compiled-script-imp", - 0, 0, 0, 0, 0, 0, 0, 0, 0 ); - return &t; -} - -const ObjectImpType* PythonCompiledScriptImp::type() const -{ - return PythonCompiledScriptImp::stype(); -} - -void PythonCompiledScriptImp::visit( ObjectImpVisitor* ) const -{ - // TODO ? -} - -ObjectImp* PythonCompiledScriptImp::copy() const -{ - return new PythonCompiledScriptImp( mscript ); -} - -bool PythonCompiledScriptImp::equals( const ObjectImp& ) const -{ - // problem ? - return true; -} - -bool PythonCompiledScriptImp::isCache() const -{ - return true; -} - -KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( PythonCompileType ) - -PythonCompileType::PythonCompileType() - : ObjectType( "PythonCompileType" ) -{ -} - -PythonCompileType::~PythonCompileType() -{ -} - -const PythonCompileType* PythonCompileType::instance() -{ - static const PythonCompileType t; - return &t; -} - -const ObjectImpType* PythonCompileType::impRequirement( const ObjectImp*, const Args& ) const -{ - return StringImp::stype(); -} - -const ObjectImpType* PythonCompileType::resultId() const -{ - return PythonCompiledScriptImp::stype(); -} - -ObjectImp* PythonCompileType::calc( const Args& parents, const KigDocument& ) const -{ - assert( parents.size() == 1 ); - if ( !parents[0]->inherits( StringImp::stype() ) ) return new InvalidImp; - - const StringImp* si = static_cast<const StringImp*>( parents[0] ); - TQString s = si->data(); - - CompiledPythonScript cs = PythonScripter::instance()->compile( s.latin1() ); - - if ( cs.valid() ) - return new PythonCompiledScriptImp( cs ); - else - return new InvalidImp(); -} - -KIG_INSTANTIATE_OBJECT_TYPE_INSTANCE( PythonExecuteType ) - -PythonExecuteType::PythonExecuteType() - : ObjectType( "PythonExecuteType" ) -{ -} - -PythonExecuteType::~PythonExecuteType() -{ -} - -const PythonExecuteType* PythonExecuteType::instance() -{ - static const PythonExecuteType t; - return &t; -} - -ObjectImp* PythonExecuteType::calc( const Args& parents, const KigDocument& d ) const -{ - assert( parents.size() >= 1 ); - if( !parents[0]->inherits( PythonCompiledScriptImp::stype() ) ) return new InvalidImp; - - CompiledPythonScript& script = static_cast<const PythonCompiledScriptImp*>( parents[0] )->data(); - - Args args( parents.begin() + 1, parents.end() ); - return script.calc( args, d ); -} - -const ObjectImpType* PythonExecuteType::impRequirement( const ObjectImp* o, const Args& parents ) const -{ - if ( o == parents[0] ) return PythonCompiledScriptImp::stype(); - else return ObjectImp::stype(); -} - -const ObjectImpType* PythonExecuteType::resultId() const -{ - return ObjectImp::stype(); -} - -std::vector<ObjectCalcer*> PythonCompileType::sortArgs( const std::vector<ObjectCalcer*>& args ) const -{ - return args; -} - -Args PythonCompileType::sortArgs( const Args& args ) const -{ - return args; -} - -std::vector<ObjectCalcer*> PythonExecuteType::sortArgs( const std::vector<ObjectCalcer*>& args ) const -{ - return args; -} - -Args PythonExecuteType::sortArgs( const Args& args ) const -{ - return args; -} - -bool PythonCompileType::isDefinedOnOrThrough( const ObjectImp*, const Args& ) const -{ - return false; -} - -bool PythonExecuteType::isDefinedOnOrThrough( const ObjectImp*, const Args& ) const -{ - return false; -} - |