~ubuntu-branches/ubuntu/jaunty/aspectc++/jaunty

« back to all changes in this revision

Viewing changes to Puma/gen-release/step1/inc/Puma/CLanguage.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-07-07 14:41:02 UTC
  • mfrom: (1.1.3 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080707144102-lzml7t07f3sl00r5
Tags: 1.0pre4~svn.20080711-1
* new upstream snapshot.
* include all upstream documentation. Clarifying emails regarding
  licensing has been included into debian/copyright.
* reformat description following recomendations of
  http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
  (Closes: #480316)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef __CLanguage_h__
20
20
#define __CLanguage_h__
21
21
 
 
22
/** \file
 
23
 *  Entity name encoding. */
 
24
 
22
25
#include "Puma/DString.h"
23
26
 
24
 
// Entity name encoding language; language linkage
25
 
 
26
27
namespace Puma {
27
28
 
28
29
 
 
30
/** \class CLanguage CLanguage.h Puma/CLanguage.h
 
31
 *  Language specific encoding of entity names. The language
 
32
 *  is specified using the 'extern' linkage specifier.
 
33
 *
 
34
 *  Following languages are supported: "C", "C++". C entity 
 
35
 *  names are not encoded. C++ entity names usually are encoded
 
36
 *  according to the C++ V3 ABI mangling (see 
 
37
 *  http://www.codesourcery.com/cxx-abi/abi.html#mangling).
 
38
 *
 
39
 *  Example: 
 
40
 *  \code 
 
41
 * void foo(char);             // encoded as: _Z3fooc
 
42
 * extern "C" void bar(int);   // encoded as: bar
 
43
 *  \endcode */
29
44
class CLanguage {
30
45
public:
 
46
  /** Entity language encoding types. */
31
47
  enum LangType {
32
 
    LANG_C,
33
 
    LANG_CPLUSPLUS,
34
 
    LANG_OTHER,
35
 
    LANG_UNDEFINED
 
48
    /** Language C. */
 
49
    LANG_C,           
 
50
    /** Language C++. */
 
51
    LANG_CPLUSPLUS,   
 
52
    /** Neither C nor C++. */
 
53
    LANG_OTHER,       
 
54
    /** No explicit language encoding. */
 
55
    LANG_UNDEFINED    
36
56
  };
37
57
    
38
58
private:
40
60
  DString m_Text;
41
61
 
42
62
public:
 
63
  /** Constructor. */
43
64
  CLanguage () : m_Type (LANG_UNDEFINED), m_Text ("") {}
44
65
  
 
66
  /** Set the language encoding type.
 
67
   *  \param lt The language type. */
45
68
  void Type (LangType lt) { 
46
69
    m_Type = lt; m_Text = (lt==LANG_C)?"C":(lt==LANG_CPLUSPLUS)?"C++":""; 
47
70
  }
 
71
  /** Set the language encoding type.
 
72
   *  \param lt The language type.
 
73
   *  \param txt The language identifier for languages other than C or C++. */
48
74
  void Type (LangType lt, const char *txt) { 
49
75
    m_Type = lt; m_Text = (lt==LANG_C)?"C":(lt==LANG_CPLUSPLUS)?"C++":(lt==LANG_OTHER)?txt:""; 
50
76
  }
51
77
 
 
78
  /** Get the language type. */
52
79
  LangType Type () const { return m_Type; }
 
80
  /** Get the language identifier like "C" or "C++".
 
81
   *  \return The language identifier or the empty string. */
53
82
  const DString &Text () const { return m_Text; }
54
83
 
 
84
  /** Compare two language encodings.
 
85
   *  \param lang The language encoding to compare with. */
55
86
  bool operator== (const CLanguage &lang) { return (m_Type == lang.Type ()) && (m_Text == lang.Text ()); }
 
87
  /** Compare two language encodings.
 
88
   *  \param lt The language encoding type to compare with. */
56
89
  bool operator== (LangType lt) { return (m_Type == lt); }
57
90
};
58
91