OpendTect  6.6
odplatform.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert
8  Date: May 2010
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "basicmod.h"
15 #include "enums.h"
16 
17 namespace OD
18 {
19 
25 {
26 public:
27 
28  static const Platform& local();
29 
30  enum Type { Lin64, Win32, Win64, Mac };
32 
34  Platform( Type t )
35  : type_(t) {}
36  Platform( const char* s, bool isshortnm )
37  { set(s,isshortnm); }
38  Platform( bool iswin, bool is32, bool ismac=false )
39  { set(iswin,is32,ismac); }
40  bool operator ==( const Platform& p ) const
41  { return type_ == p.type_; }
42  bool operator ==( const Platform::Type& t ) const
43  { return type_ == t; }
44 
45  const char* longName() const { return toString(type_); }
46  const char* shortName() const;
47  const char* osName() const; // Linux, Windows, MacOS
48 
49  static bool isValidName(const char*,bool isshortnm);
50  void set(const char*,bool isshortnm);
51  inline void set( bool iswin, bool is32, bool ismac=false )
52  { type_ = ismac ? Mac : (iswin ? (is32 ? Win32 : Win64)
53  : Lin64 ); }
54 
55  inline bool isWindows() const
56  { return type_ == Win32 || type_ == Win64; }
57  inline bool isLinux() const
58  { return type_ == Lin64; }
59  inline bool isMac() const
60  { return type_ == Mac; }
61 
62  inline bool is32Bits() const
63  { return type_ != Win64 && type_ != Lin64; }
64 
65  inline Type type() const { return type_; }
66  inline Type& type() { return type_; }
67  inline void setType( Type t ) { type_ = t; }
68 
69 protected:
70 
72 
73 };
74 
75 } // namespace
76 
77 
78 #define mPlf(ptyp) OD::Platform(OD::Platform::ptyp)
79 #define mPlfShortName(ptyp) mPlf(ptyp).shortName()
80 
81 
OD::Platform::type_
Type type_
Definition: odplatform.h:71
OD::Platform::type
Type & type()
Definition: odplatform.h:66
OD::Platform::set
void set(const char *, bool isshortnm)
OD::Platform
Platform or Operating System.
Definition: odplatform.h:25
OD
OpendTect.
Definition: commontypes.h:28
OD::Platform::Win64
@ Win64
Definition: odplatform.h:30
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
mDeclareEnumUtils
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:257
operator==
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:81
OD::Platform::Platform
Platform(bool iswin, bool is32, bool ismac=false)
Definition: odplatform.h:38
OD::Platform::is32Bits
bool is32Bits() const
Definition: odplatform.h:62
OD::Platform::osName
const char * osName() const
Conv::set
void set(T &_to, const F &fr)
template based type conversion
Definition: convert.h:27
OD::Platform::longName
const char * longName() const
Definition: odplatform.h:45
OD::Platform::Type
Type
Definition: odplatform.h:30
OD::Platform::setType
void setType(Type t)
Definition: odplatform.h:67
enums.h
OD::Platform::set
void set(bool iswin, bool is32, bool ismac=false)
Definition: odplatform.h:51
OD::toString
Export_Basic const char * toString(PythonSource)
OD::Platform::Platform
Platform(const char *s, bool isshortnm)
Definition: odplatform.h:36
OD::Platform::isLinux
bool isLinux() const
Definition: odplatform.h:57
OD::Platform::isMac
bool isMac() const
Definition: odplatform.h:59
OD::Platform::type
Type type() const
Definition: odplatform.h:65
OD::Platform::isValidName
static bool isValidName(const char *, bool isshortnm)
OD::Platform::isWindows
bool isWindows() const
Definition: odplatform.h:55
OD::Platform::shortName
const char * shortName() const
mac, lux32, win64, etc.
OD::Platform::local
static const Platform & local()
This platform.

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B.V. 1995-2021