summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be_include/be_identifier_helper.h
blob: 171071f102695026b7da913169a9d75115288e8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// $Id$

/* -*- c++ -*- */
// ============================================================================
//
// = LIBRARY
//    TAO_IDL_BE_DLL
//
// = FILENAME
//    be_identifier_helper.h
//
// = DESCRIPTION
//    Utilities associated with UTL_Identifier.
//
// = AUTHOR
//    Jeff Parsons <j.parsons@vanderbilt.edu>
//
// ============================================================================

#ifndef BE_IDENTIFIER_HELPER_H
#define BE_IDENTIFIER_HELPER_H

#include "utl_scoped_name.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "TAO_IDL_BE_Export.h"
#include "ace/SString.h"

class Identifier;
class be_type;
class be_visitor;

struct TAO_IDL_BE_Export IdentifierHelper
{
  //
  // = TITLE
  //    IdentifierHelper.
  //
  // = DESCRIPTION
  //    1) keeps escape (leading underscore character in generated
  //       identifier in IDL
  //    2) removes the '_' escape character when the identifier is
  //       part of another identifier such as in provides_XXX
  //    3) removes any '_cxx_' in generated IDL
  
  static const char *
  type_name (be_type *t, be_visitor *visitor);
  
  static Identifier * 
  original_local_name (Identifier * local_name);
  
  // Removes '_cxx_ from segments of a scoped name, and optionally
  // de-escape the last segment, if it's to be appended to.
  static ACE_CString
  orig_sn (UTL_ScopedName * scoped_name, bool for_idl = true);

  // Detects case-insensitive match with IDL keyword.
  static bool
  is_idl_keyword (Identifier * local_name);
  
  // Preserves the 'escape' (leading underscore) in a
  // generated identifier if necessary.
  static ACE_CString 
  try_escape (Identifier * local_name);
  
  static ACE_CString tmp_retval_;
};

#endif /* BE_IDENTIFIER_HELPER_H */