kidnapper.cpp
来自「The ROSETTA C++ library is a collection 」· C++ 代码 · 共 119 行
CPP
119 行
//-------------------------------------------------------------------// Author........: Aleksander 豩rn// Date..........:// Description...:// Revisions.....://===================================================================#include <stdafx.h> // Precompiled headers.#include <copyright.h>#include <kernel/algorithms/kidnapper.h>#include <kernel/algorithms/keyword.h>#include <kernel/structures/structure.h>//-------------------------------------------------------------------// Methods for class Kidnapper.//===================================================================//-------------------------------------------------------------------// Constructors/destructor.//===================================================================Kidnapper::Kidnapper() { index_ = 0;}Kidnapper::~Kidnapper() {}//-------------------------------------------------------------------// Methods inherited from Identifier.//===================================================================IMPLEMENTIDMETHODS(Kidnapper, KIDNAPPER, ScriptAlgorithm)//-------------------------------------------------------------------// Methods inherited from Algorithm.//===================================================================//-------------------------------------------------------------------// Method........: GetParameters// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================StringKidnapper::GetParameters() const { String parameters; // Index. parameters += Keyword::Index(); parameters += Keyword::Assignment(); parameters += String::Format(GetChildIndex()); return parameters;}//-------------------------------------------------------------------// Method........: SetParameter// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================boolKidnapper::SetParameter(const String &keyword, const String &value) { // Index. if (keyword == Keyword::Index() && value.IsInteger()) return SetChildIndex(value.GetInteger()); return false;}//-------------------------------------------------------------------// Method........: IsApplicable// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================boolKidnapper::IsApplicable(const Structure &/*structure*/, bool /*warn*/) const { return true;}//-------------------------------------------------------------------// Method........: Apply// Author........: Aleksander 豩rn// Date..........:// Description...:// Comments......:// Revisions.....://===================================================================Structure *Kidnapper::Apply(Structure &structure) const { // Check applicability. if (!IsApplicable(structure)) return NULL; // Return child. return structure.GetChild(GetChildIndex());}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?