File: VersionSpec.cpp

package info (click to toggle)
kdepim 4%3A2.2.2-5.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 14,908 kB
  • ctags: 14,522
  • sloc: cpp: 82,512; ansic: 30,637; sh: 10,838; yacc: 5,139; perl: 3,070; makefile: 1,447; python: 1,359; lex: 342; awk: 100
file content (91 lines) | stat: -rw-r--r-- 1,713 bytes parent folder | download | duplicates (2)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
	libldif - LDAP LDIF parsing library

	Copyright (C) 1998 Rik Hemsley rik@kde.org
	
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "ldif.h"

using namespace LDIF;

VersionSpec::VersionSpec()
	:	Entity	(),
		number_	(0)
{
}

VersionSpec::VersionSpec(const VersionSpec & x)
	:	Entity	(x),
		number_	(0)
{
}

VersionSpec::VersionSpec(const QCString & s)
	:	Entity	(s),
		number_	(0)
{
}

	VersionSpec &
VersionSpec::operator = (VersionSpec & x)
{
	if (*this == x) return *this;
	
	x.parse();
	number_ = x.number_;

	Entity::operator = (x);
	return *this;
}

	VersionSpec &
VersionSpec::operator = (const QCString & s)
{
	Entity::operator = (s);
	return *this;
}

	bool
VersionSpec::operator == (VersionSpec & x)
{
	x.parse();
	return (number_ == x.number_);
}

VersionSpec::~VersionSpec()
{
}

	void
VersionSpec::_parse()
{
	int split = strRep_.find(':');
	
	if (split == -1) {
		number_ = 0; // Invalid. Use version number 0.
		return;
	}
	
	number_ = strRep_.mid(split + 1).toInt();
}

	void
VersionSpec::_assemble()
{
	strRep_ = "version: " + QCString().setNum(number_);
}