Ident.h

Go to the documentation of this file.
00001 /*
00002  * See the dyninst/COPYRIGHT file for copyright information.
00003  * 
00004  * We provide the Paradyn Tools (below described as "Paradyn")
00005  * on an AS IS basis, and do not warrant its validity or performance.
00006  * We reserve the right to update, modify, or discontinue this
00007  * software at any time.  We shall have no obligation to supply such
00008  * updates or modifications or any other form of support to you.
00009  * 
00010  * By your use of Paradyn, you understand and agree that we (or any
00011  * other person or entity with proprietary rights in Paradyn) are
00012  * under no obligation to provide either maintenance services,
00013  * update services, notices of latent defects, or correction of
00014  * defects for Paradyn.
00015  * 
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Lesser General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2.1 of the License, or (at your option) any later version.
00020  * 
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Lesser General Public License for more details.
00025  * 
00026  * You should have received a copy of the GNU Lesser General Public
00027  * License along with this library; if not, write to the Free Software
00028  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00029  */
00030 
00031 /************************************************************************
00032  * Ident.h: build identification functions (for POSIX systems)
00033  * $Id: Ident.h,v 1.10 2008/06/11 22:48:14 legendre Exp $
00034 ************************************************************************/
00035 
00036 
00037 #if !defined(_Ident_h_)
00038 #define _Ident_h_
00039 
00040 /************************************************************************
00041  * header files.
00042 ************************************************************************/
00043 
00044 #include <iostream>
00045 #include <ostream>
00046 //#include "debugOstream.h"
00047 #include "headers.h"
00048 #include "string-regex.h"
00049 
00050 /************************************************************************
00051  * class Ident
00052  ************************************************************************/
00053 
00054 class Ident {
00055   private:
00056     // making these private ensures they're not used:
00057     Ident &operator=(const Ident &);
00058     Ident(const Ident &);
00059 
00060   public:
00061      Ident (const char *Vstr, const char *expected_suite); // constructor
00062     ~Ident ();                                             // destructor
00063 
00064     bool OK () const { return ok_; }
00065 
00066     // uncapitalized versions are plain C strings
00067     const char* suite () const { return suite_; }
00068     const char* release () const { return release_; }
00069     const char* buildnum () const { return buildnum_; }
00070     const char* component () const { return component_; }
00071     const char* revision () const { return revision_; }
00072     const char* date () const { return date_; }
00073     const char* time () const { return time_; }
00074     const char* builder () const { return builder_; }
00075 
00076     // capitalized versions are C++ "String" strings
00077     std::string Suite () const { return std::string (suite_); }
00078     std::string Release () const { return std::string (release_); }
00079     std::string BuildNum () const { return std::string (buildnum_); }
00080     std::string Component () const { return std::string (component_); }
00081     std::string Revision () const { return std::string (revision_); }
00082     std::string Date () const { return std::string (date_); }
00083     std::string Time () const { return std::string (time_); }
00084     std::string Builder () const { return std::string (builder_); }
00085 
00086     friend std::ostream& operator<< (std::ostream &os, const Ident &Id);  // output
00087 
00088   private:
00089     bool ok_;                   
00090     char suite_[16];            // e.g. "Paradyn"
00091     char release_[16];          // e.g. "v2.1beta"
00092     char buildnum_[5];          // e.g. "-000"
00093     char component_[32];        // e.g. "paradynd"
00094     char revision_[5];          // e.g. "#314"
00095     char date_[11];             // e.g. "1999/12/31"
00096     char time_[6];              // e.g. "23:58"
00097     char builder_[32];          // e.g. "paradyn@cs.wisc.edu"
00098 };
00099 
00100 // NB: IdentFields/Formats below depend on Ident private members above
00101 static const int  IdentFields=7;
00102 #ifdef BROKEN_SSCANF
00103 static const char IdentFormat[]="$%s %20s %32s %5s %11s %6s %32s $";
00104 #else
00105 static const char IdentFormat[]="$%16s %20s %32s %5s %11s %6s %32s $";
00106 #endif
00107 static const char IdentOutFmt[]="$%s: %-5s%4s %-16s %-5s %s %s %s $";
00108 
00109 #endif /* !defined(_Ident_h_) */
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1