oct-uname.h

Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (C) 2005-2012 John W. Eaton
00004 
00005 This file is part of Octave.
00006 
00007 Octave is free software; you can redistribute it and/or modify it
00008 under the terms of the GNU General Public License as published by the
00009 Free Software Foundation; either version 3 of the License, or (at your
00010 option) any later version.
00011 
00012 Octave is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00015 for more details.
00016 
00017 You should have received a copy of the GNU General Public License
00018 along with Octave; see the file COPYING.  If not, see
00019 <http://www.gnu.org/licenses/>.
00020 
00021 */
00022 
00023 #if !defined (octave_uame_h)
00024 #define octave_uname_h 1
00025 
00026 #include <string>
00027 
00028 class
00029 OCTAVE_API
00030 octave_uname
00031 {
00032 public:
00033 
00034   octave_uname (void)
00035     : utsname_sysname ("unknown"), utsname_nodename ("unknown"),
00036       utsname_release ("unknown"), utsname_version ("unknown"),
00037       utsname_machine ("unknown"),
00038       msg ("uname not supported on this system"), err (-1)
00039   { init (); }
00040 
00041   octave_uname (const octave_uname& unm)
00042     : utsname_sysname (unm.utsname_sysname),
00043       utsname_nodename (unm.utsname_nodename),
00044       utsname_release (unm.utsname_release),
00045       utsname_version (unm.utsname_version),
00046       utsname_machine (unm.utsname_machine),
00047       msg (unm.msg), err (unm.err)
00048   { }
00049 
00050   octave_uname& operator = (const octave_uname& unm)
00051   {
00052     if (this != &unm)
00053       {
00054         utsname_sysname = unm.utsname_sysname;
00055         utsname_nodename = unm.utsname_nodename;
00056         utsname_release = unm.utsname_release;
00057         utsname_version = unm.utsname_version;
00058         utsname_machine = unm.utsname_machine;
00059 
00060         msg = unm.msg;
00061         err = unm.err;
00062       }
00063 
00064     return *this;
00065   }
00066 
00067   ~octave_uname (void) { }
00068 
00069   std::string sysname (void) const { return utsname_sysname; }
00070   std::string nodename (void) const { return utsname_nodename; }
00071   std::string release (void) const { return utsname_release; }
00072   std::string version (void) const { return utsname_version; }
00073   std::string machine (void) const { return utsname_machine; }
00074 
00075   std::string message (void) const { return msg; }
00076   int error (void) const { return err; }
00077 
00078 private:
00079 
00080   std::string utsname_sysname;
00081   std::string utsname_nodename;
00082   std::string utsname_release;
00083   std::string utsname_version;
00084   std::string utsname_machine;
00085 
00086   std::string msg;
00087   int err;
00088 
00089   void init (void);
00090 };
00091 
00092 #endif
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines