Cupt
Namespaces | Classes | Functions | Variables
cupt Namespace Reference

Namespaces

namespace  cache
namespace  download
namespace  system

Classes

class  Cache
 the source of package and version information More...
class  Exception
 general library exception class More...
class  Config
 stores library's configuration variables More...
class  File
 high-level interface to file routines More...
class  HashSums
 hash sums More...

Functions

void fatal (const char *format,...)
void warn (const char *format,...)
void debug (const char *format,...)
void simulate (const char *format,...)
string __ (const char *message)
void consumePackageName (string::const_iterator begin, string::const_iterator end, string::const_iterator &resultEnd)
 reads package name in range
bool checkPackageName (const string &packageName, bool throwOnError=true)
 checks package name for correctness
bool checkVersionString (const string &versionString, bool throwOnError=true)
 checks version string for correctness
int compareVersionStrings (const string &left, const string &right)
 compares two version strings

Variables

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

Detailed Description


Function Documentation

string cupt::__ ( const char *  message)

localizes message

Parameters:
messageinput string
Returns:
localized message
bool cupt::checkPackageName ( const string &  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 ( string::const_iterator  begin,
string::const_iterator  end,
string::const_iterator &  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
void cupt::debug ( const char *  format,
  ... 
)
Deprecated:
an internal method, should not be used
void cupt::fatal ( const char *  format,
  ... 
)
Deprecated:
an internal method, should not be used
void cupt::simulate ( const char *  format,
  ... 
)
Deprecated:
an internal method, should not be used
void cupt::warn ( const char *  format,
  ... 
)
Deprecated:
an internal method, should not be used

Variable Documentation

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.