home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / access.h next >
Encoding:
C/C++ Source or Header  |  2001-02-24  |  4.3 KB  |  106 lines

  1. // $Id: access.h,v 1.12 2001/01/05 09:13:19 mdejong Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10.  
  11. #ifndef access_INCLUDED
  12. #define access_INCLUDED
  13.  
  14. #include "platform.h"
  15.  
  16. #ifdef    HAVE_JIKES_NAMESPACE
  17. namespace Jikes {    // Open namespace Jikes block
  18. #endif
  19.  
  20.  
  21. class AccessFlags
  22. {
  23. protected:
  24.     u2 access_flags;
  25.  
  26. public:
  27.  
  28.     bool ACC_PUBLIC()       { return (access_flags & 0x0001) != 0; }
  29.     bool ACC_PRIVATE()      { return (access_flags & 0x0002) != 0; }
  30.     bool ACC_PROTECTED()    { return (access_flags & 0x0004) != 0; }
  31.     bool ACC_STATIC()       { return (access_flags & 0x0008) != 0; }
  32.     bool ACC_FINAL()        { return (access_flags & 0x0010) != 0; }
  33.     bool ACC_SUPER()        { return (access_flags & 0x0020) != 0; }
  34.     bool ACC_SYNCHRONIZED() { return (access_flags & 0x0020) != 0; }
  35.     bool ACC_VOLATILE()     { return (access_flags & 0x0040) != 0; }
  36.     bool ACC_TRANSIENT()    { return (access_flags & 0x0080) != 0; }
  37.     bool ACC_NATIVE()       { return (access_flags & 0x0100) != 0; }
  38.     bool ACC_INTERFACE()    { return (access_flags & 0x0200) != 0; }
  39.     bool ACC_ABSTRACT()     { return (access_flags & 0x0400) != 0; }
  40.     bool ACC_STRICTFP()     { return (access_flags & 0x0800) != 0; }
  41.  
  42.     void SetACC_PUBLIC()       { access_flags |= 0x0001; }
  43.     void SetACC_PRIVATE()      { access_flags |= 0x0002; }
  44.     void SetACC_PROTECTED()    { access_flags |= 0x0004; }
  45.     void SetACC_STATIC()       { access_flags |= 0x0008; }
  46.     void SetACC_FINAL()        { access_flags |= 0x0010; }
  47.     void SetACC_SUPER()        { access_flags |= 0x0020; }
  48.     void SetACC_SYNCHRONIZED() { access_flags |= 0x0020; }
  49.     void SetACC_VOLATILE()     { access_flags |= 0x0040; }
  50.     void SetACC_TRANSIENT()    { access_flags |= 0x0080; }
  51.     void SetACC_NATIVE()       { access_flags |= 0x0100; }
  52.     void SetACC_INTERFACE()    { access_flags |= 0x0200; }
  53.     void SetACC_ABSTRACT()     { access_flags |= 0x0400; }
  54.     void SetACC_STRICTFP()     { access_flags |= 0x0800; }
  55.  
  56.     void ResetACC_PUBLIC()       { access_flags &= (~ 0x0001); }
  57.     void ResetACC_PRIVATE()      { access_flags &= (~ 0x0002); }
  58.     void ResetACC_PROTECTED()    { access_flags &= (~ 0x0004); }
  59.     void ResetACC_STATIC()       { access_flags &= (~ 0x0008); }
  60.     void ResetACC_FINAL()        { access_flags &= (~ 0x0010); }
  61.     void ResetACC_SUPER()        { access_flags &= (~ 0x0020); }
  62.     void ResetACC_SYNCHRONIZED() { access_flags &= (~ 0x0020); }
  63.     void ResetACC_VOLATILE()     { access_flags &= (~ 0x0040); }
  64.     void ResetACC_TRANSIENT()    { access_flags &= (~ 0x0080); }
  65.     void ResetACC_NATIVE()       { access_flags &= (~ 0x0100); }
  66.     void ResetACC_INTERFACE()    { access_flags &= (~ 0x0200); }
  67.     void ResetACC_ABSTRACT()     { access_flags &= (~ 0x0400); }
  68.     void ResetACC_STRICTFP()     { access_flags &= (~ 0x0800); }
  69.  
  70.     void ResetFlags() { access_flags = 0; }
  71.     void SetFlags(u2 access_flags_) { access_flags = access_flags_; }
  72.     void SetFlags(AccessFlags af)  { this -> access_flags = af.access_flags; }
  73.     u2 Flags() { return access_flags; }
  74.  
  75.     AccessFlags() : access_flags(0) {}
  76.     AccessFlags(u2& _access_flags) : access_flags(_access_flags) {}
  77.  
  78. #ifdef JIKES_DEBUG
  79.     void Print()
  80.     {
  81.         Coutput << " access_flags: ";
  82.         if (ACC_PUBLIC())       Coutput << " public";
  83.         if (ACC_PRIVATE())      Coutput << " private";
  84.         if (ACC_PROTECTED())    Coutput << " protected";
  85.         if (ACC_STATIC())       Coutput << " static";
  86.         if (ACC_FINAL())        Coutput << " final";
  87.         // super and synchronized use the same bit!
  88.         if (ACC_SYNCHRONIZED()) Coutput << " super_or_synchronized";
  89.         if (ACC_VOLATILE())     Coutput << " volatile";
  90.         if (ACC_TRANSIENT())    Coutput << " transient";
  91.         if (ACC_NATIVE())       Coutput << " native";
  92.         if (ACC_INTERFACE())    Coutput << " interface";
  93.         if (ACC_ABSTRACT())     Coutput << " abstract";
  94.         if (ACC_STRICTFP())     Coutput << " strictfp";
  95.         Coutput << "\n";
  96.     }
  97. #endif
  98. };
  99.  
  100. #ifdef    HAVE_JIKES_NAMESPACE
  101. }            // Close namespace Jikes block
  102. #endif
  103.  
  104. #endif
  105.  
  106.