ReactOS 0.4.16-dev-1946-g52006dd
appinfo.cpp File Reference
#include "rapps.h"
#include "appview.h"
Include dependency graph for appinfo.cpp:

Go to the source code of this file.

Macros

#define MAX_SCRNSHOT_NUM   16
 

Functions

static AppsCategories ClampAvailableCategory (AppsCategories Category)
 
int CompareVersion (const CStringW &left, const CStringW &right)
 
static InstallerType GetInstallerTypeFromString (const CStringW &Installer)
 

Macro Definition Documentation

◆ MAX_SCRNSHOT_NUM

#define MAX_SCRNSHOT_NUM   16

Definition at line 317 of file appinfo.cpp.

Function Documentation

◆ ClampAvailableCategory()

static AppsCategories ClampAvailableCategory ( AppsCategories  Category)
inlinestatic

Definition at line 14 of file appinfo.cpp.

15{
16 if (Category <= ENUM_LASTCATEGORY)
17 return Category;
18 return ENUM_CAT_OTHER; // Treat future categories we don't know as Other
19}
@ ENUM_LASTCATEGORY
Definition: appinfo.h:43
@ ENUM_CAT_OTHER
Definition: appinfo.h:41

◆ CompareVersion()

int CompareVersion ( const CStringW left,
const CStringW right 
)

Definition at line 93 of file appinfo.cpp.

94{
95 int nLeft = 0, nRight = 0;
96
97 while (true)
98 {
99 CStringW leftPart = left.Tokenize(L".", nLeft);
100 CStringW rightPart = right.Tokenize(L".", nRight);
101
102 if (leftPart.IsEmpty() && rightPart.IsEmpty())
103 return 0;
104 if (leftPart.IsEmpty())
105 return -1;
106 if (rightPart.IsEmpty())
107 return 1;
108
109 int leftVal, rightVal;
110
111 if (!StrToIntExW(leftPart, STIF_DEFAULT, &leftVal))
112 leftVal = 0;
113 if (!StrToIntExW(rightPart, STIF_DEFAULT, &rightVal))
114 rightVal = 0;
115
116 if (leftVal > rightVal)
117 return 1;
118 if (rightVal < leftVal)
119 return -1;
120 }
121}
bool IsEmpty() const noexcept
Definition: atlsimpstr.h:394
CStringT Tokenize(_In_z_ PCXSTR pszTokens, _Inout_ int &iStart) const
Definition: cstringt.h:947
BOOL WINAPI StrToIntExW(const WCHAR *str, DWORD flags, INT *ret)
Definition: string.c:972
#define L(x)
Definition: resources.c:13
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
#define STIF_DEFAULT
Definition: shlwapi.h:1058

Referenced by CAvailableApplicationInfo::InsertVersionInfo().

◆ GetInstallerTypeFromString()

static InstallerType GetInstallerTypeFromString ( const CStringW Installer)
static

Definition at line 379 of file appinfo.cpp.

380{
381 if (Installer.CompareNoCase(L"Inno") == 0)
382 return INSTALLER_INNO;
383 if (Installer.CompareNoCase(L"NSIS") == 0)
384 return INSTALLER_NSIS;
385 return INSTALLER_UNKNOWN;
386}
@ INSTALLER_NSIS
Definition: appinfo.h:88
@ INSTALLER_UNKNOWN
Definition: appinfo.h:83
@ INSTALLER_INNO
Definition: appinfo.h:87
int CompareNoCase(_In_z_ PCXSTR psz) const
Definition: cstringt.h:743

Referenced by CAvailableApplicationInfo::GetInstallerType().