Cupt
packagename.hpp File Reference
#include <cupt/common.hpp>
#include <cupt/stringrange.hpp>

Go to the source code of this file.

Functions

void cupt::consumePackageName (const char *begin, const char *end, const char *&resultEnd)
 reads package name in range
 
bool cupt::checkPackageName (StringRange packageName, bool throwOnError=true)
 checks package name for correctness
 

Function Documentation

◆ checkPackageName()

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

◆ consumePackageName()

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