summaryrefslogtreecommitdiff
path: root/apt-pkg/version.h
blob: a30246946f368d4526f080d0ecf0ac6c695bba0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// -*- mode: cpp; mode: fold -*-
// Description								/*{{{*/
// $Id: version.h,v 1.1 1998/07/02 02:58:13 jgg Exp $
/* ######################################################################

   Version - Version string 
   
   This class implements storage and operators for version strings.

   The client is responsible for stripping epochs should it be desired.
   
   ##################################################################### */
									/*}}}*/
// Header section: pkglib
#ifndef PKGLIB_VERSION_H
#define PKGLIB_VERSION_H

#include <string>

class pkgVersion
{
   string Value;
   
   public:

   inline operator string () const {return Value;};

   // Assignmnet
   void operator =(string rhs) {Value = rhs;};
   
   // Comparitors. STL will provide the rest
   bool operator ==(const pkgVersion &rhs) const;
   bool operator <(const pkgVersion &rhs) const;
   
   pkgVersion();
   pkgVersion(string Version) : Value(Version) {};
};

int pkgVersionCompare(const char *A, const char *B);
int pkgVersionCompare(const char *A, const char *AEnd, const char *B, 
		   const char *BEnd);
int pkgVersionCompare(string A,string B);
bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op);

#endif