Cupt
Namespaces | Classes | Functions | Variables
cupt Namespace Reference

Namespaces

 cache
 
 download
 
 system
 

Classes

class  Cache
 the source of package and version information More...
 
class  Config
 stores library's configuration variables More...
 
class  Exception
 general library exception class More...
 
class  HashSums
 hash sums More...
 
struct  Range
 
struct  StringRange
 

Functions

const char * __ (const char *message)
 localizes message More...
 
void consumePackageName (const char *begin, const char *end, const char *&resultEnd)
 reads package name in range More...
 
bool checkPackageName (StringRange packageName, bool throwOnError=true)
 checks package name for correctness More...
 
bool checkVersionString (const string &versionString, bool throwOnError=true)
 checks version string for correctness More...
 
int compareVersionStrings (const string &left, const string &right)
 compares two version strings More...
 
StringRange getOriginalVersionString (const StringRange &versionString)
 gets the original part of possibly Cupt-modified version string More...
 

Variables

const char *const libraryVersion
 the version of Cupt library
 
int messageFd
 message file descriptor More...
 

Detailed Description

Function Documentation

const char* cupt::__ ( const char *  message)

localizes message

Parameters
messageinput string
Returns
localized message
bool cupt::checkPackageName ( StringRange  packageName,
bool  throwOnError = true 
)

checks package name for correctness

Parameters
packageNamepackage name
throwOnErrorif set to true, function will throw exception if packageName is not correct
Returns
true if the packageName is correct, false if packageName is not correct and throwOnError is false
bool cupt::checkVersionString ( const string &  versionString,
bool  throwOnError = true 
)

checks version string for correctness

Equal to checkPackageName, only checks version string instead of package name

int cupt::compareVersionStrings ( const string &  left,
const string &  right 
)

compares two version strings

Parameters
leftleft version string
rightright version string
Returns
-1, if left < right, 0 if left == right, 1 if left > right
Note
The version strings may be logically equal even if they are not physically equal. Unless you are comparing version strings that belong to the same cache::Package, you should use this function to test their equality.
void cupt::consumePackageName ( const char *  begin,
const char *  end,
const char *&  resultEnd 
)

reads package name in range

Tries to read as more characters as possible from the begin, which form a valid package name, until end.

Parameters
beginrange begin iterator
endrange end iterator
[in,out]resultEndconsumed range end iterator
Example:
string input = "zzuf (>= 1.2)";
string::const_iterator resultEnd;
consumePackageName(input.begin(), input.end(), resultEnd);
cout << string(input.begin(), resultEnd) << endl;
"zzuf" will be printed
StringRange cupt::getOriginalVersionString ( const StringRange versionString)

gets the original part of possibly Cupt-modified version string

Cupt may apply Cupt-specific id suffixes to original version strings for its own use, mainly for distinguishing version which declare same version strings in the metadata but (possibly) having different content.

This function tells the version string as it was seen in the metadata.

Parameters
versionString

Variable Documentation

int cupt::messageFd

message file descriptor

All library error, warning, debug and simulate messages will be pointed here. If messageFd == -1, messages will be suppressed. Defaults to -1.