Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / APG / Naming / Name_Binding.h
blob01e45500e4e88a5458814e594016c1b1b3e91772
1 /* -*- C++ -*- */
2 #ifndef NAME_BINDING_H
3 #define NAME_BINDING_H
5 #include "ace/OS_NS_stdlib.h"
6 #include "ace/OS_NS_string.h"
7 #include "ace/Name_Space.h"
8 #include <memory>
10 // Listing 1 code/ch21
11 class Name_Binding
13 public:
14 Name_Binding (ACE_Name_Binding *entry)
16 this->name_ = entry->name_.char_rep ();
17 this->value_ = entry->value_.char_rep ();
18 this->type_ = ACE_OS::strdup (entry->type_);
21 Name_Binding (const ACE_NS_WString &n,
22 const ACE_NS_WString &v,
23 const char *t)
25 this->name_ = n.char_rep ();
26 this->value_ = v.char_rep ();
27 this->type_ = ACE_OS::strdup (t);
30 ~Name_Binding ()
32 delete[] this->name_;
33 delete[] this->value_;
34 ACE_OS::free (const_cast<char*> (this->type_));
35 this->type_ = 0;
38 char *name ()
39 { return this->name_; }
41 char *value ()
42 { return this->value_; }
44 const char *type ()
45 { return this->type_; }
47 int int_value ()
48 { return ACE_OS::atoi (this->value ()); }
50 private:
51 char *name_;
52 char *value_;
53 char *type_;
56 typedef std::unique_ptr<Name_Binding> Name_Binding_Ptr;
57 // Listing 1
59 #endif /* NAME_BINDING_H */