clang API Documentation

OptSpecifier.h
Go to the documentation of this file.
00001 //===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef CLANG_DRIVER_OPTSPECIFIER_H
00011 #define CLANG_DRIVER_OPTSPECIFIER_H
00012 
00013 namespace clang {
00014 namespace driver {
00015   class Option;
00016 
00017   /// OptSpecifier - Wrapper class for abstracting references to option IDs.
00018   class OptSpecifier {
00019     unsigned ID;
00020 
00021   private:
00022     explicit OptSpecifier(bool); // DO NOT IMPLEMENT
00023 
00024   public:
00025     OptSpecifier() : ID(0) {}
00026     /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {}
00027     /*implicit*/ OptSpecifier(const Option *Opt);
00028 
00029     bool isValid() const { return ID != 0; }
00030 
00031     unsigned getID() const { return ID; }
00032 
00033     bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }
00034     bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }
00035   };
00036 }
00037 }
00038 
00039 #endif