Loading...
Searching...
No Matches
PhoneHome Class Reference

## Static Public Member Functions

static void | enableCompletionStatus (const char *programName=NULL)
static void | disableCompletionStatus ()
static bool | checkVersion (const char *programName, const char *version, const char *params=NULL)
static void | completionStatus (const char *status, const char *programName=NULL)
static void | setURL (const char *url)
static void | resetURL ()

## Static Public Attributes

static int | allThinning = 50

## Detailed Description

Definition at line 31 of file PhoneHome.h.

## Member Function Documentation

## checkVersion()

bool PhoneHome::checkVersion | ( | const char * | programName,
|  | const char * | version,
|  | const char * | params = `NULL`
| ) |  |

static

Definition at line 51 of file PhoneHome.cpp.

{
enableCompletionStatus();
add("pgm", programName);
add("vsn", version);
add("args", params);
connect();
// Look for this program in the returned string.
int start = ourReturnString.Find(ourToolName+"\t");
if(start < 0)
{
// Parse the toolName, and check for the program name
// just up to a ':'
int colStart = ourToolName.FastFindChar(':');
if(colStart >= 0)
{
ourToolName.SetLength(colStart);
start = ourReturnString.Find(ourToolName+"\t");
}
}
if(start < 0)
{
// This program name was not found in the version file,
// so it is a program for which version is not tracked,
// just return true.
return(true);
}
// Found this program, so extract the version.
start += ourToolName.Length();
while((start < ourReturnString.Length()) &&
isspace(ourReturnString[start]))
{
// Consume whitespace
++start;
}
// Start now contains the position of the start of the version
String thisVersion = version;
String latestVersion;
int end = start;
while((end < ourReturnString.Length()) &&
!isspace(ourReturnString[end]))
{
latestVersion += ourReturnString[end];
++end;
}
// std::cerr << "latest version = " << latestVersion << "\nthis version = " << thisVersion.c_str() << "\n";
if(latestVersion.FastCompare(thisVersion) > 0)
{
std::cerr << "\n**************************************************************************************\n"
<< "A new version, " << latestVersion
<< ", of " << ourToolName
<< " is available (currently running "
<< thisVersion.c_str() << ")"
<< "\n**************************************************************************************\n\n";
return(false);
}
return(true);
}
String
Definition StringBasics.h:39

## completionStatus()

void PhoneHome::completionStatus | ( | const char * | status,
|  | const char * | programName = `NULL`
| ) |  |

static

Definition at line 118 of file PhoneHome.cpp.

{
if(programName != NULL)
{
add("pgm", programName);
enableCompletionStatus();
}
if(ourEnableCompletionStatus)
{
add("status", status);
connect();
}
}

## disableCompletionStatus()

void PhoneHome::disableCompletionStatus | ( |  | ) |

static

Definition at line 45 of file PhoneHome.cpp.

{
ourEnableCompletionStatus = false;
}

## enableCompletionStatus()

void PhoneHome::enableCompletionStatus | ( | const char * | programName = `NULL` | ) |

static

Definition at line 35 of file PhoneHome.cpp.

{
if(programName != NULL)
{
add("pgm", programName);
}
ourEnableCompletionStatus = true;
}

## resetURL()

void PhoneHome::resetURL | ( |  | ) |

static

Definition at line 133 of file PhoneHome.cpp.

{
ourURL = ourBaseURL;
ourPrefixChar = '?';
}

## Member Data Documentation

## allThinning

int PhoneHome::allThinning = 50

static

Definition at line 35 of file PhoneHome.h.

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

- general/PhoneHome.h
- general/PhoneHome.cpp