blob: be2d3323813381262063860d218fbe61814338d4 [file] [log] [blame]
henrike@webrtc.org47be73b2014-05-13 18:00:26 +00001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_BASE_VERSIONPARSING_H_
12#define WEBRTC_BASE_VERSIONPARSING_H_
13
14#include <string>
15
16namespace rtc {
17
18// Parses a version string into an array. "num_expected_segments" must be the
19// number of numerical segments that the version is expected to have (e.g.,
20// "1.1.2.0" has 4). "version" must be an array of that length to hold the
21// parsed numbers.
22// Returns "true" iff successful.
23bool ParseVersionString(const std::string& version_str,
24 int num_expected_segments,
25 int version[]);
26
27// Computes the lexicographical order of two versions. The return value
28// indicates the order in the standard way (e.g., see strcmp()).
29int CompareVersions(const int version1[],
30 const int version2[],
31 int num_segments);
32
33} // namespace rtc
34
35#endif // WEBRTC_BASE_VERSIONPARSING_H_