PluginObject.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: PluginObject.cpp,v $
- * PRODUCTION Revision 1000.2 2004/06/01 20:53:48 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: PluginObject.cpp,v 1000.2 2004/06/01 20:53:48 gouriano Exp $
- * ===========================================================================
- *
- * PUBLIC DOMAIN NOTICE
- * National Center for Biotechnology Information
- *
- * This software/database is a "United States Government Work" under the
- * terms of the United States Copyright Act. It was written as part of
- * the author's official duties as a United States Government employee and
- * thus cannot be copyrighted. This software/database is freely available
- * to the public for use. The National Library of Medicine and the U.S.
- * Government have not placed any restriction on its use or reproduction.
- *
- * Although all reasonable efforts have been taken to ensure the accuracy
- * and reliability of the software and data, the NLM and the U.S.
- * Government do not and cannot warrant the performance or results that
- * may be obtained by using this software or data. The NLM and the U.S.
- * Government disclaim all warranties, express or implied, including
- * warranties of performance, merchantability or fitness for any particular
- * purpose.
- *
- * Please cite the author in any work or product based on this material.
- *
- * ===========================================================================
- *
- * Author: .......
- *
- * File Description:
- * .......
- *
- * Remark:
- * This code was originally generated by application DATATOOL
- * using specifications from the data definition file
- * 'plugin.asn'.
- */
- // standard includes
- // generated includes
- #include <ncbi_pch.hpp>
- #include <gui/plugin/PluginObject.hpp>
- // generated classes
- BEGIN_NCBI_SCOPE
- BEGIN_objects_SCOPE // namespace ncbi::objects::
- // destructor
- CPluginObject::~CPluginObject(void)
- {
- }
- //
- //
- void CPluginObject::SetDocument(const IDocument* doc)
- {
- m_Document.Reset(doc);
- m_Object.Reset (doc);
- SetDocaddr(NStr::PtrToString(m_Document.GetPointer()));
- SetObjaddr(NStr::PtrToString(m_Object.GetPointer()));
- SetSubtype("Document");
- }
- void CPluginObject::SetObject(const IDocument* doc, const CObject* obj)
- {
- m_Document.Reset(doc);
- m_Object.Reset (obj);
- SetDocaddr(NStr::PtrToString(m_Document.GetPointer()));
- SetObjaddr(NStr::PtrToString(m_Object.GetPointer()));
- // subtype determination
- SetSubtype("Object");
- {{
- const IDocument* ptr =
- dynamic_cast<const IDocument*>(m_Object.GetPointer());
- if (ptr) {
- SetSubtype("Document");
- }
- }}
- {{
- const CSerialObject* ptr =
- dynamic_cast<const CSerialObject*>(m_Object.GetPointer());
- if (ptr) {
- SetSubtype(ptr->GetThisTypeInfo()->GetName());
- }
- }}
- }
- void CPluginObject::SetObject(const CTypeInfo* info)
- {
- if (info) {
- SetObject(info->GetName());
- } else {
- SetObject("Object");
- }
- }
- void CPluginObject::SetObject(const string& type)
- {
- m_Document.Reset();
- m_Object.Reset();
- SetDocaddr(NStr::PtrToString(NULL));
- SetObjaddr(NStr::PtrToString(NULL));
- SetSubtype(type);
- }
- //
- // overloaded Assign() because we have some derived information to copy as well
- //
- void CPluginObject::UserOp_Assign(const CSerialUserOp& obj)
- {
- const CPluginObject& o = dynamic_cast<const CPluginObject&> (obj);
- // copy the address - this is the base class info
- SetDocaddr(o.GetDocaddr());
- SetObjaddr(o.GetObjaddr());
- SetSubtype(o.GetSubtype());
- // copy our derived info as well
- m_Object = o.m_Object;
- m_Document = o.m_Document;
- }
- bool CPluginObject::UserOp_Equals(const CSerialUserOp& obj) const
- {
- const CPluginObject& o = dynamic_cast<const CPluginObject&> (obj);
- return (GetDocaddr() == o.GetDocaddr() &&
- GetObjaddr() == o.GetObjaddr() &&
- GetSubtype() == o.GetSubtype() &&
- GetDocument() == o.GetDocument() &&
- GetObject() == o.GetObject());
- }
- // Reset()
- // this is overloaded from CPluginObject_Base and allows us to reset our derived
- // type information
- void CPluginObject::Reset(void)
- {
- // call the base class
- Tparent::Reset();
- // reset our specific information
- m_Object.Reset();
- m_Document.Reset();
- }
- //
- // PostRead()
- // this function is responsible for parsing any state information from our
- // address string
- //
- void CPluginObject::PostRead()
- {
- // store our pointers
- m_Document.Reset
- (static_cast<const IDocument*>(NStr::StringToPtr(GetDocaddr())));
- m_Object.Reset
- (static_cast<const CObject*>(NStr::StringToPtr(GetObjaddr())));
- /**
- //
- // store our derived object type information
- //
- SetSubtype("Object");
- // generic handling of CSerialObject-derived classes
- {{
- const CSerialObject* obj =
- dynamic_cast<const CSerialObject*>(m_Object.GetPointer());
- if (obj) {
- SetSubtype(obj->GetThisTypeInfo()->GetName());
- }
- }}
- // generic handling of IDocuments
- {{
- const IDocument* obj =
- dynamic_cast<const IDocument*>(m_Object.GetPointer());
- if (obj) {
- SetSubtype("Document");
- }
- }}
- **/
- }
- END_objects_SCOPE // namespace ncbi::objects::
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: PluginObject.cpp,v $
- * Revision 1000.2 2004/06/01 20:53:48 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3
- *
- * Revision 1.3 2004/05/21 22:27:46 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.2 2004/02/04 13:36:42 dicuccio
- * Implemented resetting of object-based arguments
- *
- * Revision 1.1 2003/10/27 17:44:33 dicuccio
- * Reworked CPluginValue to be a variant. Removed ad hoc URL encoding
- *
- *
- * ===========================================================================
- */
- /* Original file checksum: lines: 64, chars: 1886, CRC32: f857b507 */