2011-01-29 20:59:58 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2011, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-02-04 20:43:07 +03:00
|
|
|
#ifndef _PACKAGE__PACKAGE_RESOLVABLE_H_
|
|
|
|
#define _PACKAGE__PACKAGE_RESOLVABLE_H_
|
2011-01-29 20:59:58 +03:00
|
|
|
|
|
|
|
|
|
|
|
#include <String.h>
|
|
|
|
|
2011-02-04 20:43:07 +03:00
|
|
|
#include <package/PackageResolvableType.h>
|
2011-01-29 20:59:58 +03:00
|
|
|
#include <package/PackageVersion.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
|
2011-02-09 22:11:23 +03:00
|
|
|
namespace BHPKG {
|
|
|
|
class BPackageResolvableData;
|
|
|
|
}
|
|
|
|
using BHPKG::BPackageResolvableData;
|
|
|
|
|
|
|
|
|
2011-01-29 20:59:58 +03:00
|
|
|
/*
|
|
|
|
* Defines a resolvable (something other packages can depend upon).
|
2011-06-27 05:48:00 +04:00
|
|
|
* Each resolvable is defined as a name (with an optional type prefix),
|
|
|
|
* an optional version, and an optional compatibility version (the least
|
|
|
|
* version the resolvable is backwards compatible with).
|
2011-01-29 20:59:58 +03:00
|
|
|
*
|
2011-06-27 05:48:00 +04:00
|
|
|
* resolvable ::= <name>['='<version>]['compat' '>=' <version>]
|
2011-01-29 20:59:58 +03:00
|
|
|
* name ::= [<type>':']<word>
|
|
|
|
* type ::= 'lib' | 'cmd' | 'app' | 'add_on'
|
|
|
|
*
|
|
|
|
* The type doesn't have any specific meaning to the dependency resolver,
|
|
|
|
* it just facilitates doing specific queries on the repository (like "is
|
|
|
|
* there any package providing the 'svn' command that the user just typed?").
|
|
|
|
* At a later stage, more types may be added in order to declare additional
|
|
|
|
* entities, e.g. translators.
|
|
|
|
*
|
|
|
|
* String examples:
|
|
|
|
* haiku=r1
|
|
|
|
* lib:libssl=0.9.8i
|
2011-06-27 05:48:00 +04:00
|
|
|
* subversion=1.5 compat>=1.0
|
2011-01-29 20:59:58 +03:00
|
|
|
* cmd:svn
|
|
|
|
*/
|
|
|
|
class BPackageResolvable {
|
|
|
|
public:
|
|
|
|
BPackageResolvable();
|
2011-02-09 22:11:23 +03:00
|
|
|
BPackageResolvable(
|
|
|
|
const BPackageResolvableData& data);
|
2011-01-29 20:59:58 +03:00
|
|
|
BPackageResolvable(const BString& name,
|
|
|
|
BPackageResolvableType type
|
|
|
|
= B_PACKAGE_RESOLVABLE_TYPE_DEFAULT,
|
|
|
|
const BPackageVersion& version
|
2011-06-27 05:48:00 +04:00
|
|
|
= BPackageVersion(),
|
|
|
|
const BPackageVersion& compatibleVersion
|
2011-01-29 20:59:58 +03:00
|
|
|
= BPackageVersion());
|
|
|
|
|
|
|
|
status_t InitCheck() const;
|
|
|
|
|
|
|
|
const BString& Name() const;
|
|
|
|
BPackageResolvableType Type() const;
|
|
|
|
const BPackageVersion& Version() const;
|
2011-06-27 05:48:00 +04:00
|
|
|
const BPackageVersion& CompatibleVersion() const;
|
2011-01-29 20:59:58 +03:00
|
|
|
|
2011-02-04 20:53:54 +03:00
|
|
|
BString ToString() const;
|
2011-01-29 20:59:58 +03:00
|
|
|
|
|
|
|
void SetTo(const BString& name,
|
|
|
|
BPackageResolvableType type
|
|
|
|
= B_PACKAGE_RESOLVABLE_TYPE_DEFAULT,
|
|
|
|
const BPackageVersion& version
|
2011-06-27 05:48:00 +04:00
|
|
|
= BPackageVersion(),
|
|
|
|
const BPackageVersion& compatibleVersion
|
2011-01-29 20:59:58 +03:00
|
|
|
= BPackageVersion());
|
|
|
|
void Clear();
|
|
|
|
|
|
|
|
public:
|
|
|
|
static const char* kTypeNames[];
|
|
|
|
|
|
|
|
private:
|
|
|
|
BString fName;
|
|
|
|
BPackageResolvableType fType;
|
|
|
|
BPackageVersion fVersion;
|
2011-06-27 05:48:00 +04:00
|
|
|
BPackageVersion fCompatibleVersion;
|
2011-01-29 20:59:58 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
2011-02-04 20:43:07 +03:00
|
|
|
#endif // _PACKAGE__PACKAGE_RESOLVABLE_H_
|