summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dibb <beandog@gentoo.org>2009-12-15 20:49:23 +0000
committerSteve Dibb <beandog@gentoo.org>2009-12-15 20:49:23 +0000
commit02b91d354e1b212418d8c512592d34e723b6126a (patch)
tree887d9abffba7b826696820d3d91bcc0df15a60d0 /class.portage.atom.php
parentinitial commit (diff)
downloadznurt-org-backend-02b91d354e1b212418d8c512592d34e723b6126a.tar.gz
znurt-org-backend-02b91d354e1b212418d8c512592d34e723b6126a.tar.bz2
znurt-org-backend-02b91d354e1b212418d8c512592d34e723b6126a.zip
git-svn-id: file:///var/svn/portage@2 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
Diffstat (limited to 'class.portage.atom.php')
-rw-r--r--class.portage.atom.php67
1 files changed, 67 insertions, 0 deletions
diff --git a/class.portage.atom.php b/class.portage.atom.php
new file mode 100644
index 0000000..8062d0d
--- /dev/null
+++ b/class.portage.atom.php
@@ -0,0 +1,67 @@
+<?
+
+ class PortageAtom extends PortageEbuild {
+
+ // Ranges
+ private $gt; // greater than >
+ private $lt; // lesser than <
+ private $eq; // equals =
+ private $ar; // any revision ~
+ private $av; // any version *
+
+ private $arr_chars;
+ private $arr_ranges;
+
+ public $ebuild_atom;
+
+ function __construct($str) {
+
+ $this->gt = false;
+ $this->lt = false;
+ $this->eq = false;
+ $this->ar = false;
+ $this->av = false;
+
+ // Find the ranges
+ if($str[0] == '>')
+ $this->gt = true;
+
+ if($str[0] == '<')
+ $this->lt = true;
+
+ if($str[0] == '=' || $str[1] == '=')
+ $this->eq = true;
+
+ if($str[0] == '~')
+ $this->ar = true;
+
+ $end = $str[strlen($str) - 1];
+
+ if($end == '*')
+ $this->av = true;
+
+ $this->arr_chars = array('>', '<', '=', '~', '*');
+
+ foreach($this->arr_chars as $char)
+ $str = str_replace($char, '', $str);
+
+ $this->arr_ranges = array('gt', 'lt', 'eq', 'ar', 'av');
+
+ $this->ebuild_atom = $str;
+
+
+ parent::__construct($this->ebuild_atom);
+
+ }
+
+ function __get($str) {
+
+ if(in_array($str, $this->arr_ranges))
+ return $this->$str;
+ else
+ return parent::__get($str);
+ }
+
+ }
+
+?> \ No newline at end of file