Cppcheck
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | List of all members
cppcheck::Platform Class Reference

Platform settings. More...

#include <platform.h>

Public Types

enum  Type {
  Unspecified , Native , Win32A , Win32W ,
  Win64 , Unix32 , Unix64 , File
}
 

Public Member Functions

 Platform ()
 
bool isIntValue (long long value) const
 
bool isIntValue (unsigned long long value) const
 
bool isLongValue (long long value) const
 
bool isLongValue (unsigned long long value) const
 
bool isLongLongValue (unsigned long long value) const
 
bool set (Type t)
 set the platform type for predefined platforms - deprecated use set(const std::string&, std::string&) instead More...
 
bool set (const std::string &platformstr, std::string &errstr, const std::vector< std::string > &paths={}, bool verbose=false)
 set the platform type More...
 
bool loadFromFile (const char exename[], const std::string &filename, bool verbose=false)
 load platform file More...
 
bool loadFromXmlDocument (const tinyxml2::XMLDocument *doc)
 load platform from xml document, primarily for testing More...
 
bool isWindows () const
 Returns true if platform type is Windows. More...
 
const char * toString () const
 
long long unsignedCharMax () const
 
long long signedCharMax () const
 
long long signedCharMin () const
 

Static Public Member Functions

static const char * toString (Type pt)
 

Public Attributes

nonneg int char_bit
 
nonneg int short_bit
 bits in char More...
 
nonneg int int_bit
 bits in short More...
 
nonneg int long_bit
 bits in int More...
 
nonneg int long_long_bit
 bits in long More...
 
nonneg int sizeof_bool
 bits in long long More...
 
nonneg int sizeof_short
 
nonneg int sizeof_int
 
nonneg int sizeof_long
 
nonneg int sizeof_long_long
 
nonneg int sizeof_float
 
nonneg int sizeof_double
 
nonneg int sizeof_long_double
 
nonneg int sizeof_wchar_t
 
nonneg int sizeof_size_t
 
nonneg int sizeof_pointer
 
char defaultSign
 
Type type
 platform type More...
 

Static Private Member Functions

static long long min_value (int bit)
 
static long long max_value (int bit)
 

Detailed Description

Platform settings.

Definition at line 43 of file platform.h.

Member Enumeration Documentation

◆ Type

Enumerator
Unspecified 
Native 
Win32A 
Win32W 
Win64 
Unix32 
Unix64 
File 

Definition at line 103 of file platform.h.

Constructor & Destructor Documentation

◆ Platform()

Platform::Platform ( )

Definition at line 30 of file platform.cpp.

References set().

Member Function Documentation

◆ isIntValue() [1/2]

bool cppcheck::Platform::isIntValue ( long long  value) const
inline

◆ isIntValue() [2/2]

bool cppcheck::Platform::isIntValue ( unsigned long long  value) const
inline

Definition at line 63 of file platform.h.

◆ isLongLongValue()

bool cppcheck::Platform::isLongLongValue ( unsigned long long  value) const
inline

Definition at line 77 of file platform.h.

Referenced by SymbolDatabase::setValueTypeInTokenList().

◆ isLongValue() [1/2]

bool cppcheck::Platform::isLongValue ( long long  value) const
inline

Definition at line 68 of file platform.h.

Referenced by getEnumType(), and SymbolDatabase::setValueTypeInTokenList().

◆ isLongValue() [2/2]

bool cppcheck::Platform::isLongValue ( unsigned long long  value) const
inline

Definition at line 72 of file platform.h.

◆ isWindows()

bool cppcheck::Platform::isWindows ( ) const
inline

Returns true if platform type is Windows.

Returns
true if Windows platform type.

Definition at line 139 of file platform.h.

Referenced by CheckIO::checkFileUsage(), CheckIO::checkFormatString(), CheckOther::checkInterlockedDecrement(), CheckIO::checkWrongPrintfScanfArguments(), and Tokenizer::combineStringAndCharLiterals().

◆ loadFromFile()

bool Platform::loadFromFile ( const char  exename[],
const std::string &  filename,
bool  verbose = false 
)

load platform file

Parameters
exenameapplication path
filenameplatform filename
verboselog verbose information about the lookup
Returns
returns true if file was loaded successfully

Definition at line 192 of file platform.cpp.

References Path::fromNativeSeparators(), and Path::getPathFromFilename().

Referenced by MainWindow::getCppcheckSettings(), and ProjectFileDialog::ProjectFileDialog().

◆ loadFromXmlDocument()

bool Platform::loadFromXmlDocument ( const tinyxml2::XMLDocument *  doc)

load platform from xml document, primarily for testing

Definition at line 243 of file platform.cpp.

References error, and xmlTextAsUInt().

◆ max_value()

static long long cppcheck::Platform::max_value ( int  bit)
inlinestaticprivate

Definition at line 51 of file platform.h.

◆ min_value()

static long long cppcheck::Platform::min_value ( int  bit)
inlinestaticprivate

Definition at line 45 of file platform.h.

◆ set() [1/2]

bool Platform::set ( const std::string &  platformstr,
std::string &  errstr,
const std::vector< std::string > &  paths = {},
bool  verbose = false 
)

set the platform type

Definition at line 153 of file platform.cpp.

◆ set() [2/2]

bool Platform::set ( Type  t)

set the platform type for predefined platforms - deprecated use set(const std::string&, std::string&) instead

Definition at line 36 of file platform.cpp.

Referenced by CppCheck::check(), MainWindow::getCppcheckSettings(), CmdLineParser::parseFromArgs(), and Platform().

◆ signedCharMax()

long long cppcheck::Platform::signedCharMax ( ) const
inline

Definition at line 176 of file platform.h.

Referenced by setTokenValueCast().

◆ signedCharMin()

long long cppcheck::Platform::signedCharMin ( ) const
inline

Definition at line 180 of file platform.h.

Referenced by CheckFunctions::memsetInvalid2ndParam(), and setTokenValueCast().

◆ toString() [1/2]

const char* cppcheck::Platform::toString ( ) const
inline

◆ toString() [2/2]

static const char* cppcheck::Platform::toString ( Type  pt)
inlinestatic

Definition at line 149 of file platform.h.

◆ unsignedCharMax()

long long cppcheck::Platform::unsignedCharMax ( ) const
inline

Definition at line 172 of file platform.h.

Referenced by CheckFunctions::memsetInvalid2ndParam().

Member Data Documentation

◆ char_bit

nonneg int cppcheck::Platform::char_bit

◆ defaultSign

char cppcheck::Platform::defaultSign

Definition at line 101 of file platform.h.

Referenced by ValueType::parseDecl(), and SymbolDatabase::SymbolDatabase().

◆ int_bit

nonneg int cppcheck::Platform::int_bit

◆ long_bit

nonneg int cppcheck::Platform::long_bit

◆ long_long_bit

nonneg int cppcheck::Platform::long_long_bit

◆ short_bit

nonneg int cppcheck::Platform::short_bit

◆ sizeof_bool

nonneg int cppcheck::Platform::sizeof_bool

bits in long long

size of standard types

Definition at line 89 of file platform.h.

Referenced by Tokenizer::fillTypeSizes(), Preprocessor::setPlatformInfo(), and ValueType::typeSize().

◆ sizeof_double

nonneg int cppcheck::Platform::sizeof_double

◆ sizeof_float

nonneg int cppcheck::Platform::sizeof_float

◆ sizeof_int

nonneg int cppcheck::Platform::sizeof_int

◆ sizeof_long

nonneg int cppcheck::Platform::sizeof_long

◆ sizeof_long_double

nonneg int cppcheck::Platform::sizeof_long_double

◆ sizeof_long_long

nonneg int cppcheck::Platform::sizeof_long_long

◆ sizeof_pointer

nonneg int cppcheck::Platform::sizeof_pointer

◆ sizeof_short

nonneg int cppcheck::Platform::sizeof_short

◆ sizeof_size_t

nonneg int cppcheck::Platform::sizeof_size_t

◆ sizeof_wchar_t

nonneg int cppcheck::Platform::sizeof_wchar_t

◆ type

Type cppcheck::Platform::type

The documentation for this class was generated from the following files: