source: tags/0.5/stopos_key.cpp @ 9

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

willem

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