source: tags/0.55/stopos_key.cpp @ 9

Last change on this file since 9 was 9, checked in by willem, 11 years ago

willem

File size: 834 bytes
Line 
1#include <string>
2#include "stopos_key.h"
3
4stopos_key::stopos_key()
5{
6//  this->value = this->firstchar;
7  this->set(0);
8}
9
10stopos_key::stopos_key(const std::string & s)
11{
12  this->value = s;
13}
14
15void stopos_key::impossible()
16{
17  this->value="%%%%";
18}
19
20void stopos_key::increment(void)
21{ // notused
22  int p = this->value.size();
23  while(1)
24  {
25    p--;
26    if (this->value[p] == lastchar)
27    {
28      this->value[p] = firstchar;
29      if (p == 0)
30      {
31        this->value = firstchar + this->value;
32        p = 1;
33      }
34    }
35    else
36    {
37      this->value[p] ++;
38      break;
39    }
40  }
41}
42
43std::string stopos_key::str(void) const
44{
45  return this->value;
46}
47
48bool stopos_key::operator==(const stopos_key &k) const
49{
50  return k.value == this->value;
51}
52
53bool stopos_key::operator!=(const stopos_key &k) const
54{
55  return k.value != this->value;
56}
57
Note: See TracBrowser for help on using the repository browser.