Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Annotation of /trunk/gadget/hasname.h
[mareframe] / trunk / gadget / hasname.h Repository:
ViewVC logotype

Annotation of /trunk/gadget/hasname.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (view) (download)

1 : agomez 1 #ifndef hasname_h
2 :     #define hasname_h
3 :    
4 :     #include "gadget.h"
5 :    
6 :     /**
7 :     * \class HasName
8 :     * \brief This is the base class for any object that has a name
9 :     */
10 :     class HasName {
11 :     public:
12 :     /**
13 :     * \brief This is the default HasName constructor
14 :     */
15 :     HasName() { name = new char[1]; name[0] = '\0'; };
16 :     /**
17 :     * \brief This is the default HasName destructor
18 :     * \note This will free all the memory allocated
19 :     */
20 :     virtual ~HasName() { delete[] name; };
21 :     /**
22 :     * \brief This is the HasName constructor for a specified name
23 :     * \param givenname is a text string containing the name of the object to be created
24 :     */
25 :     HasName(const char* givenname) {
26 :     name = new char[strlen(givenname) + 1];
27 :     strcpy(name, givenname);
28 :     };
29 :     /**
30 :     * \brief This will return a null terminated text string containing the name of the object
31 :     * \return name
32 :     */
33 :     const char* getName() const { return name; };
34 :     private:
35 :     /**
36 :     * \brief This is the null terminated name of the object
37 :     */
38 :     char* name;
39 :     };
40 :    
41 :     #endif

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge