summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_type.cpp
diff options
context:
space:
mode:
authorparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-27 13:38:34 +0000
committerparsons <parsons@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-08-27 13:38:34 +0000
commitd5b1c33883bc37c2143549be0acca8be8c6c8cbb (patch)
tree32942442a886e9009d4a71d77d3184217da44c7d /TAO/TAO_IDL/be/be_type.cpp
parent51996b0dfcd0ec074bcba0422a7cce3c10d2cae1 (diff)
downloadATCD-d5b1c33883bc37c2143549be0acca8be8c6c8cbb.tar.gz
Pathes sent in for nested_type_name() and other code related to
ACE_NESTED_CLASS.
Diffstat (limited to 'TAO/TAO_IDL/be/be_type.cpp')
-rw-r--r--TAO/TAO_IDL/be/be_type.cpp43
1 files changed, 32 insertions, 11 deletions
diff --git a/TAO/TAO_IDL/be/be_type.cpp b/TAO/TAO_IDL/be/be_type.cpp
index 080bc5356a9..a5a7a5a0dca 100644
--- a/TAO/TAO_IDL/be/be_type.cpp
+++ b/TAO/TAO_IDL/be/be_type.cpp
@@ -164,10 +164,15 @@ be_type::tc_name (const char *prefix, const char *suffix)
return this->tc_name_;
}
-// XXXASG - This code works. However, whether we should generate the
+// This code works. However, whether we should generate the
// ACE_NESTED_CLASS macro or not should be based on an option to the
-// compiler. In this version, we choose to generate a relative path.
-
+// compiler. The previous version generated a relative path.
+// This version always generates ACE_NESTED_CLASS, (leave ace/ACE.h and friends
+// do the porting)
+//
+// caution: returns the same buffer pointer even if the contents may change
+// in the next call. (return std::string anyone?)
+//
// return the type name using the ACE_NESTED_CLASS macro
const char *
be_type::nested_type_name (be_decl *use_scope, const char *suffix, const char *prefix)
@@ -226,6 +231,20 @@ be_type::nested_type_name (be_decl *use_scope, const char *suffix, const char *p
def_next = ACE_OS::strstr (def_curr, "::");
use_next = ACE_OS::strstr (use_curr, "::");
+ // If the scopes are identical, don't supply them.
+ if(!ACE_OS::strcmp (def_name, use_name))
+ {
+ if (prefix)
+ ACE_OS::strcat (this->nested_type_name_, prefix);
+
+ ACE_OS::strcat (this->nested_type_name_,
+ this->local_name ()->get_string ());
+ if (suffix)
+ ACE_OS::strcat (this->nested_type_name_, suffix);
+
+ return this->nested_type_name_;
+ }
+
if (def_next)
len_to_match = ACE_OS::strlen (def_curr)
- ACE_OS::strlen (def_next);
@@ -251,9 +270,10 @@ be_type::nested_type_name (be_decl *use_scope, const char *suffix, const char *p
// initial prefix matches i.e., they have a common root
// start by initializing the macro
- //@@ ACE_OS::sprintf (this->nested_type_name_, "ACE_NESTED_CLASS (");
- //@@ ACE_OS::strcat (this->nested_type_name_, def_curr,
- //len_to_match); // initialize the first argument
+ ACE_OS::sprintf (this->nested_type_name_, "ACE_NESTED_CLASS (");
+ ACE_OS::strncat (this->nested_type_name_,
+ def_curr,
+ len_to_match); // initialize the first argument
// shift the curr scopes to the next level
def_curr = (def_next ? (def_next + 2) : 0); // skip the ::
@@ -288,9 +308,10 @@ be_type::nested_type_name (be_decl *use_scope, const char *suffix, const char *p
if (!ACE_OS::strncmp (def_curr, use_curr, len_to_match))
{
// they have same prefix, append to arg1
- //@@ ACE_OS::strcat (this->nested_type_name_, "::");
- //@@ ACE_OS::strncat (this->nested_type_name_, def_curr,
- //len_to_match);
+ ACE_OS::strcat (this->nested_type_name_, "::");
+ ACE_OS::strncat (this->nested_type_name_,
+ def_curr,
+ len_to_match);
def_curr = (def_next ? (def_next + 2) : 0); // skip the ::
use_curr = (use_next ? (use_next + 2) : 0); // skip the ::
}
@@ -303,7 +324,7 @@ be_type::nested_type_name (be_decl *use_scope, const char *suffix, const char *p
}
// start the 2nd argument of the macro
- //@@ ACE_OS::strcat (this->nested_type_name_, ", ");
+ ACE_OS::strcat (this->nested_type_name_, ", ");
// copy the remaining def_name (if any left)
if (def_curr)
@@ -318,7 +339,7 @@ be_type::nested_type_name (be_decl *use_scope, const char *suffix, const char *p
ACE_OS::strcat (this->nested_type_name_, this->local_name ()->get_string ());
if (suffix)
ACE_OS::strcat (this->nested_type_name_, suffix);
- //@@ ACE_OS::strcat (this->nested_type_name_, ")");
+ ACE_OS::strcat (this->nested_type_name_, ")");
return this->nested_type_name_;
} // end of if the root prefixes match
}