NCBI C++ ToolKit
hellocmd.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef NCBI_HELLOCMD__HPP
2 #define NCBI_HELLOCMD__HPP
3 
4 /* $Id: hellocmd.hpp 90055 2020-05-06 18:48:03Z ivanov@NCBI.NLM.NIH.GOV $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Lewis Geer, Vsevolod Sandomirskiy, etc.
30 *
31 * File Description: These are the commands triggered by cgi parameters.
32 * These command classes construct the html pages returned to the user.
33 */
34 
35 #include "hellores.hpp"
36 #include <cgi/ncbires.hpp>
37 
39 
40 
41 //
42 // CHelloCommand
43 //
44 
45 // Abstract base class for hello command classes
46 
48 {
49 public:
50 
51  CHelloCommand( CNcbiResource& resource );
52  virtual ~CHelloCommand( void );
53  virtual void Execute( CCgiContext& ctx );
54  virtual string GetLink(CCgiContext&) const
55  { return string(); }
56 
57  virtual CNCBINode* CreateView( CCgiContext& ctx ) = 0;
58 
59 protected:
60 
62  { return dynamic_cast<CHelloResource&>( GetResource() ); }
63 
64  // hide operator= for this abstract class
66 
67  // returns the string used to match the name in a cgi request.
68  // e.g. for "?cmd=search", GetEntry should return "cmd"
69  virtual string GetEntry() const;
70 };
71 
72 
73 //
74 // CHelloBasicCommand
75 //
76 
77 // welcome page
78 
80 {
81 public:
82 
83  CHelloBasicCommand( CNcbiResource& resource );
84  virtual ~CHelloBasicCommand( void );
85  virtual CNcbiCommand* Clone( void ) const;
86 
87  // GetName() returns the string used to match the name in a cgi request.
88  // e.g. for "?cmd=search", GetName() should return "search"
89  virtual string GetName( void ) const;
90 
91  virtual CNCBINode* CreateView( CCgiContext& ctx );
92 };
93 
94 //
95 // CHelloReplyCommand
96 //
97 
98 // The reply hello page
99 
101 {
102 public:
103  CHelloReplyCommand( CNcbiResource& resource );
104  virtual ~CHelloReplyCommand( void );
105  virtual CNcbiCommand* Clone( void ) const;
106 
107  // GetName() returns the string used to match the name in a cgi request.
108  // e.g. for "?cmd=search", GetName() should return "search"
109  virtual string GetName( void ) const;
110 
111  virtual CNCBINode* CreateView( CCgiContext& ctx );
112 };
113 
114 
116 
117 #endif /* NCBI_HELLOCMD__HPP */
virtual string GetName(void) const
Definition: hellocmd.cpp:103
virtual CNcbiCommand * Clone(void) const
Definition: hellocmd.cpp:92
virtual CNCBINode * CreateView(CCgiContext &ctx)
Definition: hellocmd.cpp:114
CHelloBasicCommand(CNcbiResource &resource)
Definition: hellocmd.cpp:85
virtual ~CHelloBasicCommand(void)
Definition: hellocmd.cpp:89
virtual void Execute(CCgiContext &ctx)
Definition: hellocmd.cpp:63
CHelloCommand(CNcbiResource &resource)
Definition: hellocmd.cpp:48
virtual string GetLink(CCgiContext &) const
Definition: hellocmd.hpp:54
virtual CNCBINode * CreateView(CCgiContext &ctx)=0
virtual ~CHelloCommand(void)
Definition: hellocmd.cpp:52
virtual string GetEntry() const
Definition: hellocmd.cpp:58
CHelloCommand & operator=(const CHelloCommand &rhs)
CHelloResource & GetHelloResource() const
Definition: hellocmd.hpp:61
CHelloReplyCommand(CNcbiResource &resource)
Definition: hellocmd.cpp:132
virtual ~CHelloReplyCommand(void)
Definition: hellocmd.cpp:136
virtual CNCBINode * CreateView(CCgiContext &ctx)
Definition: hellocmd.cpp:160
virtual CNcbiCommand * Clone(void) const
Definition: hellocmd.cpp:139
virtual string GetName(void) const
Definition: hellocmd.cpp:149
CS_CONTEXT * ctx
Definition: t0006.c:12
string
Definition: cgiapp.hpp:687
CNcbiResource & GetResource() const
Definition: ncbires.hpp:119
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Fri Dec 08 08:23:24 2023 by modify_doxy.py rev. 669887