Source
124
124
}
125
125
return version;
126
126
}
127
127
128
128
bool VersionInfo::compare(const string& comparitor, const std::vector<int>& vec) {
129
129
std::vector<int> current_version { major( ), minor( ), patch( ), feature( ) };
130
130
for ( unsigned int i=0; i < vec.size( ); ++i )
131
131
if ( vec[i] < 0 ) throw(AipsError("negative values not allowed in version numbers"));
132
132
133
133
unsigned int limit = min(current_version.size( ),vec.size( ));
134
+
//std::cerr<< "Limit: " << limit << std::endl;
134
135
if ( comparitor == ">" ) {
136
+
135
137
for ( unsigned int i=0; i < limit; ++i ) {
138
+
//std::cerr<< "Test: " << current_version[i] << " " << vec[i] << std::endl;
136
139
if ( current_version[i] > vec[i] ) return true;
137
140
else if ( current_version[i] < vec[i] ) return false;
138
141
}
139
-
for ( unsigned int i=limit; i < current_version.size( ); ++i )
140
-
if ( current_version[i] > 0 ) return true;
142
+
for ( unsigned int i=limit; i < current_version.size( ); ++i ) {
143
+
//std::cerr<< "Test2: i:" << i << " current_version.size()" << current_version.size() << "current_version[i]" << current_version[i]<< std::endl;
144
+
if ( current_version[i] >= 0 ) return true;
145
+
}
141
146
return false;
142
147
} else if ( comparitor == "<" ) {
143
148
for ( unsigned int i=0; i < limit; ++i ) {
144
149
if ( current_version[i] > vec[i] ) return false;
145
150
else if ( current_version[i] < vec[i] ) return true;
146
151
}
147
152
return false;
148
153
} else if ( comparitor == ">=" ) {
149
154
for ( unsigned int i=0; i < limit; ++i ) {
150
155
if ( current_version[i] > vec[i] ) return true;